<?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>Homebrew 6502 &#8211; Nate&#039;s Blog</title>
	<atom:link href="https://oldblog.natebarney.com/category/electronics/homebrew-6502/feed/" rel="self" type="application/rss+xml" />
	<link>https://oldblog.natebarney.com</link>
	<description>Abandon all hope, ye who enter here</description>
	<lastBuildDate>Sun, 04 Dec 2022 16:45:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Tetris Theme</title>
		<link>https://oldblog.natebarney.com/2022/12/04/tetris-theme/</link>
					<comments>https://oldblog.natebarney.com/2022/12/04/tetris-theme/#respond</comments>
		
		<dc:creator><![CDATA[Nate Barney]]></dc:creator>
		<pubDate>Sun, 04 Dec 2022 04:03:35 +0000</pubDate>
				<category><![CDATA[Homebrew 6502]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[opl2]]></category>
		<category><![CDATA[projects]]></category>
		<guid isPermaLink="false">https://blog.natebarney.com/?p=125</guid>

					<description><![CDATA[When working on projects, I often let my mind stray toward future goals instead of staying focused on the immediate ones. Case in point: I started thinking about making a Tetris clone for my 6502 computer (once it has a video display). Naturally it would need music as well, since I&#8217;ve hooked up an OPL2 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>When working on projects, I often let my mind stray toward future goals instead of staying focused on the immediate ones. Case in point: I started thinking about making a <a href="https://en.wikipedia.org/wiki/Tetris">Tetris</a> clone for my <a href="https://blog.natebarney.com/2022/12/03/homebrew-6502-based-computer/" data-type="post" data-id="15">6502 computer</a> (once it has a video display). Naturally it would need music as well, since I&#8217;ve hooked up an OPL2 sound chip already. And of course, the music had to be the famous <a href="https://www.youtube.com/watch?v=z3ZiVn5L9vM">Tetris Theme</a> (a.k.a. <a href="https://en.wikipedia.org/wiki/Korobeiniki">The Peddler</a>). </p>



<p>The first step was to find some sheet music for the song. I found <a href="https://musescore.com/user/18821176/scores/3732656">this</a>, but <a href="https://musescore.org/">MuseScore</a> wouldn&#8217;t let me download it without registering for an account. I&#8217;m not about to do that. But, it&#8217;s pretty short, so I just entered it into my local install of MuseScore. Here it is for the curious:</p>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview" hidden class="wp-block-file__embed" data="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Tetris Theme Sheet Music."></object><a id="wp-block-file--media-e32ed111-451f-41fb-8a72-3d55affdcb9f" href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.pdf">Tetris Theme Sheet Music</a><a href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-e32ed111-451f-41fb-8a72-3d55affdcb9f">Download</a></div>



<div class="wp-block-file"><a id="wp-block-file--media-3e4e16ff-d221-4094-ab1d-893ebbf68b98" href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.mscz">Tetris Theme MuseScore File</a><a href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.mscz" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-3e4e16ff-d221-4094-ab1d-893ebbf68b98">Download</a></div>



<p>And this is what it sounds like, in case you don&#8217;t remember:</p>



<figure class="wp-block-audio"><audio controls src="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.mp3"></audio><figcaption class="wp-element-caption">Tetris Theme</figcaption></figure>



<p>Listening to this, I felt like it was pretty plain. I wanted to spice it up a bit. So, I added some drums (some tweaks were suggested by Donnett). Also, a retro video game shouldn&#8217;t sound like a piano. A square wave would be much more appropriate. With those changes, we get this:</p>



<figure class="wp-block-audio"><audio controls src="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Square_Wave_And_Drums.mp3"></audio><figcaption class="wp-element-caption">Tetris Theme w/ Square Wave and Drums</figcaption></figure>



<p>That&#8217;s more like it! Much more fun to play Tetris to, IMO. But, it needs just a little bit more. Donnett has been teaching me some music theory, and I wanted to see if I could figure out what chords would sound good in a bass line. With one slight tweak from her (change first chord in second phrase to a 2 instead of a 7), I&#8217;m really happy with how it sounds in MuseScore (the chords start at 0:42):</p>



<figure class="wp-block-audio"><audio controls src="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Square_Wave_Drums_And_Bass_Synth.mp3"></audio><figcaption class="wp-element-caption">Tetris Theme w/ Square Wave, Drums, and Bass Synth</figcaption></figure>



<p>For the musically inclined, here&#8217;s the updated sheet music and MuseScore files:</p>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview" hidden class="wp-block-file__embed" data="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Enhanced.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Tetris Theme (Enhanced) Sheet Music."></object><a id="wp-block-file--media-bef2fee8-a157-479c-9aa8-0b5d99df4990" href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Enhanced.pdf">Tetris Theme (Enhanced) Sheet Music</a><a href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Enhanced.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-bef2fee8-a157-479c-9aa8-0b5d99df4990">Download</a></div>



<div class="wp-block-file"><a id="wp-block-file--media-bca89c55-d800-4416-89d2-f82917513ad5" href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Enhanced.mscz">Tetris Theme (Enhanced) MuseScore File</a><a href="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Enhanced.mscz" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-bca89c55-d800-4416-89d2-f82917513ad5">Download</a></div>



<p>But we&#8217;re not done yet! Remember, the point of this whole exercise is to get it running on a 6502 computer with an OPL2 sound chip. To that end, I started looking at tracker programs. I found one called <a href="http://adlibtracker.net/">Adlib Tracker 2</a> that I liked pretty well, and set it up in <a href="https://www.dosbox.com/">DOSBox</a>. It&#8217;s got a fantastic 90&#8217;s-era look, and it&#8217;s pretty powerful.</p>



<p>After a little learning curve, I was able to pick out some instruments, tweak them to get them sounding the way I want, and enter the notes. Here&#8217;s a video capture of the tracker playing the OPL2 version of my arrangement. (Note that the tempo is a bit slower. I didn&#8217;t notice when I was first doing this, but now listening to both speeds, I think I prefer the slightly slower version.)</p>



<figure class="wp-block-video"><video height="480" style="aspect-ratio: 720 / 480;" width="720" controls preload="auto" src="https://blog.natebarney.com/wp-content/uploads/2022/12/tetris-adtrack2.mp4"></video><figcaption class="wp-element-caption">Adlib Tracker 2 playing Tetris Theme</figcaption></figure>



<p>The last step is to get this ported over to run on the homebrew machine. This was easier said than done. Eventually, I&#8217;ll probably write something to process the <a href="http://adlibtracker.net/files/techinfo.htm#_Toc389385056">A2M file format</a> created by Adlib Tracker 2, but this time, I used DOSBox&#8217;s OPL capture feature to capture a DRO file. Then I downloaded and compiled the utilities in the <a href="https://github.com/vgmrips/vgmtools">vgmtools</a> github repository. It has two utilities I needed: <code>dro2vgm</code>,  and <code>vgmtrim</code>. I had previously written a python script to extract the OPL2 commands I need from a <a href="https://vgmrips.net/wiki/VGM_Specification">VGM</a> file. (By the way, <a href="https://vgmrips.net/packs/chip/ym3812">vgmrips.net</a> has a fantastic collection of music from old video games, using OPL2, OPL3, and many other chips.) So, finally, I have this song playing on my homebrew computer!</p>



<figure class="wp-block-video"><video height="720" style="aspect-ratio: 1280 / 720;" width="1280" controls src="https://blog.natebarney.com/wp-content/uploads/2022/12/tetris-6502.mp4"></video><figcaption class="wp-element-caption">Homebrew 6502 Computer playing Tetris Theme</figcaption></figure>



<p>Pretty good for a 47-year old CPU!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oldblog.natebarney.com/2022/12/04/tetris-theme/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme.mp3" length="1123891" type="audio/mpeg" />
<enclosure url="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Square_Wave_And_Drums.mp3" length="1142699" type="audio/mpeg" />
<enclosure url="https://blog.natebarney.com/wp-content/uploads/2022/12/Tetris_Theme_Square_Wave_Drums_And_Bass_Synth.mp3" length="1142699" type="audio/mpeg" />
<enclosure url="https://blog.natebarney.com/wp-content/uploads/2022/12/tetris-adtrack2.mp4" length="5216514" type="video/mp4" />
<enclosure url="https://blog.natebarney.com/wp-content/uploads/2022/12/tetris-6502.mp4" length="10957410" type="video/mp4" />

			</item>
		<item>
		<title>Homebrew 6502-Based Computer</title>
		<link>https://oldblog.natebarney.com/2022/12/03/homebrew-6502-based-computer/</link>
					<comments>https://oldblog.natebarney.com/2022/12/03/homebrew-6502-based-computer/#respond</comments>
		
		<dc:creator><![CDATA[Nate Barney]]></dc:creator>
		<pubDate>Sat, 03 Dec 2022 19:09:19 +0000</pubDate>
				<category><![CDATA[Homebrew 6502]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[projects]]></category>
		<guid isPermaLink="false">https://blog.natebarney.com/?p=15</guid>

					<description><![CDATA[I&#8217;ve been toying with the idea of building a 6502-based (or rather, 65C02-based) computer for a few years now. I was inspired by Ben Eater&#8216;s YouTube series about it. I bought a bunch of chips from Mouser, and every so often I&#8217;d think about how to do this or that for the notional computer. Well, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve been toying with the idea of building a <a href="https://en.wikipedia.org/wiki/MOS_Technology_6502">6502</a>-based (or rather, <a href="https://en.wikipedia.org/wiki/WDC_65C02">65C02</a>-based) computer for a few years now. I was inspired by <a href="https://eater.net/">Ben Eater</a>&#8216;s <a href="https://www.youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH">YouTube series about it</a>. I bought a bunch of chips from <a href="https://www.mouser.com/">Mouser</a>, and every so often I&#8217;d think about how to do this or that for the notional computer. Well, finally I&#8217;ve decided to build one.</p>



<figure class="wp-block-image aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" src="https://blog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502.jpg" alt="" class="wp-image-18" width="518" height="565" srcset="https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502.jpg 2072w, https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502-275x300.jpg 275w, https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502-939x1024.jpg 939w, https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502-768x838.jpg 768w, https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502-1408x1536.jpg 1408w, https://oldblog.natebarney.com/wp-content/uploads/2022/12/homebrew-6502-1878x2048.jpg 1878w" sizes="(max-width: 518px) 100vw, 518px" /><figcaption class="wp-element-caption">My homebrew 6502-based breadboard computer</figcaption></figure>



<p>I&#8217;ve made some changes from Ben&#8217;s design. I&#8217;m using <a href="https://en.wikipedia.org/wiki/Complex_programmable_logic_device">CPLD</a>&#8216;s for address decoding, an 8k ROM instead of 32k (but I can adjust the address decoding to support up to 32k ROM), 64k RAM (not all addressable due to ROM and I/O), 4 <a href="https://en.wikipedia.org/wiki/WDC_65C22">65C22</a> VIA&#8217;s, and a 4 MHz clock. So far I&#8217;ve added a 20&#215;4 character LCD, a <a href="https://en.wikipedia.org/wiki/Yamaha_OPL#OPL2">YM3812 (OPL2)</a> sound chip, and a NES controller. I have plans to add a PS/2 keyboard, an SD card reader, upgrade the clock frequency to 8 MHz, upgrade the OPL2 to an <a href="https://en.wikipedia.org/wiki/Yamaha_OPL#OPL3">OPL3</a>, and add a composite video display using the <a href="https://en.wikipedia.org/wiki/Texas_Instruments_TMS9918">TMS9918A</a> video chip.</p>



<p>I&#8217;ll make a bunch of posts in the future about various technical topics related to this, but I wanted to start with this general post introducing the project.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://oldblog.natebarney.com/2022/12/03/homebrew-6502-based-computer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
