{"id":924,"date":"2023-05-05T20:25:09","date_gmt":"2023-05-06T00:25:09","guid":{"rendered":"https:\/\/pmcgovern.ca\/wp\/?p=924"},"modified":"2023-05-05T20:26:33","modified_gmt":"2023-05-06T00:26:33","slug":"vic-20-tetris","status":"publish","type":"post","link":"https:\/\/pmcgovern.ca\/wp\/?p=924","title":{"rendered":"VIC-20 Tetris"},"content":{"rendered":"<p>Wrote Tetris in <a href=\"http:\/\/visual6502.org\/JSSim\/index.html\">6502<\/a> assembly for the Commodore VIC-20. You can find it <a href=\"https:\/\/github.com\/paulmcgovern\/victris\">here.<\/a><\/p>\n<p>Collision detection is a mess, and the sound effects are primitive. Flicker is also a problem. The pros are able to synchronize rendering with the scan line of the CRT, which is far outside my understanding. On the other hand, the executable is <strong>1,867<\/strong> bytes, so there&#8217;s that.<\/p>\n<p>I wrote it on Linux, using <a href=\"https:\/\/cc65.github.io\/\">CC65<\/a> and <a href=\"https:\/\/vice-emu.sourceforge.io\/\">VICE<\/a>. I had problems compiling VICE so ended up running it through <a href=\"https:\/\/flathub.org\/apps\/net.sf.VICE\">Flatpak<\/a>. The Flatpak bundle also comes with the <a href=\"https:\/\/vice-emu.sourceforge.io\/vice_14.html\">c1541<\/a> utility for making disk images. The assembler can generate a label file which makes debugging with the <a href=\"https:\/\/www.cc65.org\/doc\/debugging-4.html\">VICE monitor<\/a> much, much easier.<\/p>\n<p><a href=\"https:\/\/vice-emu.sourceforge.io\/vice_14.html\"><\/a><a href=\"https:\/\/vice-emu.sourceforge.io\/vice_14.html\">I would recommend writing games for a <\/a><a href=\"https:\/\/en.wikipedia.org\/wiki\/MOS_Technology_6502#Computers_and_games\">6502-based system<\/a> to anyone interested in low-level programming. The toolchains and emulators are excellent, and there is a vibrant community of enthusiasts who continue to churn out new software for these machines. There&#8217;s lots of examples to work from, and while the 6502 is limited, it&#8217;s simplicity makes it easy to learn. In contrast, the x86 <a href=\"https:\/\/www.felixcloutier.com\/x86\/\">instruction set<\/a> looks like it was designed by a cartoon villain. I can&#8217;t imagine very many people understand all its instructions.<\/p>\n<p>It&#8217;s also humbling to write a game for the VIC-20. By today&#8217;s standards, it is a very simple machine, and nearly simple enough for me to understand in its entirety. I barely understand how a machine with three registers, 56 instructions, and 4k of RAM works, which reinforces my belief we don&#8217;t really have any idea what&#8217;s going on inside contemporary machines.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wrote Tetris in 6502 assembly for the Commodore VIC-20. You can find it here. Collision detection is a mess, and the sound effects are primitive. Flicker is also a problem. The pros are able to synchronize rendering with the scan&#8230;<\/p>\n","protected":false},"author":1,"featured_media":925,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13],"class_list":["post-924","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-various","tag-programming"],"_links":{"self":[{"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/posts\/924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=924"}],"version-history":[{"count":10,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/posts\/924\/revisions"}],"predecessor-version":[{"id":935,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/posts\/924\/revisions\/935"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=\/wp\/v2\/media\/925"}],"wp:attachment":[{"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pmcgovern.ca\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}