<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>compiler | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/compiler/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Sun, 04 Oct 2020 10:21:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>compiler | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>A comprehensive small C compiler</title>
		<link>https://learncgames.com/a-comprehensive-small-c-compiler/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-comprehensive-small-c-compiler</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 05 Oct 2020 23:00:04 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[compiler]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=1538</guid>

					<description><![CDATA[<p>Once you&#8217;ve learnt a fair bit of C, one way to increase your understanding of it is to see how a C compiler works. Unlike most other programming languages, C compilers are generally understandable. There have been a few tiny or small C compilers around and here is another one though as its C111 compatible, [&#8230;]</p>
The post <a href="https://learncgames.com/a-comprehensive-small-c-compiler/">A comprehensive small C compiler</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:472,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/geralt-9301\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=942487&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260128125116\/https:\/\/pixabay.com\/users\/geralt-9301\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:42&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-12 02:14:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-22 09:31:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 22:26:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 14:16:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-15 04:58:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 06:58:02&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-30 05:47:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:473,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=942487&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-12 02:14:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-22 09:31:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 22:26:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 14:16:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-15 04:58:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 06:58:02&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-30 05:47:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 04:25:31&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:31&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:474,&quot;href&quot;:&quot;https:\/\/github.com\/rui314\/chibicc&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260203183017\/https:\/\/github.com\/rui314\/chibicc&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 02:14:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 09:31:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 13:52:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:475,&quot;href&quot;:&quot;https:\/\/lld.llvm.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205022150\/https:\/\/lld.llvm.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 02:14:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 09:31:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 13:52:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 04:25:32&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:32&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:476,&quot;href&quot;:&quot;https:\/\/git-scm.com&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206080639\/https:\/\/git-scm.com\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 02:14:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 09:31:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 13:52:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:33&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:477,&quot;href&quot;:&quot;https:\/\/sqlite.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260204183341\/https:\/\/www.sqlite.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 02:14:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-22 09:31:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-12 13:52:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-05 04:25:34&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-05 04:25:34&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:478,&quot;href&quot;:&quot;http:\/\/www.libpng.org\/pub\/png\/libpng.html&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260204064028\/https:\/\/www.libpng.org\/pub\/png\/libpng.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:15:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 02:14:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 09:31:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 23:50:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 17:26:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 04:48:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 10:35:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-29 14:35:45&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 10:29:09&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-03 10:29:09&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_1539" aria-describedby="caption-attachment-1539" style="width: 300px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-1539" src="https://learncgames.com/wp-content/uploads/2020/10/programming-942487_640-300x212.jpg" alt="Programming image" width="300" height="212" srcset="https://learncgames.com/wp-content/uploads/2020/10/programming-942487_640-300x212.jpg 300w, https://learncgames.com/wp-content/uploads/2020/10/programming-942487_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-1539" class="wp-caption-text">Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=942487">Gerd Altmann</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=942487">Pixabay</a></figcaption></figure>
<p>Once you&#8217;ve learnt a fair bit of C, one way to increase your understanding of it is to see how a C compiler works. Unlike most other programming languages, C compilers are generally understandable. There have been a few tiny or small C compilers around and <a title="Link to chibiss on GitHub" href="https://github.com/rui314/chibicc" target="_blank" rel="nofollow noopener noreferrer">here is another one</a> though as its C111 compatible, it might be more useful than older ones.</p>
<p>The author is well qualified to write this, he&#8217;s the author of the <a title="Link to llvm lld linker" href="https://lld.llvm.org/" target="_blank" rel="nofollow noopener noreferrer">llvm lld linker</a> and also an earlier C compiler 8CC. He notes &#8220;chibicc can compile several real-world programs, including <a href="https://git-scm.com/" rel="nofollow">Git</a>, <a href="https://sqlite.org/" rel="nofollow">SQLite</a> and <a href="http://www.libpng.org/pub/png/libpng.html" rel="nofollow">libpng</a>, without making modifications to the compiled programs. Generated executables of these programs pass their corresponding test suites.&#8221;</p>
<p>Rui is writing a book on the C compiler and this is the subject of the book. It&#8217;s not out yet but will be in my must buy list.</p>The post <a href="https://learncgames.com/a-comprehensive-small-c-compiler/">A comprehensive small C compiler</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1538</post-id>	</item>
		<item>
		<title>Who needs asm? cc65 C compiler</title>
		<link>https://learncgames.com/who-needs-asm-cc65-c-compiler/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=who-needs-asm-cc65-c-compiler</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Fri, 17 Jul 2020 23:00:49 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[compiler]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=998</guid>

					<description><![CDATA[<p>Back in the day 1984-1989, I wrote games in Z80 and 6502 assembly. It would be another 10 years before I learnt C++ and ten years after that for C. But I would have killed to have had a C compiler that generated 6502 code back then. Writing assembly language code is slow and painstaking. [&#8230;]</p>
The post <a href="https://learncgames.com/who-needs-asm-cc65-c-compiler/">Who needs asm? cc65 C compiler</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:620,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/OpenClipart-Vectors-30363\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=160186&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251230124419\/https:\/\/pixabay.com\/users\/openclipart-vectors-30363\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:49:38&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-18 04:42:41&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-15 19:23:34&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-29 15:11:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-03 09:16:29&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-03 09:16:29&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:621,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=160186&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:49:43&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-18 04:42:41&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-15 19:23:34&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-29 15:11:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-03 09:16:27&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-03 09:16:27&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:622,&quot;href&quot;:&quot;https:\/\/cc65.github.io&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260106152809\/https:\/\/cc65.github.io\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:49:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 13:54:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-22 05:50:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 12:29:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-04 18:50:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-08 05:20:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-29 15:11:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 09:11:28&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-02 09:11:28&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_999" aria-describedby="caption-attachment-999" style="width: 300px" class="wp-caption alignleft"><img decoding="async" class="size-medium wp-image-999" src="https://learncgames.com/wp-content/uploads/2020/07/commodore-160186_640-300x150.png" alt="Commodore Computer" width="300" height="150" srcset="https://learncgames.com/wp-content/uploads/2020/07/commodore-160186_640-300x150.png 300w, https://learncgames.com/wp-content/uploads/2020/07/commodore-160186_640.png 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-999" class="wp-caption-text">Image by <a href="https://pixabay.com/users/OpenClipart-Vectors-30363/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=160186">OpenClipart-Vectors</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=160186">Pixabay</a></figcaption></figure>
<p>Back in the day 1984-1989, I wrote games in Z80 and 6502 assembly. It would be another 10 years before I learnt C++ and ten years after that for C. But I would have killed to have had a C compiler that generated 6502 code back then. Writing assembly language code is slow and painstaking. You have to remember whats in each register (A,X and Y) and what you are using page 0 locations for.</p>
<p>It takes the same length of time to write and debug 10 lines of 6502 assembler as it does to write 10 lines of C.  But those ten lines of C can do way more than 10 lines of 6502 assembly.</p>
<p>On a 6502 which is an 8 bit CPU with 16-bit addressing, memory goes from 0-65535. It takes two bytes for an address unless it is in the first 256 bytes (0-255) which only needs 1 byte. You can optimise your code by using page 0 for many variables. It only takes 2-byte instructions to fetch them from memory and write them back. The first byte is the instruction, the 2nd the address. Compare that with the rest of memory where instructions are three bytes long with 2-bytes for the address.</p>
<p><a title="Link to cc65" href="https://cc65.github.io/" target="_blank" rel="noopener noreferrer">CC65</a> is a C compiler that generates 6502 code. It&#8217;s mostly written in C. I&#8217;ve added a permanent link to it on the <a title="Link to C codes page" href="https://learncgames.com/c-code-links/" target="_blank" rel="noopener noreferrer">C Codes link</a> page. Pictured is a CBM-64 like the one I used to own.</p>The post <a href="https://learncgames.com/who-needs-asm-cc65-c-compiler/">Who needs asm? cc65 C compiler</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">998</post-id>	</item>
	</channel>
</rss>
