<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4757118446768919900</id><updated>2012-01-27T07:07:16.009-08:00</updated><category term='darwin'/><category term='loop'/><category term='optimisation'/><category term='tools'/><category term='robot'/><category term='privacy'/><category term='benchmark'/><category term='events'/><category term='altera'/><category term='koch curve'/><category term='forth'/><category term='8080'/><category term='museum'/><category term='demo'/><category term='assembly'/><category term='cellular automata'/><category term='easter'/><category term='compression'/><category term='bf'/><category term='128b'/><category term='ssem'/><category term='core war'/><category term='bookshelf'/><category term='programming books'/><category term='corewar'/><category term='semaphore'/><category term='cave'/><category term='z80'/><category term='operating system'/><category term='sin'/><category term='contest'/><category term='arduino'/><category term='text adventure'/><category term='home computers'/><category term='basic'/><category term='programming'/><category term='8086'/><category term='subneg'/><category term='optimise'/><category term='rssb'/><category term='font'/><category term='bf joust'/><category term='game'/><category term='#songsincode'/><category term='asm'/><category term='microcontroller'/><category term='editor'/><category term='primes'/><category term='infinite loop'/><category term='emulator'/><category term='redcode'/><category term='subleq'/><category term='twitter'/><category term='kernel'/><category term='corelife'/><category term='history'/><category term='alife'/><category term='quotes'/><category term='urisc'/><category term='til'/><category term='oisc'/><category term='8088'/><category term='sbn'/><category term='recursion'/><title type='text'>Retro Programming</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>52</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-1184526678594110239</id><published>2011-12-29T15:16:00.000-08:00</published><updated>2011-12-29T16:36:42.584-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='microcontroller'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>USB Stick Microcontroller Dev Boards</title><content type='html'>&lt;p&gt;A USB programmable microcontroller is a cheap and easy way to begin experimenting with microcontroller projects. I've recently been playing with 6 USB sticks which can be picked up for under &amp;pound;25 ($40) and discovered three I would recommend, the Micropendous, Minimus and eZ430. Have I missed your favourite USB stick based microcontroller?&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-uqmOIA6rHLw/TvzVTFVRNUI/AAAAAAAAB74/CLiIlJWxrqk/s1600/usb_dev_boards.jpg" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3&gt;Micropendous3&lt;/h3&gt;&lt;p&gt;The &lt;a href="http://code.google.com/p/micropendous/wiki/Micropendous3"&gt;Micropendous3&lt;/a&gt; (top left) contains an ATMEL AVR AT90USB647 microcontroller with 64K flash, 2K EEPROM and 4K SRAM and allows access to the MCU's 48 I/O lines. The board also supports the AT90USB1287 with 128K flash, 4K EEPROM and 8K SRAM. Support and development software are available online.&lt;/p&gt;&lt;h3&gt;Maximus AVR USB 1.2&lt;/h3&gt;&lt;p&gt;Despite it's name the Maximus AVR 1.2 (top right) is based on Microchip Technology's PIC18F4550 microcontroller with 32K flash, 2K SRAM and 256 bytes EEPROM. Unfortunately the board layout doesn't allow access to the MCU pins.&lt;/p&gt;&lt;h3&gt;Minimus AVR USB 32K&lt;/h3&gt;&lt;p&gt;The &lt;a href="http://minimususb.com"&gt;Minimus&lt;/a&gt; 32K (middle left) uses ATMEL's ATMEGA32U2 with 32K flash, 1K EEPROM and 1K SRAM. The board allows access to the MCU's 22 I/O lines. Development software is available online.&lt;/p&gt;&lt;h3&gt;eZ430-F2013&lt;/h3&gt;&lt;p&gt;Texas Instrument's &lt;a href="http://www.ti.com/tool/ez430-f2013"&gt;eZ430-F2013&lt;/a&gt; (middle right) has a detachable target board containing a MSP430F2013 microcontroller with 2K flash and 128 bytes SRAM. The board allows access to all MCU pins. The eZ430 is supplied with development tools for Windows and support is readily available online. The instruction set is easy to learn with just 27 instructions and 4 addressing modes.&lt;/p&gt; &lt;h3&gt;Maximus AVR USB 1.0&lt;/h3&gt;&lt;p&gt;The Maximus AVR 1.0 (bottom left) is based on the ATMEL AT90USB162 microcontroller with 16K flash, 512 bytes EEPROM and 512 bytes SRAM. As with the later version, the layout doesn't allow access to the MCU pins.&lt;/p&gt;&lt;h3&gt;&amp;micro;Rlink ST7Ultralite Primer v1.1&lt;/h3&gt;&lt;p&gt;The ST7Ultralite (bottom right) is a board based on ST's 8-bit ST7FLITEUS microcontroller with 1K flash and 128 bytes EEPROM. The slightly odd looking board features a light sensor and buzzer and is supplied with a development environment for Windows. Unfortunately the IDE refused to install and there's little information online.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-1184526678594110239?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/1184526678594110239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/12/usb-stick-microcontroller-dev-boards.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1184526678594110239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1184526678594110239'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/12/usb-stick-microcontroller-dev-boards.html' title='USB Stick Microcontroller Dev Boards'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-uqmOIA6rHLw/TvzVTFVRNUI/AAAAAAAAB74/CLiIlJWxrqk/s72-c/usb_dev_boards.jpg' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4223737596329230607</id><published>2011-11-06T11:50:00.000-08:00</published><updated>2011-11-06T11:57:10.279-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>A Bibliography of Programming Games</title><content type='html'>&lt;p&gt;The Programming Games Bibliography is an attempt to compile a complete list of articles / papers on the subject.  A Programming Game is played by writing programs to compete against each other, typically by attempting to disable opponents in the memory of a virtual computer or by controlling simulated battle robots.&lt;/p&gt;&lt;p&gt;Please help complete the list by leaving a comment if you remember an article not listed, even if you can only recall vague details. :-)&lt;/p&gt;&lt;h3&gt;Bibliography&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Vyssotsky, Victor A.&lt;/b&gt; &lt;cite&gt;Darwin: A Game of Survival and (Hopefully) Evolution&lt;/cite&gt;.&lt;br&gt;New Jersey: Bell Telephone Laboratories, 1961.&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;abbr title="Aleph-Null"&gt;ℵ&lt;sub&gt;0&lt;/sub&gt;&lt;/abbr&gt;&lt;/b&gt; "Computer Recreations: Darwin."&lt;br&gt;&lt;cite&gt;Software: Practice and Experience&lt;/cite&gt; 2 (Jan-Mar 1972):  93-96.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Edmunds, William&lt;/b&gt; "Robotwar: A Wargame for All Programmers."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Nov-Dec 1981): 13-16,33.&lt;/li&gt;&lt;li&gt;"Computer Gaming World's Robotwar Tournament."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Nov-Dec 1981): 17.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Feigel, Curtis&lt;/b&gt; "Robotwar."&lt;br&gt;&lt;cite&gt;BYTE&lt;/cite&gt; (Dec 1981): 24-34.&lt;/li&gt;&lt;li&gt;"Robotwar: Tournament Results."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Mar-Apr 1983): 30-31.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hoffman, Paul S.&lt;/b&gt; "Robots Maneuver Humans Into Programming."&lt;br&gt;&lt;cite&gt;The Rainbow&lt;/cite&gt; (Apr 1983): 140-142.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Calle, Carlos&lt;/b&gt; "Robot Battle."&lt;br&gt;&lt;cite&gt;HOT CoCo&lt;/cite&gt; (Sep 1983): 53-54.&lt;/li&gt;&lt;li&gt;"We Have a Draw! Robotwar Tournament Results."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Apr 1984): 36.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dewdney, A. K.&lt;/b&gt; "Computer Recreations: In a game called core war hostile programs engage in a battle of bits."&lt;br&gt;&lt;cite&gt;Scientific American&lt;/cite&gt; (May 1984): 14–22.&lt;/li&gt;&lt;li&gt;"4th Annual Robotwar Tournament."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Jan 1985): 9.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dewdney, A. K.&lt;/b&gt; "Computer Recreations: A Core War bestiary of viruses, worms and other threats to computer memories."&lt;br&gt;&lt;cite&gt;Scientific American&lt;/cite&gt; (Mar 1985): 14-23.&lt;/li&gt;&lt;li&gt;"Nobody Wins 4th Annual CGW Robotwar Tournament."&lt;br&gt;&lt;cite&gt;Computer Gaming World&lt;/cite&gt; (Jun-Jul 1985): 9.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Mart&amp;iacute;nez Lara, Sergio&lt;/b&gt; "Batcode, una aut&amp;eacute;ntica batalla dentro de tu ordenador."&lt;br&gt;&lt;cite&gt;MICROHOBBY&lt;/cite&gt; 70 (18-24 Mar 1986): 22-23.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Mart&amp;iacute;nez Lara, Sergio&lt;/b&gt; "Batcode, una aut&amp;eacute;ntica batalla dentro de tu ordenador (II)."&lt;br&gt;&lt;cite&gt;MICROHOBBY&lt;/cite&gt; 71 (25 Mar - 1 Apr 1986): 28-30.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Mart&amp;iacute;nez Lara, Sergio&lt;/b&gt; "Batcode (III)."&lt;br&gt;&lt;cite&gt;MICROHOBBY&lt;/cite&gt; 73 (8-14 Apr 1986): 28-29.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Mart&amp;iacute;nez Lara, Sergio&lt;/b&gt; "Batcode, una batalla dentro de tu ordenador (y IV)."&lt;br&gt;&lt;cite&gt;MICROHOBBY&lt;/cite&gt; 74 (15-21 Apr 1986): 28-29.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Eliraz, Ziv&lt;/b&gt; "Core Wars."&lt;br&gt;&lt;cite&gt;Dragon User&lt;/cite&gt; (Sep 1986): 16-21.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dewdney, A. K.&lt;/b&gt; "Computer Recreations: A program called MICE nibbles its way to victory at the first Core War tournament."&lt;br&gt;&lt;cite&gt;Scientific American&lt;/cite&gt; (Jan 1987): 14-20.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Edgar, Gerald A.&lt;/b&gt; "Darwin: A survival game for programmers."&lt;br&gt;&lt;cite&gt;Computer Language&lt;/cite&gt; (Apr 1987): 79-86.&lt;/li&gt;&lt;li&gt;&lt;b&gt;de Weger, Mark&lt;/b&gt; "Battle of the RAM."&lt;br&gt;&lt;cite&gt;The Micro User&lt;/cite&gt; (Jan 1988): 42-43.&lt;/li&gt;&lt;li&gt;&lt;b&gt;de Weger, Mark&lt;/b&gt; "The program strikes back."&lt;br&gt;&lt;cite&gt;The Micro User&lt;/cite&gt; (Feb 1988): 52-54.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dewdney, A. K.&lt;/b&gt; "Computer Recreations: Of worms, viruses and Core War."&lt;br&gt;&lt;cite&gt;Scientific American&lt;/cite&gt; (Mar 1989): 110-113.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4223737596329230607?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4223737596329230607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/11/bibliography-of-programming-games.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4223737596329230607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4223737596329230607'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/11/bibliography-of-programming-games.html' title='A Bibliography of Programming Games'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-905450781207703409</id><published>2011-07-08T01:38:00.000-07:00</published><updated>2011-07-07T17:57:52.413-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='darwin'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Darwin: Celebrating 50 Years of Programming Games</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot from Darwin-80" border="0" src="http://3.bp.blogspot.com/-l51z9f7Ry74/ThW2lbo8AoI/AAAAAAAAB30/YxwWm9GkWxk/s1600/darwin.jpg" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;strong&gt;Darwin&lt;/strong&gt;&amp;nbsp;was the earliest programming game, invented by Victor Vyssotsky in August 1961. The idea of the game was to write a program to out-replicate and disable all opponents.&lt;br /&gt;&lt;br /&gt;Each program had a number of protected locations and interacted via three functions:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;PROBE&lt;/code&gt; - return the start, end and owner of a memory block&lt;/li&gt;&lt;li&gt;&lt;code&gt;CLAIM&lt;/code&gt; - reserve memory&lt;/li&gt;&lt;li&gt;&lt;code&gt;KILL&lt;/code&gt; - disable a program&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If a protected location was &lt;code&gt;PROBE&lt;/code&gt;d the current program lost control. A &lt;code&gt;CLAIM&lt;/code&gt; or &lt;code&gt;KILL&lt;/code&gt; could only be used on a location which had previously been &lt;code&gt;PROBE&lt;/code&gt;d.&lt;br /&gt;&lt;br /&gt;Douglas McIlroy coded Darwin on Bell Labs' IBM 7090 and the game slowly progressed until an unbeatable program emerged, designed by Robert Morris.&lt;br /&gt;&lt;br /&gt;Robert's program used an adaptive search. If the program &lt;code&gt;PROBE&lt;/code&gt;d an opponent and lost control it would avoid reusing the same offset. A successful offset would be stored then used for future &lt;code&gt;PROBE&lt;/code&gt;s and to initialise new copies of itself. Robert's program adapted to become a specialist killer.&lt;br /&gt;&lt;br /&gt;In 1972 &lt;abbr title="Aleph-Null"&gt;ℵ&lt;sub&gt;0&lt;/sub&gt;&lt;/abbr&gt; (Aleph-Null) published the rules of Darwin in &lt;cite&gt;Software Practice and Experience&lt;/cite&gt;, inspiring a number of new implementations. In 1987 Gerald Edgar published his 8080 version to accompany an article in &lt;cite&gt;Computer Language&lt;/cite&gt;.&lt;br /&gt;&lt;br /&gt;Unfortunately Darwin faced a major problem. Programs were written in machine language and could only compete against others written for the same computer. When A. K. Dewdney introduced Core War in 1984 he addressed the limitation by defining the &lt;acronym title="Memory Array Redcode Simulator"&gt;MARS&lt;/acronym&gt; virtual computer and Redcode, a simplified assembly language.&lt;br /&gt;&lt;br /&gt;Although Darwin has been consigned to the history book, I'll never grow tired of reading about it! Do you remember playing Darwin? If so, I'd love to hear the details.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;References&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;abbr title="Aleph-Null"&gt;ℵ&lt;sub&gt;0&lt;/sub&gt;&lt;/abbr&gt;&lt;/b&gt; "Computer Recreations: Darwin"&lt;br /&gt;&lt;cite&gt;Software: Practice and Experience&lt;/cite&gt; 2 (Jan-Mar 1972): 93-96.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dewdney, A. K.&lt;/b&gt; "In a game called core war hostile programs engage in a battle of bits" &lt;cite&gt;Scientific American&lt;/cite&gt; 250 (May 1984): 14–22.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Edgar, Gerald A.&lt;/b&gt; "Darwin: A survival game for programmers."&lt;br /&gt;&lt;cite&gt;Computer Language&lt;/cite&gt; (Apr 1987): 79-86.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Levy, Steven&lt;/b&gt; &lt;cite&gt;Artificial Life: The Quest for a New Creation&lt;/cite&gt;.&lt;br /&gt;New York: Pantheon Books, 1992. 317-319.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Vyssotsky, Victor A.&lt;/b&gt; &lt;cite&gt;Darwin: A Game of Survival and (Hopefully) Evolution&lt;/cite&gt;.&lt;br /&gt;New Jersey: Bell Telephone Laboratories, 1961.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;See Also&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cs.dartmouth.edu/~doug/darwin.pdf"&gt;Darwin, a Game of Survival of the Fittest among Programs&lt;/a&gt; (PDF)&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/darwin"&gt;Darwin on corewar.co.uk&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://programminggames.org"&gt;The Programming Games Wiki&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.retroprogramming.com/2009/09/history-of-programming-games-1961-1989.html"&gt;A Brief History of Programming Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.retroprogramming.com/2010/10/core-war-king-of-programming-games.html"&gt;Core War - The King of Programming Games&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-905450781207703409?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/905450781207703409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/07/darwin-celebrating-50-years-of.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/905450781207703409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/905450781207703409'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/07/darwin-celebrating-50-years-of.html' title='Darwin: Celebrating 50 Years of Programming Games'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-l51z9f7Ry74/ThW2lbo8AoI/AAAAAAAAB30/YxwWm9GkWxk/s72-c/darwin.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4835397305347739608</id><published>2011-04-22T04:04:00.000-07:00</published><updated>2011-04-22T04:29:11.629-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='easter'/><category scheme='http://www.blogger.com/atom/ns#' term='8086'/><title type='text'>Computus: Calculating Easter Sunday</title><content type='html'>&lt;strong&gt;Computus&lt;/strong&gt; is the algorithm used to calculate the date of Easter. Easter Sunday falls on the first Sunday after the full moon following the Spring equinox. For the purpose of the calculation the full moon is defined as day 14 of the lunar month and the Spring equinox as 20th March.&lt;br /&gt;&lt;br /&gt;Unfortunately Computus defies any attempt to render it with beautiful code! This C function roughly follows the assembly language so is a little uglier than strictly necessary:  &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;easter(year, month, date)&lt;br /&gt;int year, *month, *date;&lt;br /&gt;{&lt;br /&gt;    int gold,cent,sa,la,epact,a18,da;&lt;br /&gt;    gold = year%19;&lt;br /&gt;    cent = year/100;&lt;br /&gt;    sa = cent-cent/4;&lt;br /&gt;    la = (8*cent+13)/25;&lt;br /&gt;    epact = (19*gold-sa-la+15)%30;&lt;br /&gt;    a18 = (gold+11*epact)/319;&lt;br /&gt;    da = ((cent%4+year%100/4)*2+a18+32-year%4-epact)%7;&lt;br /&gt;    *month = (90+epact+da-a18)/25;&lt;br /&gt;    *date = (*month+19+epact+da-a18)%32;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The algorithm is similar to MaybeGauss1 found in J R Stockton's &lt;a href="http://www.merlyn.demon.co.uk/estralgs.txt"&gt;collection of algorithms for Easter Sunday&lt;/a&gt; and is valid for the Gregorian calendar well into the fourth millenium. The algorithm can be adapted to calculate a number of other dates:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Shrove Tuesday - 47 days before Easter Sunday&lt;/li&gt;&lt;li&gt;First Sunday in Lent - 42 days before&lt;/li&gt;&lt;li&gt;Palm Sunday - 7 days before&lt;/li&gt;&lt;li&gt;Whit Sunday - 49 days after&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Finally here's the same algorithm in 8086 assembly language, length 128 bytes. On entry, AX is the year. On exit AL is the day, AH is the month:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;easter:&lt;br /&gt;  push cx&lt;br /&gt;  push dx&lt;br /&gt;  push bx&lt;br /&gt;  push bp&lt;br /&gt;  push si&lt;br /&gt;  push di&lt;br /&gt;&lt;br /&gt;  mov bp,ax     ; bp = year (1583:3999) &lt;br /&gt;&lt;br /&gt;  mov cx,100&lt;br /&gt;  cwd&lt;br /&gt;  div cx&lt;br /&gt;  push dx&lt;br /&gt;  xchg si,ax    ; si = century - 1&lt;br /&gt;&lt;br /&gt;  mov ax,bp&lt;br /&gt;  mov cl,19&lt;br /&gt;  cwd           &lt;br /&gt;  div cx&lt;br /&gt;  mov bx,dx     ; bx = golden number - 1&lt;br /&gt;  xchg ax,dx&lt;br /&gt;&lt;br /&gt;  mul cl&lt;br /&gt;  add ax,15&lt;br /&gt;                ; ax in range (15:357)&lt;br /&gt;  mov dx,si&lt;br /&gt;  add ax,si&lt;br /&gt;  shr dx,1&lt;br /&gt;  shr dx,1&lt;br /&gt;  sub ax,dx&lt;br /&gt;  push ax&lt;br /&gt;  mov ax,8&lt;br /&gt;  mul si&lt;br /&gt;  add ax,13&lt;br /&gt;  mov cl,25&lt;br /&gt;  div cx                      &lt;br /&gt;  xchg dx,ax&lt;br /&gt;  pop ax&lt;br /&gt;  sub ax,dx&lt;br /&gt;  mov cl,30&lt;br /&gt;  cwd&lt;br /&gt;  div cx&lt;br /&gt;  mov di,dx&lt;br /&gt;&lt;br /&gt;  mov al,11&lt;br /&gt;  mul dx&lt;br /&gt;  add ax,bx&lt;br /&gt;  mov cl,206    ; multiply by 206 and discard the&lt;br /&gt;  mul cx        ; lower 16 bits of the result.&lt;br /&gt;                ; shorter than dividing by 319&lt;br /&gt;&lt;br /&gt;  sub di,dx&lt;br /&gt;  xchg ax,si&lt;br /&gt;  and al,3 &lt;br /&gt;  pop dx&lt;br /&gt;  shr dx,1&lt;br /&gt;  shr dx,1&lt;br /&gt;  add ax,dx&lt;br /&gt;  shl ax,1&lt;br /&gt;  and bp,3&lt;br /&gt;  lea bp,[bp+di-32]&lt;br /&gt;  sub ax,bp&lt;br /&gt;  mov cl,7&lt;br /&gt;  cwd&lt;br /&gt;  div cx&lt;br /&gt;  xchg ax,dx&lt;br /&gt;  add ax,di&lt;br /&gt;  mov bp,ax&lt;br /&gt;  add al,90&lt;br /&gt;  mov cl,25&lt;br /&gt;  div cl&lt;br /&gt;  mov ah,al&lt;br /&gt;  add al,19&lt;br /&gt;  add ax,bp&lt;br /&gt;  and al,31&lt;br /&gt;&lt;br /&gt;  pop di&lt;br /&gt;  pop si&lt;br /&gt;  pop bp&lt;br /&gt;  pop bx&lt;br /&gt;  pop dx&lt;br /&gt;  pop cx&lt;br /&gt;  ret&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4835397305347739608?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4835397305347739608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/04/computus-calculating-easter-sunday.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4835397305347739608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4835397305347739608'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/04/computus-calculating-easter-sunday.html' title='Computus: Calculating Easter Sunday'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6104749116795497593</id><published>2011-03-30T13:04:00.000-07:00</published><updated>2011-03-31T05:30:12.485-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><category scheme='http://www.blogger.com/atom/ns#' term='operating system'/><category scheme='http://www.blogger.com/atom/ns#' term='8086'/><title type='text'>Itsy-OS Kernel: Preemptive Switcher &amp; Memory Manager</title><content type='html'>&lt;strong&gt;Itsy-OS v0.1&lt;/strong&gt; is a small 8086 operating system kernel providing two basic services: a simple preemptive task switcher and memory management. If necessary, simple &lt;acronym title="inter process communication"&gt;IPC&lt;/acronym&gt; and task management can be added to provide the features of a traditional microkernel.&lt;br /&gt;&lt;br /&gt;Weighing in at about 380 bytes, Itsy should port well to tiny architectures.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Memory Control Blocks&lt;/h3&gt;&lt;br /&gt;Each block of memory is preceded by a memory control block which is 32 bytes long. The blocks of memory are arranged as a circular linked list.  The first memory control block resides in segment 050h.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 11px; overflow: hidden;"&gt;org 0h&lt;br /&gt;; -----------------------------&lt;br /&gt;; [Master Memory Control Block]&lt;br /&gt;; -----------------------------&lt;br /&gt;&lt;br /&gt;M_NEXT:dw 0             ; address of next MCB&lt;br /&gt;M_LAST:dw 0             ; address of previous MCB&lt;br /&gt;M_PARA:dw 0             ; size of this block in paragraphs including MCB&lt;br /&gt;M_FLAG:db 0             ; flags&lt;br /&gt;       db 0             ;&lt;br /&gt;M_NPRO:dw 0             ; next MCB containing process, zero if not in queue&lt;br /&gt;M_LPRO:dw 0             ; previous MCB containing process, or zero&lt;br /&gt;M_STKP:dw 0             ; stack pointer&lt;br /&gt;M_STKS:dw 0             ; stack segment&lt;br /&gt;&lt;br /&gt;M_TIME:dw 0             ; time allocated / de-allocated&lt;br /&gt;M_DATE:dw 0             ; date allocated / de-allocated&lt;br /&gt;M_OWNR:dw 0             ; user number who owns this memory&lt;br /&gt;M_NAME:db '          '  ; name of this memory block&lt;br /&gt;&lt;br /&gt;; ---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;; flag bits&lt;br /&gt;F_FREE equ 01h          ; zero if this is free memory&lt;br /&gt;F_ACTI equ 02h          ; zero if no task ready for CPU&lt;br /&gt;&lt;br /&gt;; ---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;  jmp E_INIT            ; setup kernel&lt;br /&gt;&lt;br /&gt;; ---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;; -------------------&lt;br /&gt;; [Nucleus Data Area]&lt;br /&gt;; -------------------&lt;br /&gt;&lt;br /&gt;D_PCP:dw 0              ; segment of current process's MCB&lt;br /&gt;D_SWEN:db 0             ; set to zero when switching disabled&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Task Switcher&lt;/h3&gt;&lt;br /&gt;The task switcher is called by the timer interrupt. First it checks whether switching is disabled. If not:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;disable switching&lt;/li&gt;&lt;li&gt;save the registers of the current task on the stack&lt;/li&gt;&lt;li&gt;save the stack pointer of the current task in it's &lt;acronym title="memory control block"&gt;MCB&lt;/acronym&gt;&lt;/li&gt;&lt;li&gt;find the next &lt;acronym title="memory control block"&gt;MCB&lt;/acronym&gt; with an available task&lt;/li&gt;&lt;li&gt;restore the new task's stack pointer and registers&lt;/li&gt;&lt;li&gt;enable switching and&amp;nbsp;transfer control to the new task&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre style="font-size: 11px; overflow: hidden;"&gt;; ---------------&lt;br /&gt;; [Task Switcher]&lt;br /&gt;; ---------------&lt;br /&gt;&lt;br /&gt;E_SWITCHER:&lt;br /&gt;; test if the switcher is enabled or disabled (indivisible test and set)&lt;br /&gt;  pushf&lt;br /&gt;  push cx&lt;br /&gt;  xor cx,cx&lt;br /&gt;  cs xchg cl,byte[D_SWEN]&lt;br /&gt;  jcxz N_NOSWITCH&lt;br /&gt;&lt;br /&gt;; save the registers of the current process&lt;br /&gt;  push ax&lt;br /&gt;  push dx&lt;br /&gt;  push bx&lt;br /&gt;  push bp&lt;br /&gt;  push si&lt;br /&gt;  push di&lt;br /&gt;  push es&lt;br /&gt;  push ds&lt;br /&gt;&lt;br /&gt;; save the stack of the current process&lt;br /&gt;  mov di,M_STKP&lt;br /&gt;  cs mov ds,word[di+D_PCP-M_STKP]&lt;br /&gt;  mov word[di],sp     ; M_STKP&lt;br /&gt;  mov word[di+2],ss   ; M_STKS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E_SHORTCUT:&lt;br /&gt;&lt;br /&gt;; select an active task to switch to&lt;br /&gt;N_SELTASK:&lt;br /&gt;  mov ds,word[di-4]        ; M_NPRO&lt;br /&gt;  test byte[di-6],F_ACTI   ; M_FLAG&lt;br /&gt;  jz N_SELTASK             ; is this task active?&lt;br /&gt;  cs mov word[di+D_PCP-M_STKP],ds&lt;br /&gt;&lt;br /&gt;; restore saved state of process being switched to&lt;br /&gt;  mov sp,word[di]          ; M_STKP&lt;br /&gt;  mov ss,word[di+2]        ; M_STKS&lt;br /&gt;  pop ds&lt;br /&gt;  pop es&lt;br /&gt;  pop di&lt;br /&gt;  pop si&lt;br /&gt;  pop bp&lt;br /&gt;  pop bx&lt;br /&gt;  pop dx&lt;br /&gt;  pop ax&lt;br /&gt;  call E_ENABLE&lt;br /&gt;N_NOSWITCH:&lt;br /&gt;  pop cx&lt;br /&gt;  popf&lt;br /&gt;  iret&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Deallocate Memory&lt;/h3&gt;&lt;br /&gt;Called with DS = &lt;acronym title="memory control block"&gt;MCB&lt;/acronym&gt; of memory to free. Deallocated memory is wiped with 0CCh.&lt;br /&gt;&lt;br /&gt;Switching is disabled while the memory structure is being modified. If the memory being deallocated contains a process, it is removed from the process queue. If adjacent memory blocks are marked as free, the blocks are combined.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 11px; overflow: hidden;"&gt;; -------------------&lt;br /&gt;; [deallocate memory]&lt;br /&gt;; -------------------&lt;br /&gt;&lt;br /&gt;E_MEMDEALLOC:&lt;br /&gt;&lt;br /&gt;  cs mov byte[D_SWEN],0       ; disable switching&lt;br /&gt;&lt;br /&gt;  xor di,di                   ; M_NEXT&lt;br /&gt;  mov ax,word[di+M_NPRO]      ; see if there is entry in process queue&lt;br /&gt;  test ax,ax&lt;br /&gt;  jz N_NOPROC                 ; if there isn't, simply free the memory&lt;br /&gt;  mov es,word[di+M_LPRO]      ; and if there is, remove it!&lt;br /&gt;  es mov word[di+M_NPRO],ax&lt;br /&gt;  mov bx,es&lt;br /&gt;  mov es,ax&lt;br /&gt;  es mov word[di+M_LPRO],bx&lt;br /&gt;&lt;br /&gt;  mov ax,ds&lt;br /&gt;  cs cmp ax,word[D_PCP]       ; check if process being killed is the current&lt;br /&gt;  jnz N_NOPROC&lt;br /&gt;  cs mov word[D_PCP],bx       ; if so, set last process as current&lt;br /&gt;&lt;br /&gt;  call N_NOPROC               ; free the memory,&lt;br /&gt;  mov di,M_STKP&lt;br /&gt;  jmp short E_SHORTCUT        ; and then afterwards, switch to another task&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;N_NOPROC:&lt;br /&gt;  mov bp,ds                   ; bp = first paragraph to clear&lt;br /&gt;  mov bx,word[di+M_PARA]      ; bx = number of paragraphs to clear&lt;br /&gt;&lt;br /&gt;  mov es,word[di]&lt;br /&gt;  es test byte[di+M_FLAG],F_FREE        ; is next block free?&lt;br /&gt;  jnz N_NNOTJOIN                        ; if not, can't join them&lt;br /&gt;&lt;br /&gt;  es mov ax,word[di+M_PARA]             ; get size of next block&lt;br /&gt;  add word[di+M_PARA],ax                ; add to size of this block&lt;br /&gt;  es mov ax,word[di]                    ; move M_NEXT of next...&lt;br /&gt;  mov word[di],ax                       ;  ...to M_NEXT of current&lt;br /&gt;  inc bx                                ; an extra 2 paragraphs to clear&lt;br /&gt;  inc bx&lt;br /&gt;N_NNOTJOIN:&lt;br /&gt;  and byte[di+M_FLAG],0FFh-F_FREE-F_ACTI       ; mark as free&lt;br /&gt;&lt;br /&gt;  mov es,word[di+M_LAST]&lt;br /&gt;  es test byte[di+M_FLAG],F_FREE        ; is previous block free?&lt;br /&gt;  jnz N_PNOTJOIN                        ; if not, can't join them&lt;br /&gt;&lt;br /&gt;  mov ax,word[di+M_PARA]                ; get size of this block&lt;br /&gt;  es add word[di+M_PARA],ax             ; add to size of previous block&lt;br /&gt;  mov ax,word[di]                       ; move M_NEXT of current...&lt;br /&gt;  es mov word[di],ax                    ;  ... to M_NEXT of previous&lt;br /&gt;  jmp short N_EXTRA2P&lt;br /&gt;                                        ; block already marked as free&lt;br /&gt;N_PNOTJOIN:&lt;br /&gt;  inc bp              ; don't clear MCB&lt;br /&gt;  inc bp&lt;br /&gt;  dec bx&lt;br /&gt;  dec bx&lt;br /&gt;&lt;br /&gt;N_EXTRA2P:&lt;br /&gt;  cld                 ; clear memory - bp=location, bx=paragraphs&lt;br /&gt;  mov ax,0CCCCh       ; code for an INT3 instruction to fill memory with&lt;br /&gt;  mov dx,01000h&lt;br /&gt;N_CLRGO:&lt;br /&gt;  mov es,bp&lt;br /&gt;  sub bx,dx&lt;br /&gt;  jc N_CLRFIN&lt;br /&gt;  mov cx,08000h&lt;br /&gt;  rep stosw&lt;br /&gt;  add bp,dx&lt;br /&gt;  jmp short N_CLRGO&lt;br /&gt;&lt;br /&gt;N_CLRFIN:&lt;br /&gt;  add bx,dx&lt;br /&gt;  mov cl,3&lt;br /&gt;  shl bx,cl&lt;br /&gt;  mov cx,bx&lt;br /&gt;  rep stosw&lt;br /&gt;&lt;br /&gt;E_ENABLE:&lt;br /&gt;  cs inc byte[D_SWEN] ; enable switching&lt;br /&gt;  ret&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Allocate Memory&lt;/h3&gt;&lt;br /&gt;Called with AX = number of paragraphs required. Returns DS = location of memory, or DS = 0 if no memory available. Switching is disabled while the memory structure is being modified. Allocation uses a simple best fit algorithm.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 11px; overflow: hidden;"&gt;; -----------------&lt;br /&gt;; [allocate memory]&lt;br /&gt;; -----------------&lt;br /&gt;&lt;br /&gt;E_MEMALLOC:&lt;br /&gt;&lt;br /&gt;  cs mov byte[D_SWEN],0       ; disable switching&lt;br /&gt;&lt;br /&gt;  xor di,di&lt;br /&gt;  xor dx,dx                    ; segment of current choice&lt;br /&gt;  xor cx,cx                    ; left-over memory from current choice&lt;br /&gt;  inc ax&lt;br /&gt;  inc ax&lt;br /&gt;  mov bx,050                   ; MMCB&lt;br /&gt;&lt;br /&gt;N_MOREMEM:&lt;br /&gt;  mov ds,bx&lt;br /&gt;  test byte[di+M_FLAG],F_FREE  ; is the block we are looking at empty?&lt;br /&gt;  jnz N_WONTFIT                ; if it isn't, move on&lt;br /&gt;&lt;br /&gt;  mov bx,word[di+M_PARA]&lt;br /&gt;  sub bx,ax                    ; check size&lt;br /&gt;  jc N_WONTFIT&lt;br /&gt;  jz N_EXACT                   ; perfect fit :-)&lt;br /&gt;&lt;br /&gt;; ** KLUDGE ***&lt;br /&gt;  cmp bx,3                     ; if leftover memory block smaller than 3&lt;br /&gt;  jc N_WONTFIT                 ; paragraphs, it would be too small to contain&lt;br /&gt;                               ; a MCB.  Maybe handle this better later&lt;br /&gt;&lt;br /&gt;  cmp cx,bx                    ; bx= size of potential leftover memory block&lt;br /&gt;  jc N_WONTFIT                 ; have we found a better fit?&lt;br /&gt;  mov cx,bx&lt;br /&gt;  mov dx,ds                    ; if so, then select it!&lt;br /&gt;N_WONTFIT:&lt;br /&gt;  mov bx,word[di]              ; M_NEXT&lt;br /&gt;  cmp bx,050                   ; are we at MMCB?&lt;br /&gt;  jnz N_MOREMEM&lt;br /&gt;&lt;br /&gt;  test dx,dx&lt;br /&gt;  jne N_ALLOCIT&lt;br /&gt;  mov ds,dx                   ; out of memory :-(&lt;br /&gt;  jmp short N_ALEXIT&lt;br /&gt;N_ALLOCIT:&lt;br /&gt;  mov ds,dx&lt;br /&gt;  mov es,word[di]              ; M_NEXT, es= next block&lt;br /&gt;&lt;br /&gt;  mov bx,word[di+M_PARA]       ; bx= number of paragraphs for this block&lt;br /&gt;  add bx,dx                    ; bx= end of this block&lt;br /&gt;  sub bx,ax                    ; bx= location of new block's MCB        &lt;br /&gt;&lt;br /&gt;  es mov word[di+M_LAST],bx    ; point next block to new block&lt;br /&gt;  mov word[di],bx              ; M_NEXT, point this block to new block&lt;br /&gt;  sub word[di+M_PARA],ax       ; resize this block&lt;br /&gt;  push ds&lt;br /&gt;  mov ds,bx                    ; point es to new block&lt;br /&gt;  pop bx&lt;br /&gt;&lt;br /&gt;  mov word[di+M_LAST],bx       ; initialise new block's M_LAST&lt;br /&gt;  mov word[di+M_PARA],ax       ; initialise new block's M_PARA&lt;br /&gt;  mov word[di],es              ; initialise new block's M_NEXT&lt;br /&gt;&lt;br /&gt;N_EXACT:&lt;br /&gt;  mov byte[di+M_FLAG],F_FREE   ; mark new block as no longer free&lt;br /&gt;  mov word[di+M_NPRO],di&lt;br /&gt;  mov word[di+M_LPRO],di&lt;br /&gt;N_ALEXIT:&lt;br /&gt;  jmp short E_ENABLE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Setup&lt;/h3&gt;&lt;br /&gt;Simply sets up the timer interrupt.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 11px; overflow: hidden;"&gt;E_INT1C:&lt;br /&gt;  call E_SWITCHER&lt;br /&gt;  db 0EAh&lt;br /&gt;D_OLDINT1C:&lt;br /&gt;  dw 0,0&lt;br /&gt;&lt;br /&gt;; ---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;E_INIT:&lt;br /&gt;  push cs&lt;br /&gt;  pop es&lt;br /&gt;  xor ax,ax&lt;br /&gt;  mov ds,ax&lt;br /&gt;  mov si,01Ch*4&lt;br /&gt;  mov di,D_OLDINT1C&lt;br /&gt;  cld&lt;br /&gt;  push si&lt;br /&gt;  movsw&lt;br /&gt;  movsw&lt;br /&gt;  pop di&lt;br /&gt;  cli&lt;br /&gt;  push ds&lt;br /&gt;  pop es&lt;br /&gt;  mov ax,050h&lt;br /&gt;  stosw&lt;br /&gt;  mov ax,E_INT1C&lt;br /&gt;  stosw&lt;br /&gt;  sti&lt;br /&gt;; ...&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6104749116795497593?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6104749116795497593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/03/itsy-os-simple-preemptive-switcher.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6104749116795497593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6104749116795497593'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/03/itsy-os-simple-preemptive-switcher.html' title='Itsy-OS Kernel: Preemptive Switcher &amp; Memory Manager'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4110240296939699898</id><published>2011-03-17T03:37:00.000-07:00</published><updated>2011-03-17T03:37:40.439-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='editor'/><title type='text'>Alternatives to Windows Notepad for Programmers</title><content type='html'>When I upgraded to Windows 7 I was horrified to discover the text editor I've been using for years no longer works. After suffering Windows Notepad for a few days I set out on a quest to discover the perfect replacement.&lt;br /&gt;&lt;br /&gt;My search criteria is pretty basic:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;can be installed on a memory stick&lt;/li&gt;&lt;li&gt;works with UNIX / DOS end-of-line&lt;/li&gt;&lt;li&gt;supports syntax highlighting&lt;/li&gt;&lt;li&gt;the ability to edit multiple files&lt;/li&gt;&lt;li&gt;supports regular expression search&lt;/li&gt;&lt;li&gt;requires less than 10MB disk space&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;After testing a number of free programmer's editors I discovered several which meet (or almost meet) the requirements:&lt;br /&gt;&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh4.googleusercontent.com/-CUGINz1BqY4/TX6mGYWQIxI/AAAAAAAABz0/6UjNvsKq8zI/s1600/context.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of ConTEXT programmer's text editor" border="0" height="140" src="https://lh4.googleusercontent.com/-CUGINz1BqY4/TX6mGYWQIxI/AAAAAAAABz0/6UjNvsKq8zI/s200/context.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.contexteditor.org/"&gt;ConTEXT&lt;/a&gt; is a free programmer's text editor. It boasts a number of useful features include the ability to export code to &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt;.&lt;br /&gt;&lt;br /&gt;&lt;small style="color: grey;"&gt;(The thumbnail links to a 800×560px screenshot.)&lt;/small&gt;&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh4.googleusercontent.com/-gPF55wa5s54/TX6mECV5CNI/AAAAAAAABzk/kHCcNEwktKk/s1600/crimson.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of Crimson programmer's text editor" border="0" height="140" src="https://lh4.googleusercontent.com/-gPF55wa5s54/TX6mECV5CNI/AAAAAAAABzk/kHCcNEwktKk/s200/crimson.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.crimsoneditor.com/"&gt;Crimson&lt;/a&gt; is a source code editor to replace Windows Notepad. Unfortunately the default colour scheme for syntax highlighting doesn't really distinguish between text, delimiters and constants.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh4.googleusercontent.com/-a8oKNAzawnM/TX6mFRLsiTI/AAAAAAAABzs/m5BwqPVqPVc/s1600/gedit.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of gedit programmer's text editor" border="0" height="140" src="https://lh4.googleusercontent.com/-a8oKNAzawnM/TX6mFRLsiTI/AAAAAAAABzs/m5BwqPVqPVc/s200/gedit.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://projects.gnome.org/gedit/"&gt;gedit&lt;/a&gt; is the text editor from the GNOME desktop enviroment and is also available for Windows. Unfortunately the standard package lacks regex search and it's a heavyweight, weighing in at 65MB+.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh3.googleusercontent.com/-tcCLZywdLdU/TX6mEoxOKhI/AAAAAAAABzo/0OghCmogdSo/s1600/jedit.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of jEdit programmer's text editor" border="0" height="140" src="https://lh3.googleusercontent.com/-tcCLZywdLdU/TX6mEoxOKhI/AAAAAAAABzo/0OghCmogdSo/s200/jedit.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.jedit.org/"&gt;jEdit&lt;/a&gt; is a Java programmer's text editor and has an active community of developers. Hundreds of plugins are available to add a wide range of features. jEdit is another heavyweight, consuming 25MB+ of diskspace.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh4.googleusercontent.com/--GWwlTUxUmQ/TX6mCWR4CYI/AAAAAAAABzY/8-qGItRIDVc/s1600/npp.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of Notepad++ programmer's text editor" border="0" height="139" src="https://lh4.googleusercontent.com/--GWwlTUxUmQ/TX6mCWR4CYI/AAAAAAAABzY/8-qGItRIDVc/s200/npp.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://notepad-plus.sourceforge.net/uk/site.htm"&gt;Notepad++&lt;/a&gt; is a replacement for Windows Notepad. Features include code folding and support for numerous plugins developed by Notepad++'s active community.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh4.googleusercontent.com/-YimeEY466iY/TX6mDiWrWmI/AAAAAAAABzg/KBEQwk_GnXo/s1600/notepad2.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of Notepad2 programmer's text editor" border="0" height="140" src="https://lh4.googleusercontent.com/-YimeEY466iY/TX6mDiWrWmI/AAAAAAAABzg/KBEQwk_GnXo/s200/notepad2.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.flos-freeware.ch/notepad2.html"&gt;Notepad2&lt;/a&gt; is a replacement for Windows Notepad that only installs two files. It features a semi-transparent mode allowing users to keep an eye on other programs while editing full screen. Unfortunately Notepad2 can only edit one file at once.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh3.googleusercontent.com/-dZvuNtCGC_4/TX6mF79xRMI/AAAAAAAABzw/jk4rL-mDZBg/s1600/pnp.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of Programmer's Notepad text editor" border="0" height="140" src="https://lh3.googleusercontent.com/-dZvuNtCGC_4/TX6mF79xRMI/AAAAAAAABzw/jk4rL-mDZBg/s200/pnp.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.pnotepad.org/"&gt;Programmer's Notepad&lt;/a&gt; is a programmer's editor with features including code folding, exporting code to &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; and Python scripting. Programmer's Notepad has an active user community.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh6.googleusercontent.com/-37kT-5aydKY/TX6mG8WQiXI/AAAAAAAABz4/9unUeXfKUOA/s1600/pspad.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of PSPad programmer's text editor" border="0" height="140" src="https://lh6.googleusercontent.com/-37kT-5aydKY/TX6mG8WQiXI/AAAAAAAABz4/9unUeXfKUOA/s200/pspad.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.pspad.com/en/"&gt;PSPad&lt;/a&gt; is a free programmer's editor. The font selector only shows fixed width fonts which is handy, but I'd like to have the option to use a proportional font. PSPad has a feature to export code to &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt;. Requires just over 14MB of disk space.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;a href="https://lh3.googleusercontent.com/-vVfXLxZ_MdI/TX6mDNdIWRI/AAAAAAAABzc/64SQRekfeRo/s1600/scite.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="screenshot of SciTE programmer's text editor" border="0" height="140" src="https://lh3.googleusercontent.com/-vVfXLxZ_MdI/TX6mDNdIWRI/AAAAAAAABzc/64SQRekfeRo/s200/scite.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.scintilla.org/SciTE.html"&gt;SciTE&lt;/a&gt; is the demo for the free Scintilla code editing component (used by several editors listed here) and is available as a single file installation. Supports code folding and exporting code to &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt;. Unfortunately changing the settings requires the user to poke around in SciTE's config files.&lt;br /&gt;&lt;hr style="clear: left;" /&gt;&lt;br /&gt;In the end I've settled for Programmer's Notepad. Which editor are you using and what features do you consider essential? :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4110240296939699898?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4110240296939699898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/03/alternatives-to-windows-notepad-for.html#comment-form' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4110240296939699898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4110240296939699898'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/03/alternatives-to-windows-notepad-for.html' title='Alternatives to Windows Notepad for Programmers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-CUGINz1BqY4/TX6mGYWQIxI/AAAAAAAABz0/6UjNvsKq8zI/s72-c/context.jpg' height='72' width='72'/><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7450511192055118983</id><published>2011-03-13T12:10:00.000-07:00</published><updated>2011-03-13T12:15:39.814-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><title type='text'>Efficiency in Forth</title><content type='html'>I'm busy implementing my own Forth at the moment and it's taking a little longer than anticipated. Each Forth word is a puzzle in itself:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What's the least number of words needed to write it?&lt;/li&gt;&lt;li&gt;What's the most efficient implementation?&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;For example, take a look at &lt;a href="http://www.retroprogramming.com/2009/06/implement-min-in-forth-without.html"&gt;Implementing &lt;code&gt;MIN&lt;/code&gt; in Forth without Conditional Code&lt;/a&gt;. The smallest version of &lt;code&gt;MIN&lt;/code&gt; is 2 words shorter than eForth's &lt;code&gt;MIN&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Even words with a trivial implementation can pose an interesting problem. For example which of the following is most efficient:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Jones Forth TUCK&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;: TUCK DUP -ROT ;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Alternative TUCK&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;: TUCK SWAP OVER ;&lt;/pre&gt;&lt;br /&gt;If &lt;code&gt;DUP&lt;/code&gt;, &lt;code&gt;-ROT&lt;/code&gt;, &lt;code&gt;SWAP&lt;/code&gt; and &lt;code&gt;OVER&lt;/code&gt; are all primitive, the alternative implementation will execute two fewer instructions on an 80x86 Forth. However, &lt;code&gt;-ROT&lt;/code&gt; is often implemented in Forth which would cause the Jones Forth &lt;code&gt;TUCK&lt;/code&gt; to be substantially slower. Here's a typical implementation of &lt;code&gt;-ROT&lt;/code&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;: -ROT SWAP &amp;gt;R SWAP R&amp;gt; ;&lt;/pre&gt;&lt;br /&gt;If you can think of an alternative two word implementation of &lt;code&gt;TUCK&lt;/code&gt; or four word implementation of &lt;code&gt;-ROT&lt;/code&gt;, please let me know. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7450511192055118983?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7450511192055118983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/03/efficiency-in-forth.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7450511192055118983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7450511192055118983'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/03/efficiency-in-forth.html' title='Efficiency in Forth'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-9036419227711343732</id><published>2011-02-12T03:25:00.000-08:00</published><updated>2011-02-12T06:52:14.004-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><title type='text'>The Tao of Programming</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 10px;"&gt;&lt;img alt="The Tao of Programming by Geoffrey James" border="0" src="http://4.bp.blogspot.com/-ZkUUmqob_iQ/TVW1RzpG6MI/AAAAAAAABzA/VvjSIsdi4KU/s1600/tao_of_programming.jpg" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;strong&gt;The Tao of Programming&lt;/strong&gt; by Geoffrey James is a short book of humourous computer parables inspired by an ancient Chinese text, the &lt;cite&gt;Tao Te Ching&lt;/cite&gt;.&lt;br /&gt;&lt;br /&gt;The &lt;cite&gt;Tao Te Ching&lt;/cite&gt; is believed to have been written 2500 years ago by Lao Tzu and provides the basis for Taoist philosophy. The book is separated into 81 (3&lt;sup&gt;4&lt;/sup&gt;) short chapters of parables and proverbs.&lt;br /&gt;&lt;br /&gt;James divides &lt;cite&gt;The Tao of Programming&lt;/cite&gt; into 32 (2&lt;sup&gt;5&lt;/sup&gt;) chapters, a mix of tales paraphrased from the &lt;cite&gt;Tao Te Ching&lt;/cite&gt; and anecdotes advocating the key principles of the hacker ethic:&lt;br /&gt;&lt;br /&gt;&lt;ul style="margin-left: 165px"&gt;&lt;li&gt;code should be small, elegant and easy to read&lt;/li&gt;&lt;li&gt;management shouldn't interfere with programming&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The preface (not included in the online copy) describes how James, an amateur computer archaeologist, stumbled upon and decoded &lt;cite&gt;The Tao of Programming&lt;/cite&gt; while searching through a stack of obsolete punch cards.&lt;br /&gt;&lt;br /&gt;My favourite chapter has to be the description of well-written programs closely followed by Turing's dream:&lt;br /&gt;&lt;br /&gt;&lt;div style="border: solid 1px #eee; margin-left: 30px; margin-right: 30px;"&gt;&lt;blockquote&gt;“A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity.”&lt;/blockquote&gt;&lt;div style="margin-right: 50px; text-align: right;"&gt;&lt;cite&gt;-- The Tao of Programming, Chapter 4.1&lt;/cite&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="border: solid 1px #eee; margin-left: 30px; margin-right: 30px;"&gt;&lt;blockquote&gt;“Grand Master Turing once dreamed that he was a machine. When he awoke he exclaimed:&lt;br /&gt;&lt;br /&gt;‘I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!’”&lt;/blockquote&gt;&lt;div style="margin-right: 50px; text-align: right;"&gt;&lt;cite&gt;-- The Tao of Programming, Chapter 2.2&lt;/cite&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Although the book is short and you probably won't learn anything new, it's definitely worth a read if you have 30 minutes to spare.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.canonical.org/~kragen/tao-of-programming.html"&gt;Online copy of The Tao of Programming&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-9036419227711343732?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/9036419227711343732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/02/tao-of-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9036419227711343732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9036419227711343732'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/02/tao-of-programming.html' title='The Tao of Programming'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-ZkUUmqob_iQ/TVW1RzpG6MI/AAAAAAAABzA/VvjSIsdi4KU/s72-c/tao_of_programming.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2525773844263089524</id><published>2011-02-02T22:40:00.000-08:00</published><updated>2011-02-11T10:13:18.281-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='robot'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Celebrating 30 Years of Color Robot Battle</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUfPNU8sekI/AAAAAAAAByM/3NBhN9B1Cyw/s1600/robot_battle.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="Color Robot Battle" border="0" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUfPNU8sekI/AAAAAAAAByM/3NBhN9B1Cyw/s1600/robot_battle.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;Color Robot Battle&lt;/b&gt; is one of the earliest commercial programming games, published 30 years ago for the TRS-80 Color Computer by The Image Producers.&lt;br /&gt;&lt;br /&gt;The game is played by writing programs to control a robot's movement, sensors and weapons. Programs are written in a hybrid of the BASIC / Logo programming languages. Two robots enter an arena with the survivor being declared the winner.&lt;br /&gt;&lt;br /&gt;I asked the designer and programmer of Color Robot Battle what inspired the game:&lt;br /&gt;&lt;br /&gt;&lt;div style="border: solid 1px #eee; margin-left: 30px; margin-right: 30px;"&gt;&lt;blockquote&gt;“Well, the Apple II program did along with the feeling I could do it better. All of these were initially inspired by Core Wars, I believe. I did want to make the language complete enough to have quite a bit of control and flexibility over the robots.”&lt;/blockquote&gt;&lt;div style="margin-right: 50px; text-align: right;"&gt;&lt;cite&gt;-- Glenn Sogge&lt;/cite&gt;&lt;/div&gt;&lt;br /&gt;&lt;blockquote&gt;“The robot controlling programming language was based on BASIC. Prior to working on &lt;acronym title="Color Robot Battle"&gt;CRB&lt;/acronym&gt;, I'd written a simple BASIC interpreter for the PDP-11, so it was a natural choice.”&lt;/blockquote&gt;&lt;div style="margin-right: 50px; text-align: right;"&gt;&lt;cite&gt;-- Del Ogren&lt;/cite&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Color Robot Battle is a fantastic example of compact code. The game, compiler and full screen editor are all written in 6809 assembly language and somehow manage to fit on a 4K &lt;acronym title="Read Only Memory"&gt;ROM&lt;/acronym&gt;.&lt;br /&gt;&lt;br /&gt;Although the language of &lt;acronym title="Color Robot Battle"&gt;CRB&lt;/acronym&gt; only takes a few minutes to learn, a whole range of strategies are possible. There are four types of command available:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li style="margin-bottom: 20px;"&gt;&lt;b&gt;movement:&lt;/b&gt; followed by a number. Movement commands are &lt;b&gt;F&lt;/b&gt;(orwards), &lt;b&gt;B&lt;/b&gt;(ackwards), &lt;b&gt;L&lt;/b&gt;(eft), &lt;b&gt;R&lt;/b&gt;(ight), &lt;b&gt;H&lt;/b&gt;(alt), &lt;b&gt;T&lt;/b&gt;(urn), &lt;b&gt;D&lt;/b&gt;(irection).&lt;/li&gt;&lt;li style="margin-bottom: 20px;"&gt;&lt;b&gt;conditional:&lt;/b&gt;&amp;nbsp;detect what the robot is facing. &lt;b&gt;=&lt;/b&gt;(true) or &lt;b&gt;#&lt;/b&gt;(false) followed by &lt;b&gt;R&lt;/b&gt;(obot), &lt;b&gt;W&lt;/b&gt;(all), &lt;b&gt;M&lt;/b&gt;(issile), &lt;b&gt;L&lt;/b&gt;(aser), &lt;b&gt;S&lt;/b&gt;(omething - any direction), &lt;b&gt;?&lt;/b&gt;(random).&lt;/li&gt;&lt;li style="margin-bottom: 20px;"&gt;&lt;b&gt;flow control:&lt;/b&gt; &lt;b&gt;C&lt;/b&gt;(all) or &lt;b&gt;G&lt;/b&gt;(oto) a label. Labels are defined at the beginning of a line and terminated by a &lt;b&gt;&amp;gt;&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;&lt;b&gt;attack:&lt;/b&gt; &lt;b&gt;XL&lt;/b&gt; to fire the laser or &lt;b&gt;XM&lt;/b&gt; to fire a missile.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The program starts at the label &lt;b&gt;START&amp;gt;&lt;/b&gt;. Multiple commands on one line are separated by a colon &lt;b&gt;:&lt;/b&gt;. If a condition fails the rest of the line is skipped.&lt;br /&gt;&lt;br /&gt;Here's a simple example that manages to win a few battles:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;*SIMPLE              ; robot name&lt;br /&gt;START&amp;gt;               ; start here&lt;br /&gt;F5                   ; move forward 5&lt;br /&gt;=W:T1                ; if facing a wall, turn 45°                &lt;br /&gt;=?:T1                ; randomly turn 45°&lt;br /&gt;=R:XL                ; if facing a robot, fire laser&lt;br /&gt;GSTART               ; repeat from start&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Thanks to the simplicity of the language, &lt;acronym title="Color Robot Battle"&gt;CRB&lt;/acronym&gt; makes the perfect introduction to programming games. So, does anyone fancy a tournament? ;-)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TUfPUbp4qFI/AAAAAAAAByU/-Es3m-6hUhc/s1600/crb_editor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="Color Robot Battle's editor" border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TUfPUbp4qFI/AAAAAAAAByU/-Es3m-6hUhc/s1600/crb_editor.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://programminggames.org/Color-Robot-Battle.ashx"&gt;Color Robot Battle on the Programming Games Wiki&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/crb"&gt;Color Robot Battle: Adventures in Programming&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.polylith.com/~brendan/ClassicComputers/Tandy/RobotBattle.html"&gt;Tandy/TRS-80 Color Computer Robot Battle&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2525773844263089524?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2525773844263089524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/02/celebrating-30-years-of-color-robot.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2525773844263089524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2525773844263089524'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/02/celebrating-30-years-of-color-robot.html' title='Celebrating 30 Years of Color Robot Battle'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUfPNU8sekI/AAAAAAAAByM/3NBhN9B1Cyw/s72-c/robot_battle.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-1209866728438646696</id><published>2011-01-30T00:30:00.000-08:00</published><updated>2011-01-29T16:37:33.284-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='text adventure'/><title type='text'>Interactive Fiction: 4K Adventure</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/TUSQz3rsQBI/AAAAAAAAByE/SgF6AYS0qjQ/s1600/4ka.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="Text Adventure: 4K Adventure" border="0" height="250" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/TUSQz3rsQBI/AAAAAAAAByE/SgF6AYS0qjQ/s400/4ka.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I've always been a fan of text adventures - exploring a fantasy world, drawing a map and solving a few puzzles along the way. A couple of my early favourites were &lt;i&gt;The Hobbit&lt;/i&gt; and &lt;i&gt;Heroes of Khan&lt;/i&gt;. When I discovered shareware I spent hours puzzling over &lt;i&gt;Humbug&lt;/i&gt;, &lt;i&gt;Curses&lt;/i&gt; and &lt;i&gt;t-zero&lt;/i&gt;. Even now I'm still working through &lt;i&gt;The Lost Treasures of Infocom&lt;/i&gt; :-)&lt;br /&gt;&lt;br /&gt;So when I needed a project to exercise my new 8086 assembly skills a text adventure seemed the natural choice. I decided to cram as much as possible into a 4K program - verb-noun parser, text decompression and a snowy forest to explore.&lt;br /&gt;&lt;br /&gt;After 35 hours coding I'd created &lt;i&gt;4K Adventure&lt;/i&gt; complete with dwarves, mischievous elves and stolen magic. It managed to work despite the spaghetti code and a couple of dubious algorithms!&lt;br /&gt;&lt;br /&gt;Impressed that I'd actually completed a project I immediately started work on a sequel and a simple operating system... &amp;nbsp;I still haven't completed either. Maybe one day ;-)&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.wurb.com/if/game/321"&gt;4K Adventure&lt;/a&gt; is available to download from &lt;a href="http://ifarchive.org"&gt;The Interactive Fiction Archive&lt;/a&gt; and runs perfectly using DOSBox.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-1209866728438646696?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/1209866728438646696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/01/interactive-fiction-4k-adventure.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1209866728438646696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1209866728438646696'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/01/interactive-fiction-4k-adventure.html' title='Interactive Fiction: 4K Adventure'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/TUSQz3rsQBI/AAAAAAAAByE/SgF6AYS0qjQ/s72-c/4ka.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-8073352664849691589</id><published>2011-01-27T13:17:00.000-08:00</published><updated>2011-01-27T13:58:53.252-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='alife'/><category scheme='http://www.blogger.com/atom/ns#' term='corelife'/><title type='text'>CoreLife: Artificial Life Simulator</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUHG1T1m1ZI/AAAAAAAABxs/Meiw-mW4S4U/s1600/corelife_core_monitor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="CoreLife core monitor" border="0" height="250" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUHG1T1m1ZI/AAAAAAAABxs/Meiw-mW4S4U/s400/corelife_core_monitor.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;A few years ago when using either Lycos or the &lt;acronym title="World Wide Web Worm"&gt;WWWW&lt;/acronym&gt; (remember those?) to search for &lt;a href="http://www.retroprogramming.com/2009/05/corelife-programming-in-2-dimensions.html"&gt;CoreLife&lt;/a&gt; I came across a program with the same name. The program I discovered is an artificial life simulator written by Erik de Neve.&lt;br /&gt;&lt;br /&gt;CoreLife supports two &lt;acronym title="virtual central processing unit"&gt;VCPU&lt;/acronym&gt;s:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The CoreLife &lt;acronym title="virtual central processing unit"&gt;VCPU&lt;/acronym&gt; - supports 32 instructions that resemble 8086 assembly&lt;/li&gt;&lt;li&gt;The Tierra &lt;acronym title="virtual central processing unit"&gt;VCPU&lt;/acronym&gt; - supports the 32 instructions of Thomas Ray's software&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;After seeding memory with a handwritten organism the simulation begins. Each organism attempts to replicate while the simulator randomly mutates instructions or causes them to fail. Thanks to the mutation the copied organism often differs slightly from the parent.&lt;br /&gt;&lt;br /&gt;In some cases the mutation renders the child organism less effective or too damaged to replicate. In other cases the child is smaller and faster, able to out-replicate the less efficient parent.&lt;br /&gt;&lt;br /&gt;Watching the code evolve made me wonder if I could beat evolution. I set myself a challenge: could I create the ultimate organism to out-replicate everything else and resist mutation?&lt;br /&gt;&lt;br /&gt;Unfortunately any attempt to resist mutation quickly died out so I settled for creating the smallest self-contained replicator, just 22 instructions:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;;22 Instruction Replicator&lt;br /&gt;;for the Tierra Virtual CPU&lt;br /&gt;nop_1&lt;br /&gt;adrb&lt;br /&gt;nop_0&lt;br /&gt;push ax&lt;br /&gt;sub_ac&lt;br /&gt;divide&lt;br /&gt;mov_ab&lt;br /&gt;adrf&lt;br /&gt;nop_1&lt;br /&gt;sub_ab&lt;br /&gt;inc cx&lt;br /&gt;mal&lt;br /&gt;nop_1&lt;br /&gt;dec cx&lt;br /&gt;mov_ii&lt;br /&gt;ifz&lt;br /&gt;ret&lt;br /&gt;inc bx&lt;br /&gt;inc ax&lt;br /&gt;jmpb&lt;br /&gt;nop_0&lt;br /&gt;pop dx&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUHG6Xuae1I/AAAAAAAABx0/_XFyTVdJ6zk/s1600/corelife_statistics.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="CoreLife statistics" border="0" height="250" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUHG6Xuae1I/AAAAAAAABx0/_XFyTVdJ6zk/s400/corelife_statistics.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;CoreLife is available on &lt;a href="http://www.usefuldreams.org/corelife.htm"&gt;Erik de Neve's webpage&lt;/a&gt; and runs perfectly using DOSBox.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-8073352664849691589?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/8073352664849691589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/01/corelife-artificial-life-simulator.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8073352664849691589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8073352664849691589'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/01/corelife-artificial-life-simulator.html' title='CoreLife: Artificial Life Simulator'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TUHG1T1m1ZI/AAAAAAAABxs/Meiw-mW4S4U/s72-c/corelife_core_monitor.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7867200278181531153</id><published>2011-01-12T14:37:00.000-08:00</published><updated>2011-05-09T14:24:37.851-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='recursion'/><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><title type='text'>Recursion via Pascal</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TS36VSJJgjI/AAAAAAAABxQ/x8Uc9kutT1s/s1600/recursion_via_pascal.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="Recursion via Pascal by J.S. Rohl" border="0" height="200" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TS36VSJJgjI/AAAAAAAABxQ/x8Uc9kutT1s/s400/recursion_via_pascal.jpg" width="132" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;strong&gt;Recursion via Pascal&lt;/strong&gt; by J. S. Rohl is one of a small number of books devoted entirely to recursion in programming. Recursion is a technique where a problem is defined in terms of a simpler version of itself.&lt;br /&gt;&lt;br /&gt;The book has over 100 examples and although the code is in Pascal it shouldn't pose too much of a problem for C / Java programmers.&lt;br /&gt;&lt;br /&gt;Factorials are the classic example of recursion:&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="border: 1px solid #eee; clear: left; padding: 10px;"&gt;The factorial of a number &lt;i&gt;n&lt;/i&gt; (written as &lt;i&gt;n&lt;/i&gt;&lt;abbr title="factorial"&gt;!&lt;/abbr&gt;) is the product of all positive integers below or equal to &lt;i&gt;n&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left: 48px"&gt;6&lt;abbr title="factorial"&gt;!&lt;/abbr&gt; = 6 × 5 × 4 × 3 × 2 × 1 = 720.&lt;/div&gt;&lt;br /&gt;&lt;i&gt;n&lt;/i&gt;&lt;abbr title="factorial"&gt;!&lt;/abbr&gt; can be defined recursively as:&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left: 48px"&gt;0&lt;abbr title="factorial"&gt;!&lt;/abbr&gt; = 1&lt;br /&gt;&lt;i&gt;n&lt;/i&gt;&lt;abbr title="factorial"&gt;!&lt;/abbr&gt; = &lt;i&gt;n&lt;/i&gt; × (&lt;i&gt;n&lt;/i&gt;-1)&lt;abbr title="factorial"&gt;!&lt;/abbr&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;abbr title="factorial"&gt;&lt;/abbr&gt;Here's the code to calculate factorials in Pascal:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function factorial( n:integer ):integer;&lt;br /&gt;begin&lt;br /&gt;    if n = 0 then&lt;br /&gt;        factorial := 1&lt;br /&gt;    else&lt;br /&gt;        factorial := n * factorial( n-1 )&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or in C:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;unsigned int factorial( unsigned int n )&lt;br /&gt;{&lt;br /&gt;    if ( n == 0 )&lt;br /&gt;        return 1;&lt;br /&gt;    else&lt;br /&gt;        return n * factorial( n-1 );&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or Forth:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;: factorial&lt;br /&gt;    dup 0= if&lt;br /&gt;        drop 1&lt;br /&gt;    else&lt;br /&gt;        dup 1- recurse *&lt;br /&gt;    then&lt;br /&gt;;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Rohl first examines some simple examples of recusion: factorials, highest common factor and displaying numbers before moving on to more advanced topics:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;two-level procedures&lt;/li&gt;&lt;li&gt;recursive data structures&lt;/li&gt;&lt;li&gt;binary recursion&lt;/li&gt;&lt;li&gt;recursive sorting algorithms&lt;/li&gt;&lt;li&gt;mutual recusion&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Throughout the book Rohl compares the runtime / complexity to the equivalent iterative code and warns against any potential pitfalls. My favourite example is the code to calculate &lt;i&gt;x&lt;/i&gt;^&lt;i&gt;n&lt;/i&gt; from “&lt;i&gt;developing the power example, a cautionary tale&lt;/i&gt;”:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function p(x:real; n:integer):real;&lt;br /&gt;begin&lt;br /&gt;  if n = 0 then&lt;br /&gt;    p := 1&lt;br /&gt;  else if odd(n) then&lt;br /&gt;    p := p( x, n div 2 ) * p( x, n div 2 ) * x&lt;br /&gt;  else&lt;br /&gt;    p := p( x, n div 2 ) * p( x, n div 2 )&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Thanks to a small oversight the order of complexity is Ο(&lt;i&gt;n&lt;/i&gt;) instead of Ο(log &lt;i&gt;n&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;Recursion via Pascal was published in 1984 but remains relevant despite it's age. The text is easy to follow and I'd recommend the book to anyone curious enough to delve further into recursion :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7867200278181531153?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7867200278181531153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2011/01/recursion-via-pascal.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7867200278181531153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7867200278181531153'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2011/01/recursion-via-pascal.html' title='Recursion via Pascal'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/TS36VSJJgjI/AAAAAAAABxQ/x8Uc9kutT1s/s72-c/recursion_via_pascal.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7264468939817401754</id><published>2010-12-23T14:36:00.000-08:00</published><updated>2010-12-27T08:33:39.349-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='#songsincode'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><title type='text'>#CarolsInCode - Top Five Countdown</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="#carolsincode" border="0" height="125" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TQu0nvMoquI/AAAAAAAABwo/KIc17clQmvk/s400/carolsincode.jpg" width="125" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;strong&gt;#CarolsInCode&lt;/strong&gt; is a programming meme with a seasonal twist. Short programs are used to encode the lyrics of a Christmas carol. Some display the lyrics when the program runs while the more ingenious examples define the song with the program's control structures. &lt;br /&gt;&lt;br /&gt;For example in JavaScript:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;while ( shepherds.watch() == 'flocks' &amp;amp;&amp;amp;&lt;br /&gt;  date.getHours() in night )&lt;br /&gt;{&lt;br /&gt;  lord.angel--;&lt;br /&gt;  glory.shone_around();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is &lt;cite&gt;While Shepherds Watched Their Flocks&lt;/cite&gt; by Nahum Tate:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;“While Shepherds watch their flocks by night,&lt;br /&gt;All seated on the ground,&lt;br /&gt;The angel of the Lord came down, &lt;br /&gt;And glory shone around.”&lt;/blockquote&gt;&lt;br /&gt;Here's the top five countdown of the very best #CarolsInCode. Can you identify all five? Is your favourite missing?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://twitter.com/GrumpyWookie"&gt;GrumpyWookie&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Weather.Outside="frightful";&lt;br /&gt;Fire.Delightful=true;&lt;br /&gt;Lights.Luminosity=WayDownLow;&lt;br /&gt;for (int i=1; i&amp;lt;=3; i++) { LetItSnow(); }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/shinyemptyhead"&gt;ShinyEmptyHead&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;public Sleigh sleigh;&lt;br /&gt;public void dashThroughSnow()&lt;br /&gt;{&lt;br /&gt;int horses = 1;&lt;br /&gt;sleigh = new Sleigh(horses);&lt;br /&gt;for (Field field : fields)&lt;br /&gt;{&lt;br /&gt;laugh();&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/johngirvin"&gt;JohnGirvin&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var wenceslas = new Person({&lt;br /&gt;    rank: 'king',&lt;br /&gt;    alignment: 'good'&lt;br /&gt;});&lt;br /&gt;$.bind(FeastOfStephen, function() {&lt;br /&gt;    wenceslas.lookOut();&lt;br /&gt;});&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/Costall"&gt;Costall&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;if (DateTime.Now()=="25/12/2010")&lt;br /&gt;{&lt;br /&gt;for (i=0;i&amp;lt;3;i++) Ship[i].Visibility = Visibility.Visible;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/GrumpyWookie"&gt;GrumpyWookie&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Kiss.PersonA="Mummy";&lt;br /&gt;Kiss.PersonB="Santa";&lt;br /&gt;Kiss.Witness=Me;&lt;br /&gt;Kiss.Location=Mistletoe.Underneath;&lt;br /&gt;Kiss.Time=Date.LastNight;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;More #CarolsInCode&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.retroprogramming.com/2010/12/carolsincode-christmas-for-programmers.html"&gt;#carolsincode - Christmas for Programmers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.weedoorsbanging.com/archives/carols-in-code.html"&gt;carols in code | wee doors banging&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blog.soulwire.co.uk/notes/programming/carols-in-code"&gt;Carols in Code, A Festive Twitter Meme&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://search.twitter.com/search?q=%23carolsincode"&gt;#CarolsInCode search on Twitter&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt="#songsincode, lyrics for programmers" border="0" id="BLOGGER_PHOTO_ID_5379764520479958162" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/SqjDVAJ1JJI/AAAAAAAABFU/jg8BokOk0S0/s400/code_music.jpg" style="display: block; height: 40px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7264468939817401754?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7264468939817401754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/12/carolsincode-top-five-countdown.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7264468939817401754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7264468939817401754'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/12/carolsincode-top-five-countdown.html' title='#CarolsInCode - Top Five Countdown'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TQu0nvMoquI/AAAAAAAABwo/KIc17clQmvk/s72-c/carolsincode.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6989943550386460163</id><published>2010-12-17T11:29:00.000-08:00</published><updated>2010-12-24T00:14:58.591-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='#songsincode'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><title type='text'>#carolsincode - Christmas for Programmers</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="#carolsincode" border="0" height="125" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TQu0nvMoquI/AAAAAAAABwo/KIc17clQmvk/s400/carolsincode.jpg" width="125" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;strong&gt;#carolsincode&lt;/strong&gt; are small pseudo-programs which contain a Christmas song. Some examples display the lyrics while others use the program's control structures to define the song.&lt;br /&gt;&lt;br /&gt;Here are five examples in C, CSS and JavaScript. Can you do better? ;-)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var kings=new Array(3);&lt;br /&gt;for (x in kings)&lt;br /&gt;{&lt;br /&gt;  kings[x].origin='orient';&lt;br /&gt;  kings[x].bearingGift=true;&lt;br /&gt;  kings[x].travelled='afar';&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;main() {&lt;br /&gt;  int a;&lt;br /&gt;  for (a=1;a&amp;lt;5;a++) printf("Noel, ");&lt;br /&gt;  printf("Born is the King of Israel.");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;#rudolf .nose {&lt;br /&gt;  color: red;&lt;br /&gt;  background: url('very_shiny.jpg');&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;while ( shepherds.watch() == 'flocks' &amp;amp;&amp;amp;&lt;br /&gt;  date.getHours() in night )&lt;br /&gt;{&lt;br /&gt;  lord.angel--;&lt;br /&gt;  glory.shone_around();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;for ( c=1, c&amp;lt;=4, c++)&lt;br /&gt;{&lt;br /&gt;  noel()&lt;br /&gt;};&lt;br /&gt;king = new Object();&lt;br /&gt;king.kingdom = 'Israel';&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6989943550386460163?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6989943550386460163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/12/carolsincode-christmas-for-programmers.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6989943550386460163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6989943550386460163'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/12/carolsincode-christmas-for-programmers.html' title='#carolsincode - Christmas for Programmers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kDyMtZ_dJwQ/TQu0nvMoquI/AAAAAAAABwo/KIc17clQmvk/s72-c/carolsincode.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-644788871780631971</id><published>2010-12-06T03:40:00.001-08:00</published><updated>2010-12-06T03:41:24.466-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='contest'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><title type='text'>Programming Contest: Topswaps</title><content type='html'>&lt;a href="http://azspcs.net/"&gt;Al Zimmermann&lt;/a&gt;'s latest programming challenge asks up to arrange a deck of &lt;i&gt;n&lt;/i&gt; cards numbered 1 .. &lt;i&gt;n&lt;/i&gt; to maximise the number of swaps. Each swap looks at the value &lt;i&gt;x&lt;/i&gt; on the top card and reverses the top &lt;i&gt;x&lt;/i&gt; cards.&lt;br /&gt;&lt;br /&gt;For &lt;i&gt;n&lt;/i&gt;=4 the sequence 3, 1, 4, 2 requires 4 swaps:&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid black;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td style="padding: 0 10px;"&gt;3&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;1&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;4&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;2&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;table style="border: 1px solid black;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;4&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;1&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;3&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;2&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;table style="border: 1px solid black;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;2&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;3&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;1&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;4&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;table style="border: 1px solid black;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;3&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;2&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;1&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;4&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;table style="border: 1px solid black;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;1&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;2&lt;/td&gt; &lt;td style="background: silver; padding: 0 10px;"&gt;3&lt;/td&gt; &lt;td style="padding: 0 10px;"&gt;4&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;Al challenges us to find the best solution for the first 25 primes, &lt;i&gt;n&lt;/i&gt;=2, 3, 5 .. 97. Even a simple program which tests random combinations can throw out some reasonable scores:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;10 rem setup array&lt;br /&gt;20 input z&lt;br /&gt;30 dim x(z)&lt;br /&gt;40 for a=1 to z&lt;br /&gt;50 x(a)=a&lt;br /&gt;60 next a&lt;br /&gt;70 h=0&lt;br /&gt;&lt;br /&gt;100 rem shuffle array&lt;br /&gt;110 for a=1 to z&lt;br /&gt;120 r=int(rnd*z+1)&lt;br /&gt;130 t=x(a)&lt;br /&gt;140 x(a)=x(r)&lt;br /&gt;150 x(r)=t&lt;br /&gt;160 next a&lt;br /&gt;&lt;br /&gt;200 rem remember order&lt;br /&gt;210 a$=""&lt;br /&gt;220 for a=1 to z&lt;br /&gt;230 a$=a$+","+str$(x(a))&lt;br /&gt;240 next a&lt;br /&gt;&lt;br /&gt;300 rem swap until done&lt;br /&gt;310 c=0&lt;br /&gt;&lt;br /&gt;400 q=x(1)&lt;br /&gt;410 for a=1 to int(q/2)&lt;br /&gt;420 t=x(a)&lt;br /&gt;430 x(a)=x(q+1-a)&lt;br /&gt;440 x(q+1-a)=t&lt;br /&gt;450 next a&lt;br /&gt;&lt;br /&gt;500 c=c+1&lt;br /&gt;510 if x(1)&amp;gt;1 then goto 400&lt;br /&gt;&lt;br /&gt;600 rem display highscore&lt;br /&gt;610 if c&amp;gt;h then h=c:print c;" : ";a$&lt;br /&gt;620 goto 100&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Are you planning to take part in the contest?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-644788871780631971?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/644788871780631971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/12/programming-contest-topswaps_06.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/644788871780631971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/644788871780631971'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/12/programming-contest-topswaps_06.html' title='Programming Contest: Topswaps'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6830578400045273607</id><published>2010-10-08T12:32:00.000-07:00</published><updated>2010-10-14T14:05:04.323-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='urisc'/><category scheme='http://www.blogger.com/atom/ns#' term='subleq'/><category scheme='http://www.blogger.com/atom/ns#' term='sbn'/><category scheme='http://www.blogger.com/atom/ns#' term='subneg'/><category scheme='http://www.blogger.com/atom/ns#' term='rssb'/><category scheme='http://www.blogger.com/atom/ns#' term='oisc'/><title type='text'>URISC / OISC: One Instruction Computers</title><content type='html'>URISC is an abstract computer designed to have a minimal instruction set, only one instruction. URISC is an abbreviation of Ultimate RISC, although technically the machine doesn’t meet the criteria for RISC.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Types of URISC&lt;/h3&gt;&lt;br /&gt;There are four common types of URISC – MOV, RSSB, SUBLEQ and SUBNEG.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;MOV – Transport Triggered Architecture&lt;/h3&gt;&lt;br /&gt;In a MOV URISC machine there's one instruction with two operands. When the instruction executes, it copies one location in memory to another, using the operands as pointers. Jumps, arithmetic and input / output are achieve with a memory mapped program counter, arithmetic unit and input / output ports.&lt;br /&gt;&lt;br /&gt;More information about MOV TTA:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Transport_triggered_architecture"&gt;Transport Triggered Architecture&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;RSSB – Reverse Subtract and Skip if Borrow&lt;/h3&gt;&lt;br /&gt;The instruction in a RSSB URISC machine is Reverse Subtract and Skip if Borrow. Each instruction has one operand which is a pointer into memory. When the instruction executes, it subtracts the accumulator from a memory location and stores the result in both. If the value in memory was lower than the accumulator, the next instruction will be skipped. The program counter, accumulator and input / output are mapped to memory.&lt;br /&gt;&lt;br /&gt;More information about RSSB:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.retroprogramming.com/2009/01/ultimate-risc-one-instruction-set.html"&gt;The Ultimate RISC, One Instruction Computers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.retroprogramming.com/2009/01/hello-world-for-rssb-virtual-computer.html"&gt;Hello World for the RSSB Virtual Computer&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://impomatic.blogspot.com/2009/01/redcode-interpretter-for-rssb-single.html"&gt;Redcode Interpreter for the RSSB Virtual Computer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;SUBNEG – Subtract and Branch if Negative&lt;/h3&gt;&lt;br /&gt;Also abbreviated to SBN, a SUBNEG computer uses an instruction with three operands. When executed, SUBNEG subtracts the contents of the first memory location from a second location, storing the result in the second. If the first value was higher than the second, SUBNEG jumps to where the third operand points. Input / output are memory mapped.&lt;br /&gt;&lt;br /&gt;More information about SUBNEG:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://bitstuff.blogspot.com/2007/02/subtract-and-branch-if-negative.html"&gt;A SBN Computer Built from 74xx Gates&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;SUBLEQ – Subtract and Branch if Less than or Equal&lt;/h3&gt;&lt;br /&gt;SUBLEQ is similar to a SUBNEG computer, but also branches if the contents of the two memory locations is identical.&lt;br /&gt;&lt;br /&gt;More information about SUBLEQ:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://techtinkering.com/blog/?id=22"&gt;Hello‚ World! in SUBLEQ Assembly&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://techtinkering.com/blog/?id=20"&gt;The SUBLEQ URISC / OISC Architecture&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.redcode.nl/blog/2009/12/corewar-subleq-interpreter/"&gt;SUBLEQ Interpreter in Redcode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://eigenratios.blogspot.com/2006/09/mark-ii-oisc-self-interpreter.html"&gt;SUBLEQ Self Interpreter&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Other Types of OISC&lt;/h3&gt;&lt;br /&gt;There have been several attempts to simplify OISC even further. &amp;nbsp;Here are a couple of examples:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://impomatic.blogspot.com/2009/04/redcodes-oisc-djn-computer.html"&gt;DJN OISC&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://esolangs.org/wiki/BitBitJump"&gt;BitBitJump&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6830578400045273607?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6830578400045273607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/10/urisc-is-abstract-computer-designed-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6830578400045273607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6830578400045273607'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/10/urisc-is-abstract-computer-designed-to.html' title='URISC / OISC: One Instruction Computers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6690446547765286098</id><published>2010-10-05T01:56:00.000-07:00</published><updated>2010-10-05T02:23:58.615-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='core war'/><category scheme='http://www.blogger.com/atom/ns#' term='corewar'/><title type='text'>Core War - The King of Programming Games</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://corewar.co.uk/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="corewar: the war of the programmers" border="0" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/TKrjTZ5j6xI/AAAAAAAABt4/r8xQ4n4wQx0/s1600/corewar_125.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;The aim of a&amp;nbsp;&lt;a href="http://programminggames.org/"&gt;programming game&lt;/a&gt;&amp;nbsp;is to write a short program that competes towards a goal, usually destroying all opponents or capturing a flag.&lt;br /&gt;&lt;br /&gt;There are two main types of programming game:&lt;br /&gt;&lt;ul style="clear: left;"&gt;&lt;li&gt;games inspired by &lt;a href="http://corewar.co.uk/robotwar"&gt;RobotWar&lt;/a&gt;&amp;nbsp;- programs control a battle robot which moves around an arena firing at opponents – RobotWar was created in the 1970s.&lt;/li&gt;&lt;li&gt;games inspired by &lt;a href="http://corewar.co.uk/darwin"&gt;Darwin&lt;/a&gt;&amp;nbsp;- programs attempt to modify and crash the opponent's program. Darwin was first played at Bell Labs in 1961.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Both games have spawned a series of clones, the most popular being &lt;a href="http://corewar.co.uk/crobots"&gt;CRobots&lt;/a&gt; (1985) and &lt;a href="http://corewar.co.uk/"&gt;Core War&lt;/a&gt; (1984).&lt;br /&gt;&lt;br /&gt;In Core War players write programs in Redcode, the assembly language of the &lt;acronym title="Memory Array Redcode Simulator"&gt;MARS&lt;/acronym&gt; virtual computer. The aim of the game is to survive while causing all opponents to terminate. There are three basic strategies:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.corewar.info/lexicon/paper.htm"&gt;paper&lt;/a&gt;&amp;nbsp;- programs spawn off new copies in the hope at least one survives.&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/scanner.htm"&gt;scissors&lt;/a&gt;&amp;nbsp;- programs search for opponents and attempt to disable them.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.astercity.net/~grabek/book"&gt;stone&lt;/a&gt;&amp;nbsp;- programs drops instructions at random hoping to hit the opponent.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;A couple of years after A. K. Dewdney introduced Core War a society was formed which organised an annual tournament. The &lt;a href="http://corewar.co.uk/icwt1986/"&gt;First International Core War Tournament&lt;/a&gt; held in the Computer Museum, Boston MA was a great success with a paper coming out on top, Mice by Chip Wendell.&lt;br /&gt;&lt;br /&gt;Core War is now played as a King of the Hill tournament. Players submit their program to a hill containing some of the top Core War programs, receiving results a few minutes later. If the program is successful it enters the hill, knocking off the lowest warrior.&lt;br /&gt;&lt;br /&gt;Despite being 26 years old Core War still has a community of regular players. Although the major techniques appear to have been discovered new ideas are constantly being tested, occasionally with impressive results. If you’d like to find out more about Core War here are some handy links for new players:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://vyznev.net/corewar/guide.html"&gt;The Beginner’s Guide to Redcode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/guides.htm"&gt;Core War Strategy Guides&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.koth.org/"&gt;Core War King of the Hill&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://users.obs.carnegiescience.edu/birk/COREWAR/koenigstuhl.html"&gt;Koenigstuhl Core War Archive&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/biblio.htm"&gt;The Core War Bibliography&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If you’re planning to try your hand at writing a battle program, good luck and may the core be with you!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6690446547765286098?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6690446547765286098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/10/core-war-king-of-programming-games.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6690446547765286098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6690446547765286098'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/10/core-war-king-of-programming-games.html' title='Core War - The King of Programming Games'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/TKrjTZ5j6xI/AAAAAAAABt4/r8xQ4n4wQx0/s72-c/corewar_125.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7091733251249107393</id><published>2010-06-12T07:41:00.000-07:00</published><updated>2010-06-12T08:23:25.772-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='history'/><category scheme='http://www.blogger.com/atom/ns#' term='events'/><category scheme='http://www.blogger.com/atom/ns#' term='museum'/><title type='text'>The Vintage Computer Festival, Bletchley Park</title><content type='html'>The computing highlight of June will be the Vintage Computer Festival at The National Museum of Computing, Bletchley Park. &amp;nbsp;Held on 19-20 June, the event is the first of it's kind in the U.K. &amp;nbsp;Tickets can be purchased for &lt;a href="http://www.bletchleypark.org.uk/shop/index.rhtm/130872/cat.html"&gt;£8.50 online&lt;/a&gt; or £10.00 on the door.&lt;br /&gt;&lt;br /&gt;The National Museum of Computing's website has the full&amp;nbsp;&lt;a href="http://www.tnmoc.org/vcf-gb.aspx"&gt;list of exhibitors, lectures and events&lt;/a&gt;. Some of the highlights include:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The launch of the new Amiga X1000 boasting a dual-core 1.8GHz PowerISA CPU, 2GB memory and Xena 500MHz &lt;acronym title="Software Defined Silicon"&gt;SDS&lt;/acronym&gt; co-processor&lt;/li&gt;&lt;li&gt;20+ exhibitors demonstrating a variety of historic computers&lt;/li&gt;&lt;li&gt;Lectures by a number of key figures in computing history, including &lt;a href="http://en.wikipedia.org/wiki/Sophie_Wilson"&gt;Sophie Wilson&lt;/a&gt;, one of the designers of Acorn Computers and ARM processors&lt;/li&gt;&lt;li&gt;Retro gaming competition&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I'll be there when the gates open at 10:30am on Saturday. Are you planning to attend?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7091733251249107393?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7091733251249107393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/06/vintage-computer-festival-bletchley.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7091733251249107393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7091733251249107393'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/06/vintage-computer-festival-bletchley.html' title='The Vintage Computer Festival, Bletchley Park'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-3973966808327083355</id><published>2010-06-05T09:34:00.000-07:00</published><updated>2010-06-05T11:35:52.367-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='history'/><category scheme='http://www.blogger.com/atom/ns#' term='museum'/><category scheme='http://www.blogger.com/atom/ns#' term='home computers'/><title type='text'>Computer Museums in the U.K.</title><content type='html'>The U.K. has a number of dedicated computer museums while a few other museums have permanent computer history collections. If you're interested in the history of computing the following are definitely worth a visit:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The National Museum of Computing&lt;/h3&gt;&lt;br /&gt;During World War II Bletchley Park was home to Britain's secret codebreaking activities. &lt;a href="http://www.tnmoc.org/"&gt;The National Museum of Computing&lt;/a&gt; is based at Bletchley and has a collection which includes an Elliot 803, &lt;acronym title="International Computers Limited"&gt;ICL&lt;/acronym&gt; 2966 and the Colossus. The museum is open Thursday and Saturday afternoons, admission £8.50.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Museum of Computing&lt;/h3&gt;&lt;br /&gt;The &lt;a href="http://www.museumofcomputing.org.uk/"&gt;Museum of Computing&lt;/a&gt; is close to Swindon's town centre and specialises in home computers and games consoles. The museum is open on Monday and Saturday, admission £3.50.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Science Museum&lt;/h3&gt;&lt;br /&gt;London's &lt;a href="http://www.sciencemuseum.org.uk/visitmuseum/galleries/computing.aspx"&gt;Science Museum&lt;/a&gt; has a collection dedicated to the history of computing. The museum is home to a variety of notable systems including a Cray 1, Ferranti Pegasus and Charles Babbage's Difference Engine. Entry is free.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Centre for Computing History&lt;/h3&gt;&lt;br /&gt;The &lt;a href="http://www.computinghistory.org.uk/"&gt;Centre for Computing History&lt;/a&gt; is based at Haverhill in Suffolk. The museum has an extensive collection of home computers, manuals and magazines. Admission is free but by appointment only.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Museum of Science and Industry&lt;/h3&gt;&lt;br /&gt;The calculating and computing exhibition at Manchester's &lt;a href="http://www.mosi.org.uk/1411"&gt;Museum of Science and Industry&lt;/a&gt; includes a rebuilt Baby, the world's first stored program computer. Entry to the museum is free.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-3973966808327083355?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/3973966808327083355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/06/computer-museums-in-uk.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3973966808327083355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3973966808327083355'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/06/computer-museums-in-uk.html' title='Computer Museums in the U.K.'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-799460099885878990</id><published>2010-05-07T13:07:00.000-07:00</published><updated>2010-05-07T13:07:54.143-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='altera'/><title type='text'>My Latest Gadget: Altera MAX II</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img alt="SLS ELT II development board with Altera MAX II" border="0" height="320" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S-Rs-e2Fl7I/AAAAAAAABnk/G5MXXY_BnE0/s640/altera_max.jpg" width="480" /&gt;&lt;/div&gt;&lt;br /&gt;Here's my latest gadget, a SLS ELT II development board with Altera MAX II picked up for £1.20 on eBay :-)  It provides 240 programmable logic elements and 8 kilobits of flash memory. &amp;nbsp;I haven't got anything planned for it yet apart from a crazy idea about evolving a logic array to solve a problem. &amp;nbsp;Have you got any great ideas for a project?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-799460099885878990?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/799460099885878990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/05/my-latest-gadget-altera-max-ii.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/799460099885878990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/799460099885878990'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/05/my-latest-gadget-altera-max-ii.html' title='My Latest Gadget: Altera MAX II'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S-Rs-e2Fl7I/AAAAAAAABnk/G5MXXY_BnE0/s72-c/altera_max.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-68501999390384431</id><published>2010-05-03T01:11:00.000-07:00</published><updated>2010-10-14T14:21:42.560-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='font'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>10 Alternative Monospace Fonts for Programmers</title><content type='html'>Recently I started to look for an alternative programming font after spending far too many hours staring at Courier New. I needed to find a free fixed-width font that's easy on the eye and clearly distinguishes between similar characters, e.g. O01Il.&lt;br /&gt;&lt;br /&gt;Here's a quick round up of the best alternatives I found. Which programming font are you using? Did I miss your favourite?&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Default Monospace Fonts&lt;/h3&gt;&lt;br /&gt;First let's take a look at the default fonts. The examples show the font at 12 point with subpixel rendering switched off:&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Consolas&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93jmSV_bfI/AAAAAAAABls/Xh0jx-MOl5Q/s320/font_consolas.png" /&gt;&lt;/div&gt;&lt;br /&gt;Consolas is a monospace programming font created for Microsoft by Lucas de Groot and ships with Windows Vista / Windows 7. Has a slashed zero and designed to look best with ClearType enabled.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Courier New&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93jqbC3kJI/AAAAAAAABl0/YfkmlpF4NzI/s320/font_courier_new.png" /&gt;&lt;/div&gt;&lt;br /&gt;Courier New is perhaps the most familiar monospace font having been introduced in 1992 with Windows 3.1. Courier New is a serifed font designed by Adrian Frutiger and lacks a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Lucida Console&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S93jtgbkO_I/AAAAAAAABl8/X8SENPIAmro/s320/font_lucida_console.png" /&gt;&lt;/div&gt;&lt;br /&gt;Lucida Console designed by Charles Bigelow and Kris Holmes is the default font for Windows Notepad and also lacks a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Monaco&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93jwozS1NI/AAAAAAAABmE/fOwSPxv31oM/s320/font_monaco.png" /&gt;&lt;/div&gt;&lt;br /&gt;Monaco is a sans-serif monospace font designed by Susan Kare and Kris Holmes and ships with Mac OS X. Includes a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Alternative Monospace Fonts&lt;/h3&gt;&lt;br /&gt;While some of the default fonts aren't too bad, we can do much better. Here are some great alternatives mostly designed with programmers in mind:&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Anonymous Pro&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/S93g-Oy_aNI/AAAAAAAABlM/S9aE-6Vzw9E/s320/font_anonymous_pro.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.ms-studio.com/FontSales/anonymouspro.html"&gt;Anonymous Pro&lt;/a&gt; is a programming font designed by Mark Simonson. The serifed font was influenced by Susan Lesch and David Lamkins' Anonymous 9. Very clear with plenty of white space and a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Bitstream Vera Sans Mono&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S93hZATKTvI/AAAAAAAABlU/3e5KvUxob58/s320/font_bistream_vera_sans_mono.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.gnome.org/fonts"&gt;Bitstream Vera Sans Mono&lt;/a&gt; is a sans-serif coding font designed by Jim Lyles from Bitstream. The zero is dotted and the bottom of the lower case l curls to the right.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;DejaVu Sans Mono&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S93hpVuct5I/AAAAAAAABlc/4pj0xH-yw-E/s320/font_dejavu_sans_mono.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://dejavu-fonts.org/wiki/index.php?title=Main_Page"&gt;DejaVu Sans Mono&lt;/a&gt; is extended from Bitstream Vera Sans Mono and supports a wider selection of characters. The clean sans-serif font ships with a number of Linux distributions.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Dina&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S93j0tJUV9I/AAAAAAAABmM/uvcKPssN_dc/s320/font_dina_9_point.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.donationcoder.com/Software/Jibz/Dina"&gt;Dina&lt;/a&gt; is a sans-serif programming font created by Jørgen Ibsen and is available in 8, 9 or 10 point. Has a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Droid Sans Mono&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S93h6M6aLTI/AAAAAAAABlk/cZX2fBB08QA/s320/font_droid_sans_mono.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://damieng.com/blog/2007/11/14/droid-sans-mono-great-coding-font"&gt;Droid Sans Mono&lt;/a&gt; was designed by Steve Matteson of Ascender Corporation. The sans-serif font is clear but lacking a slashed or dotted zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Envy Code R&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S93j4uh8FjI/AAAAAAAABmU/nxIy6Qm6Otw/s320/font_envy_code_r.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released"&gt;Envy Code R&lt;/a&gt; is a clean sans-serif programming font designed by Damien Guard and includes a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Inconsolata&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S93j8NONKvI/AAAAAAAABmc/eFExgVv4quU/s320/font_inconsolata.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.levien.com/type/myfonts/inconsolata.html"&gt;Inconsolata&lt;/a&gt; is a monospace programming font created by Raph Levien and inspired in part by Consolas. Has a slashed zero.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Monofur&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S93kB_MiH6I/AAAAAAAABmk/LHNPY700h-Q/s320/font_monofur.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.dafont.com/monofur.font"&gt;Monofur&lt;/a&gt; is a quirky monospace font created by Tobias Benjamin Köhler. Includes a dotted zero and a curl on the lower case l.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Proggy Clean&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93kFSLPF4I/AAAAAAAABms/WEoeTx99HV0/s320/font_proggycleantt.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.proggyfonts.com/"&gt;Proggy Clean&lt;/a&gt; was designed by Tristan Grimmer and is available with either a dotted or slashed zero. Several variants of the Proggy font are available.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Triskweline&lt;/h4&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93kJrFWopI/AAAAAAAABm0/3vy3cfkg0Ig/s320/font_triskweline_10_point.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.netalive.org/tinkering/triskweline"&gt;Triskweline&lt;/a&gt; is a clear monospace font created by Henning Koch. Lacks a slashed zero and only available in 10 point.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-68501999390384431?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/68501999390384431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/05/10-alternative-monospace-fonts-for.html#comment-form' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/68501999390384431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/68501999390384431'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/05/10-alternative-monospace-fonts-for.html' title='10 Alternative Monospace Fonts for Programmers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kDyMtZ_dJwQ/S93jmSV_bfI/AAAAAAAABls/Xh0jx-MOl5Q/s72-c/font_consolas.png' height='72' width='72'/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-5181249436284337348</id><published>2010-04-04T12:25:00.000-07:00</published><updated>2010-04-04T13:02:22.017-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='font'/><category scheme='http://www.blogger.com/atom/ns#' term='home computers'/><title type='text'>Classic Home Computer Fonts</title><content type='html'>Anyone who owned a home computer in the 80's would have been intimately familiar with the character set. Although it was possible to redefine the font, it had to be loaded from cassette and was restricted to an 8×8 pixel grid. Love it or hate it, you were stuck with it.&lt;br /&gt;&lt;br /&gt;Fortunately for anyone who misses their 8-bit computer a selection of classic fonts are available online. Here are a few of my favourites:&lt;br /&gt;&lt;br /&gt;&lt;img alt="Amstrad CPC Font" border="0" style="vertical-align: middle; margin-right: 3em" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S7jU4BxfaWI/AAAAAAAABiU/gEvJwB5G1EM/s320/amstrad_cpc_font.png" /&gt; &lt;a href="http://genesis8.free.fr/frontend/dgraphic.php"&gt;Amstrad CPC font&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt="Atari Font" border="0" style="vertical-align: middle; margin-right: 3em" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S7jVB1fcsDI/AAAAAAAABic/dGLB9XlCPVI/s320/atari_font.png" /&gt; &lt;a href="http://www2.bitstream.net/~marksim/atarimac/fonts.html"&gt;Atari font&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt="Commodore 64 font" border="0" style="vertical-align: middle; margin-right: 3em" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S7jXEh2hzaI/AAAAAAAABis/uV1YymCS_50/s320/commodore_64_font.png" /&gt; &lt;a href="http://kofler.dot.at/c64"&gt;Commodore font&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt="ZX Spectrum font" border="0" style="vertical-align: middle; margin-right: 3em" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S7jXJW-2A8I/AAAAAAAABi0/dI1VxWgpVTY/s320/zx_spectrum_font.png" /&gt; &lt;a href="http://www.worldofspectrum.org/utilities.html"&gt;ZX Spectrum font&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Which home computers did you own and what did you love / hate about the font? :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-5181249436284337348?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/5181249436284337348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/04/classic-home-computer-fonts.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5181249436284337348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5181249436284337348'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/04/classic-home-computer-fonts.html' title='Classic Home Computer Fonts'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S7jU4BxfaWI/AAAAAAAABiU/gEvJwB5G1EM/s72-c/amstrad_cpc_font.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4977849036761838950</id><published>2010-03-20T02:14:00.000-07:00</published><updated>2010-06-27T09:49:06.067-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><category scheme='http://www.blogger.com/atom/ns#' term='til'/><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><title type='text'>Threaded Interpretive Languages by R. G. Loeliger</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="Threaded Interpretive Languages by R. G. Loeliger" border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S6R53-lsvlI/AAAAAAAABfs/iXTfgOUBP7I/s320/threaded_interpretive_languages.jpg" /&gt;&lt;/span&gt;&lt;/div&gt;In &lt;strong&gt;Threaded Interpretive Languages&lt;/strong&gt;, Loeliger explores the design and implementation of &lt;acronym title="threaded interpretive language"&gt;TIL&lt;/acronym&gt;s in an individual quirky style. &amp;nbsp;Programs in a threaded language typically compiles to a list of subroutine calls or addresses. Loeliger focuses on Forth-like threaded languages and provides examples in Z80 assembly language.&lt;br /&gt;&lt;br /&gt;After the standard introductory chapter the book gets straight down to the implementation details, first dealing with the design of the dictionary format, inner and outer interpreters. &amp;nbsp;This is followed by example code for the interpreters and assembly language definitions for 170 of the most common subroutines.&lt;br /&gt;&lt;br /&gt;Later chapters investigate some common extensions to &lt;acronym title="threaded interpretive language"&gt;TIL&lt;/acronym&gt;s including virtual memory and floating point numbers. A section is devoted to assemblers and includes code for a structured Z80 assembler.&lt;br /&gt;&lt;br /&gt;Threaded Interpretive Languages contains the most in-depth examination of Forth internals I've seen. However the age of the books shows in the dialect of Forth used and the systems described. Despite this, I'd still recommend&amp;nbsp;Threaded Interpretive Languages&amp;nbsp;to anyone planning to implement a minimal Forth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4977849036761838950?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4977849036761838950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/03/threaded-interpretive-languages-by-r-g.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4977849036761838950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4977849036761838950'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/03/threaded-interpretive-languages-by-r-g.html' title='Threaded Interpretive Languages by R. G. Loeliger'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S6R53-lsvlI/AAAAAAAABfs/iXTfgOUBP7I/s72-c/threaded_interpretive_languages.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-9170408602818743005</id><published>2010-02-28T09:24:00.000-08:00</published><updated>2010-06-27T09:50:37.098-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssem'/><category scheme='http://www.blogger.com/atom/ns#' term='emulator'/><category scheme='http://www.blogger.com/atom/ns#' term='history'/><title type='text'>Emulating the Manchester SSEM</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S4qZTJ1oIJI/AAAAAAAABcg/T963OoHWaUo/s320/manchester_ssem1.png" alt="display from my Manchester SSEM emulator" /&gt;&lt;/span&gt;&lt;/div&gt;The Manchester Small-Scale Experimental Machine was the first computer to store programs in memory and was built at the University of Manchester in 1948 by Williams, Kilburn and Toothill.&lt;br /&gt;&lt;br /&gt;The machine had 32 words of 32 bit memory, one register and supported 7 instructions:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;000&lt;/td&gt;&lt;td&gt;JMP&lt;/td&gt;&lt;td&gt;s, C&lt;/td&gt;&lt;td&gt;Jump&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;JRP&lt;/td&gt;&lt;td&gt;c+s, C&lt;/td&gt;&lt;td&gt;Relative Jump&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;010&lt;/td&gt;&lt;td&gt;LDN&lt;/td&gt;&lt;td&gt;-s, A&lt;/td&gt;&lt;td&gt;Load and Negate&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;STO&lt;/td&gt;&lt;td&gt;a, S&lt;/td&gt;&lt;td&gt;Store&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;001&lt;/td&gt;&lt;td&gt;SUB&lt;/td&gt;&lt;td&gt;a-s, A&lt;/td&gt;&lt;td&gt;Subtract&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;011&lt;/td&gt;&lt;td&gt;CMP&lt;/td&gt;&lt;td&gt;Test&lt;/td&gt;&lt;td&gt;Skip if Negative&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;STOP&lt;/td&gt;&lt;td&gt;Stop&lt;/td&gt;&lt;td&gt;Halt Machine&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;With only 7 instructions the SSEM makes an ideal system for an emulation project. A basic simulator can be written in under 40 Intel x86 instructions. If you're tempted to write your own, the &lt;a href="http://www.cs.manchester.ac.uk/Digital60/Baby/ssem/refman.htm"&gt;SSEM Reference Manual&lt;/a&gt; will come in handy. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-9170408602818743005?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/9170408602818743005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/02/emulating-manchester-ssem.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9170408602818743005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9170408602818743005'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/02/emulating-manchester-ssem.html' title='Emulating the Manchester SSEM'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/S4qZTJ1oIJI/AAAAAAAABcg/T963OoHWaUo/s72-c/manchester_ssem1.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2839326696973692315</id><published>2010-01-09T11:10:00.000-08:00</published><updated>2010-01-09T11:10:49.032-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='primes'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><category scheme='http://www.blogger.com/atom/ns#' term='home computers'/><category scheme='http://www.blogger.com/atom/ns#' term='benchmark'/><title type='text'>8 Bit Home Computer Benchmarks</title><content type='html'>Over the years I've collected quite a few 8 bit home computers. Out of curiosity I decided to write a simple prime sieve benchmark to compare their implementations of BASIC.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;10 LET W=500:DIM F(W):LET P=1:LET A=3&lt;br /&gt;20 LET F(P)=A:LET P=P+1:IF P&amp;gt;W THEN STOP&lt;br /&gt;30 LET A=A+2:LET X=1&lt;br /&gt;40 LET S=A/F(X):IF S=INT(S) THEN 30&lt;br /&gt;50 LET X=X+1:IF X&amp;lt;P AND F(X)*F(X)&amp;lt;=A THEN 40&lt;br /&gt;60 GOTO 20&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here are the results from a few of the machines I have to hand:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;System&lt;br /&gt;&lt;/th&gt;&lt;th&gt;CPU&lt;br /&gt;&lt;/th&gt;&lt;th&gt;Time&lt;br /&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Acorn Electron&lt;br /&gt;&lt;/td&gt;&lt;td&gt;2.0MHz 6502&lt;br /&gt;&lt;/td&gt;&lt;td&gt;138&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Amstrad CPC464&lt;br /&gt;&lt;/td&gt;&lt;td&gt;4.0MHz Z80A&lt;br /&gt;&lt;/td&gt;&lt;td&gt;140&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Commodore C64&lt;br /&gt;&lt;/td&gt;&lt;td&gt;1.0MHz 6510&lt;br /&gt;&lt;/td&gt;&lt;td&gt;254&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Commodore Plus/4&lt;br /&gt;&lt;/td&gt;&lt;td&gt;1.0 MHz 8501&lt;br /&gt;&lt;/td&gt;&lt;td&gt;267&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Tandy 64K CoCo 2&lt;br /&gt;&lt;/td&gt;&lt;td&gt;0.895MHz 6809E&lt;br /&gt;&lt;/td&gt;&lt;td&gt;271&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Atari 800XL&lt;br /&gt;&lt;/td&gt;&lt;td&gt;1.8MHz 6502&lt;br /&gt;&lt;/td&gt;&lt;td&gt;316&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sinclair Spectrum +3&lt;br /&gt;&lt;/td&gt;&lt;td&gt;3.55MHz Z80A&lt;br /&gt;&lt;/td&gt;&lt;td&gt;388&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Let me know how long it takes to run on your favourite classic computer. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2839326696973692315?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2839326696973692315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2010/01/8-bit-home-computer-benchmarks.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2839326696973692315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2839326696973692315'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2010/01/8-bit-home-computer-benchmarks.html' title='8 Bit Home Computer Benchmarks'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7241901887549961320</id><published>2009-11-08T09:33:00.000-08:00</published><updated>2010-06-27T09:52:37.474-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='8088'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='z80'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>Secret Opcodes of the 8 Bit Processors</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="secret opcodes" border="0" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S6S4PFwDFkI/AAAAAAAABf0/kXZPreYLIHc/s320/secret_opcodes_125.jpg" /&gt;&lt;/span&gt;&lt;/div&gt;Undocumented instructions were common on early processors. A few would crash the computer (&lt;code&gt;HCF&lt;/code&gt; - halt and catch fire) while others had strange but occasionally useful behaviour. Any self-respecting programmer would make use of these to squeeze out the last few cycles of performance.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The effect of undocumented opcodes would vary between different versions of some processors, no doubt leading to the classic excuse “it worked on my machine”. Here are a few examples I've found useful.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;h3&gt;Secrets of the Z80&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;Zilog's Z80 was used in a number of popular 8 bit computers including the Sinclair Spectrum, Amstrad CPC, TRS-80 and MSX. There are a number of undocumented opcodes with the CB, DD, ED and FD prefix.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;CB30-CB37 - &lt;code&gt;SLL reg&lt;/code&gt; shifts a register left, setting bit 0.&lt;/li&gt;&lt;li&gt;DD - when used as a prefix to instructions which use H or L, either the high or low 8 bits of IX are used.&lt;/li&gt;&lt;li&gt;FD - as DD, but the high or low 8 bits of IY will be used.&lt;/li&gt;&lt;li&gt;ED70 - &lt;code&gt;IN (C)&lt;/code&gt; reads from i/o port C, setting the flags and discarding the result.&lt;/li&gt;&lt;li&gt;ED71 - &lt;code&gt;OUT (C),0&lt;/code&gt; outputs a zero to port C.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;Secrets of the 8086/8088&lt;/h3&gt;&lt;br /&gt;Intel's 8088 was used in the original IBM PC and has spawned an entire family of processors.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;D6 - &lt;code&gt;SALC&lt;/code&gt; sets the AL register to either 00 or FF depending on the carry flag. &lt;code&gt;SALC&lt;/code&gt; was finally documented with the introduction of the Pentium Pro 27 years later.&lt;/li&gt;&lt;li&gt;0F - &lt;code&gt;POP CS&lt;/code&gt; pops the CS register from the stack. Only works on 8086 processors.&lt;/li&gt;&lt;li&gt;0F05 - &lt;code&gt;LOADALL&lt;/code&gt; loads all registers from memory location 0800. Only works on 80286 processors.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Which processors have you programmed and did you find any undocumented opcodes useful?&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7241901887549961320?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7241901887549961320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/11/secret-opcodes-of-8-bit-processors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7241901887549961320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7241901887549961320'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/11/secret-opcodes-of-8-bit-processors.html' title='Secret Opcodes of the 8 Bit Processors'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/S6S4PFwDFkI/AAAAAAAABf0/kXZPreYLIHc/s72-c/secret_opcodes_125.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-876287493710452973</id><published>2009-09-20T13:45:00.000-07:00</published><updated>2011-02-05T14:04:45.420-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='core war'/><category scheme='http://www.blogger.com/atom/ns#' term='robot'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='corewar'/><category scheme='http://www.blogger.com/atom/ns#' term='history'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>A History of Programming Games 1961-1989</title><content type='html'>&lt;div&gt;In a programming game players write a program to complete a specific task, usually to wipe out all opponents. The contest takes place between either programs in the memory of a virtual computer or robots in an arena.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;Darwin&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;In August 1961, Douglas McIlroy, Robert Morris and Victor Vyssotsky invented &lt;a href="http://corewar.co.uk/darwin"&gt;Darwin&lt;/a&gt; and the programming game genre. Programs written using IBM 7090 machine code competed to destroy all opponents and be the most prolific replicator. An &lt;i&gt;Umpire&lt;/i&gt; provided three functions to probe memory for an opponent, to claim memory or kill an opponent.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;RobotWar&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://retroprogramming.com/2009/07/robotwar-and-army-of-clones.html"&gt;RobotWar&lt;/a&gt; was written in the 1970s by Silas Warner for the PLATO computer system and published commercially for the Apple II by MUSE Software in 1981. Programs written in a proprietary high level language control robots which battle to eliminate all opponents in a virtual arena. In the early 1980s a society was formed and an annual tournament organised by Computer Gaming World.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;Color Robot Battle&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;The Image Producers released &lt;a href="http://retroprogramming.com/2011/02/celebrating-30-years-of-color-robot.html"&gt;Color Robot Battle&lt;/a&gt;&amp;nbsp;in 1981 for the TRS-80 Color Computer. The game was played by writing programs in a simple hybrid of BASIC and Logo to control a battle robot. Programs faced each other in a one-on-one battle with the last robot standing being declared winner.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;Core War&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;Alexander Dewdney described &lt;a href="http://retroprogramming.com/2008/11/core-war-hostile-programming.html"&gt;Core War&lt;/a&gt; in the May 1984 issue of Scientific American, introducing programming games to a wide audience for the first time. Core War became popular overnight. A society was formed, a newsletter published and regular tournaments held. Core War is played between assembly languages programs in the memory of a virtual computer. Each program attempts to eradicate all opponents. Core War can be played by email at &lt;a href="http://www.koth.org/"&gt;KOTH.org&lt;/a&gt; or &lt;a href="http://sal.math.ualberta.ca/"&gt;KOTH@SAL&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;DROID&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;Inspired by RobotWar, &lt;a href="http://corewar.co.uk/droid"&gt;DROID&lt;/a&gt; was developed at Reichhold Chemicals as a teaching aid in December 1984. Programs to control robots are written in the D-code assembly language and attempt to exterminate all adversaries in the virtual arena. DROID can be played by Telnet on the &lt;a href="http://198.212.189.111/other_games/droid.html"&gt;Empire HPe3000&lt;/a&gt; server.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;CROBOTS&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;Tom Poindexter published &lt;a href="http://corewar.co.uk/crobots"&gt;CROBOTS&lt;/a&gt; as shareware in December 1985 after being inspired by RobotWar. A subset of C is used to control battle robots. As usual, the aim of the game is to destroy all opponents in a virtual arena. A king of the hill tournament is organised by &lt;a href="http://crobots.deepthought.it/"&gt;Maurizio Camangi&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;P-Robots&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;In 1988 David Malmberg released &lt;a href="http://corewar.co.uk/probots"&gt;P-Robots&lt;/a&gt;, a robot battle game based on a subset of the Pascal programming language and inspired by CROBOTS. Later versions introduced a variety of optional extras for robots, teams and obstacles.&lt;/div&gt;&lt;br /&gt;&lt;h3&gt;OMEGA&lt;/h3&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://programminggames.org/OMEGA.ashx"&gt;OMEGA&lt;/a&gt; is a programming game written by Stuart Marks and published by Origin Systems in 1989. The object of the game is to program a tank to defeat a series of increasingly more powerful enemies. Each opponent defeated unlocks a higher security clearance and increased budget.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Unfortunately there's very little information about some of these games online. Do you remember playing any of the above? Which is your favourite programming game and why?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-876287493710452973?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/876287493710452973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/09/history-of-programming-games-1961-1989.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/876287493710452973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/876287493710452973'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/09/history-of-programming-games-1961-1989.html' title='A History of Programming Games 1961-1989'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2300237154813425913</id><published>2009-09-10T02:09:00.001-07:00</published><updated>2010-10-14T15:16:53.437-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='#songsincode'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><title type='text'>#songsincode - Lyrics for Programmers</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0; width: 125px; height: 125px;" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SqjCsQYP_OI/AAAAAAAABFM/5DSkJKtsBiI/s400/songs_in_code.jpg" border="0" alt="#songsincode" id="BLOGGER_PHOTO_ID_5379763820460768482" /&gt;&lt;strong&gt;#songsincode&lt;/strong&gt; are small pseudo-programs which display a song title or part of the lyrics. The more refined examples use conditional code and control stuctures to define the song.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The tag was first used on twitter a couple of weeks ago. After a sudden burst of popularity, &lt;a href="http://search.twitter.com/search?q=%23songsincode"&gt;#songsincode&lt;/a&gt; has slowed to about 20 tweets a day. Here's an example by &lt;a href="http://twitter.com/testydonkey"&gt;testydonkey&lt;/a&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;pre&gt;if(Door.Color == System.Color.Red)&lt;br /&gt;{ Door.Color = System.Color.Black; }&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is &lt;i&gt;Paint it Black&lt;/i&gt; by the Rolling Stones, “I see a red door and I want it painted black”.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's the top 25 countdown of the very finest #songsincode. Can you identify all 25? Is your favourite missing? Let me know :-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://twitter.com/anurse"&gt;anurse&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;var s = new Submarine(Color.Yellow);&lt;br /&gt;s.Residents.Add(Us); for(int i=0;i&amp;lt;2;i++)&lt;br /&gt;{Assert.IsTrue(s.Color == Color.Yellow);}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/darrennisbett"&gt;darrennisbett&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;h=new hotel(); h.name="california";&lt;br /&gt;h.guest.addEvent("checkout");&lt;br /&gt;h.guest.removeEvent("leave")&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/royvanrijn"&gt;royvanrijn&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;if(grass=="green" &amp;amp;&amp;amp; girls == "pretty")&lt;br /&gt;{ takeMe(paradiseCity); }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/injenierobarsa"&gt;injenierobarsa&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;for (int i = 1; i &amp;lt;= 99; i++)&lt;br /&gt;{ redBalloons[i].goBy() }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/3d0"&gt;3d0&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;if(my.sexyness&amp;gt;shirt.sexyness) pain();&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/phikachu"&gt;phikachu&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;me.color = 0x0000FF;&lt;br /&gt;me.text = “Da Ba Dee Da Ba Di”;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/Borisson"&gt;Borisson&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;($horse_name == false ? $location = desert : ' ');&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/plaxdan"&gt;plaxdan&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;self.vehicle = new CombineHarvester();&lt;br /&gt;you.setKey(vehicle.getKey());&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/cargoweasel"&gt;cargoweasel&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;SubwayWalls.write(words_of_the_prophets());&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/Leadhyena"&gt;Leadhyena&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;I.send("...---...",world);&lt;br /&gt;I.send("...---...",world);&lt;br /&gt;while(!(someone.receive(bottle)&amp;amp;&amp;amp;&lt;br /&gt;bottle.contains(message)){I.hope()}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/antallan"&gt;antallan&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;substring("the tiger",6,1)&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/pitsk"&gt;pitsk&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;void shootPeople() { shootSherif; return;&lt;br /&gt;shootDeputy; }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/sbruchmann"&gt;sbruchmann&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;if ($angelsDeserveToDie) { iCry(); }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/royvanrijn"&gt;royvanrijn&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;while( !me.like(mondays) ) { tellWhy(me); }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/Levistica"&gt;Levistica&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;cuts.firstElement().deepness = max;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/uberTof"&gt;uberTof&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;final--;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/plaxdan"&gt;plaxdan&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;while (thing != that) { doForLove(thing);&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/numptygeek"&gt;numptygeek&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;jumpWithDirection(left); stepWithDirection(right);&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/CarstenHagemann"&gt;CarstenHagemann&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;$jealous_sky[$sun] = $you-&amp;gt;tell()&lt;br /&gt;if ($we-&amp;gt;walk($fields_of_gold));&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/numptygeek"&gt;numptygeek&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;if(somethingStrange==true &amp;amp;&amp;amp; location ==&lt;br /&gt;neighborhood){ ghostbusters();&lt;br /&gt;printf("I ain't afraid of no ghost");}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/draconum"&gt;draconum&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;//roxanne.putOnLight('#ff0000');&lt;br /&gt;commented out, was not necessary&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/brozow"&gt;brozow&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;video$ kill -9 `ps -ef | grep radio*`&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/rennyhernandez"&gt;rennyhernandez&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;stuff={'red door','a line of cars', 'my heart'}&lt;br /&gt;stuff.each do |it| it.setColor('#000000') end&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/codepo8"&gt;codepo8&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;.clowns{float:left;}.jokers{float:right};&lt;br /&gt;#me_you{position:fixed;margin:0 auto;width:100%}&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/royvanrijn"&gt;royvanrijn&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;for(Leaf leaf:leafs)&lt;br /&gt;{ leaf.setColor(new Color(139,69,19)); }&lt;br /&gt;sky.setColor(Color.GRAY);&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;#moviesincode, #tvincode, #booksincode!&lt;/h2&gt;&lt;br /&gt;&lt;div&gt;#songsincode has inspired three new tags. Can you see #moviesincode, #tvincode or #booksincode catching on? :-)&lt;/div&gt;&lt;br /&gt;&lt;a href="http://twitter.com/sijmen"&gt;sijmen&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;TypeError: Result of expression this.spoon'&lt;br /&gt;[undefined] is not an object&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/rhizomecowboy"&gt;rhizomecowboy&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;trace(isNAN(prisoner));&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://twitter.com/nail7"&gt;nail7&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;var i = count(MonteChristo);&lt;/pre&gt;&lt;br /&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center; width: 400px; height: 40px;" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/SqjDVAJ1JJI/AAAAAAAABFU/jg8BokOk0S0/s400/code_music.jpg" border="0" alt="#songsincode, lyrics for programmers" id="BLOGGER_PHOTO_ID_5379764520479958162" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2300237154813425913?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2300237154813425913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/09/songsincode-lyrics-for-programmers.html#comment-form' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2300237154813425913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2300237154813425913'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/09/songsincode-lyrics-for-programmers.html' title='#songsincode - Lyrics for Programmers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SqjCsQYP_OI/AAAAAAAABFM/5DSkJKtsBiI/s72-c/songs_in_code.jpg' height='72' width='72'/><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-3228462632883871136</id><published>2009-08-29T14:45:00.000-07:00</published><updated>2010-10-14T15:19:02.309-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='sin'/><title type='text'>My Two Greatest Programming Sins</title><content type='html'>My programming sins are too numerous to count, but there are two which keep coming back to haunt me over and over:&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;version control&lt;/strong&gt; - while developing a program I create multiple versions. Development may split into multiple paths or be backtracked. Without proper version control, confusion is inevitable.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;illegible code&lt;/strong&gt; - I make frequent tweaks and changes, use irrelevant names for labels and functions and fail to comment code. It's unlikely I'll understand the program if I return to it a few weeks later.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Earlier this week I posted an &lt;a href="http://www.retroprogramming.com/2009/08/impenetrable-code.html"&gt;example of ugly code&lt;/a&gt;. By examining the program, the magic numbers or output for sample input, three readers identified the code as an implementation of &lt;a href="http://gurmeetsingh.wordpress.com/2008/08/05/fast-bit-counting-routines/"&gt;parallel bit counting&lt;/a&gt;. Here's how the bit counter ought to have been implemented:&lt;/div&gt;&lt;pre&gt;: (COUNTBITS) ( u1 u2 u3 -- u4 )&lt;br /&gt;( u1 = partial count )&lt;br /&gt;( u2 = power )&lt;br /&gt;( u3 = mask )&lt;br /&gt;( u4 = new partial count )&lt;br /&gt;ROT 2DUP AND &amp;gt;R ROT / AND R&amp;gt; +&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;: COUNTBITS ( u1 -- u2 ) ( parallel count )&lt;br /&gt;( u2 = number of 1 bits in u1 )&lt;br /&gt;2   &amp;#037;101010101010101 (COUNTBITS)&lt;br /&gt;4   &amp;#037;011001100110011 (COUNTBITS)&lt;br /&gt;16  &amp;#037;000011100000111 (COUNTBITS)&lt;br /&gt;256 &amp;#037;000000000001111 (COUNTBITS)&lt;br /&gt;;&lt;/pre&gt;&lt;div&gt;To increase code legibility, the following changes have been made:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;function name now represents the word's behaviour&lt;/li&gt;&lt;li&gt;word factored into two simpler words&lt;/li&gt;&lt;li&gt;documented the word's stack activity&lt;/li&gt;&lt;li&gt;represented the bit masks in binary&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;It's also worth considering what &lt;code&gt;countbits&lt;/code&gt; will be used for (any suggestions?). Do we really need a fast bit twiddling algorithm? A simple iterated count or sparse ones algorithm will probably suffice:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;: COUNTBITS ( u1 -- u2 )( iterated count )&lt;br /&gt;( u2 = number of 1 bits in u1 )&lt;br /&gt;0 SWAP&lt;br /&gt;BEGIN&lt;br /&gt;2 /MOD &amp;gt;R + R&amp;gt;&lt;br /&gt;?DUP 0=&lt;br /&gt;UNTIL&lt;br /&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;: COUNTBITS ( u1 -- u2 ) ( sparse ones )&lt;br /&gt;( u2 = number of 1 bits in u1 )&lt;br /&gt;0 SWAP&lt;br /&gt;BEGIN&lt;br /&gt;?DUP&lt;br /&gt;WHILE&lt;br /&gt;DUP 1- AND &amp;gt;R 1+ R&amp;gt;&lt;br /&gt;REPEAT&lt;br /&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;Now I've identified a couple of faults with my coding technique, I'm hoping to correct my shortcomings while tackling my next programming project. What is your greatest coding sin and how do you plan to deal with it?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-3228462632883871136?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/3228462632883871136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/08/my-two-greatest-programming-sins.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3228462632883871136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3228462632883871136'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/08/my-two-greatest-programming-sins.html' title='My Two Greatest Programming Sins'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-8741971302137837419</id><published>2009-08-25T15:39:00.000-07:00</published><updated>2009-08-25T16:01:42.736-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Impenetrable Code</title><content type='html'>&lt;div&gt;However elegant a programming language, some fool will always find a way to write ugly code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's a word I recently implemented in Forth:&lt;/div&gt;&lt;pre&gt;: C&lt;br /&gt;&gt;R&lt;br /&gt;256 15 16 1799&lt;br /&gt;4 13107 2 21845&lt;br /&gt;R&gt;&lt;br /&gt;4 0 DO&lt;br /&gt;TUCK OVER AND -ROT&lt;br /&gt;INVERT AND ROT / +&lt;br /&gt;LOOP&lt;br /&gt;;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;Although I didn't set out to intentionally create something hideous, I'm appalled by how difficult to understand the code is. How can I make the word easier to comprehend and can you remind me what it's supposed to do?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-8741971302137837419?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/8741971302137837419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/08/impenetrable-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8741971302137837419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8741971302137837419'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/08/impenetrable-code.html' title='Impenetrable Code'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2641608817166661067</id><published>2009-07-25T12:11:00.000-07:00</published><updated>2009-07-28T04:47:30.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Perverse Code: Deviant Forth</title><content type='html'>The Forth programming language has a set of functions (or words) called primitives. These are traditionally written in the language of the host machine to keep the system as simple and efficient as possible. Typically the primitives required no more than about five machine instructions each to implement.&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Deviant Forth explores the possibility of using Forth to implement some of the primitives. Warning, prolonged exposure to this code may cause permanent damage to your eyes!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a exercise, let's implement NIP in Forth:&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;: NIP SWAP DROP ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Standard stuff so far. Now lets try to implement SWAP and DROP!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;: DROP DUP - + ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;pre&gt;: SWAP OVER &gt;R &gt;R DROP R&gt; R&gt; ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Things are beginning to look ugly. On most systems DROP can be implemented in one machine instruction and SWAP in four. It's also possible to implement DUP, + and OVER in Forth:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;: DUP &gt;R R@ R&gt; ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;pre&gt;: + &gt;R DUP DUP - R&gt; - - ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;pre&gt;: OVER &gt;R DUP DUP R@ - DUP &gt;R - R&gt; R&gt; + ;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm no Forth purist, but I feel repelled by the abomination I've programmed. Despite this, it's interesting to discover so many Forth words can be implemented with just &gt;R, R&gt;, R@ and -, however unnatural it might be.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As an afront to the very nature of Forth I challenge you to implement ROT using only &gt;R, R&gt;, R@ and -.  If you can in less than 50 words I'd love to see your solution, however unpleasant :-)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2641608817166661067?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2641608817166661067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/07/perverse-code-deviant-forth.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2641608817166661067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2641608817166661067'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/07/perverse-code-deviant-forth.html' title='Perverse Code: Deviant Forth'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6457424989442185670</id><published>2009-07-09T12:07:00.000-07:00</published><updated>2010-10-15T00:25:04.938-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='robot'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>RobotWar and the Army of Clones</title><content type='html'>&lt;div&gt;Back in 1981 Silas Warner created a game for MUSE Software which would go on to spawn an entire army of clones. Silas is probably better know as the author of the legendary Castle Wolfenstein. However it was RobotWar which went on to inspire a whole new genre.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 280px; height: 192px;" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SlZCzpZQb1I/AAAAAAAAA9E/G4DJbeUQe2M/s400/robotwar2.png" border="0" alt="screenshot: RobotWar, the battlefield of the future" id="BLOGGER_PHOTO_ID_5356542261856333650" /&gt;Silas developed RobotWar for the PLATO computer system and later ported it to the Apple II for release by MUSE. The game is set at a time in the distant future when war has been declared hazardous to human health. Wars still rage, but the combatants are robots programmed to battle to the death.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;RobotWar is played by writing the control program for one of these battle robots. The program controls the movement, radar and gun of the robot. Here's one of the example robots:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;;     ROBOT  'SCANNER'&lt;br /&gt;; SEND RADAR PULSE AND FIRE IF AN&lt;br /&gt;; ENEMY IS SPOTTED&lt;br /&gt;&lt;br /&gt;SCAN&lt;br /&gt;AIM + 7 TO AIM&lt;br /&gt;&lt;br /&gt;CHECK&lt;br /&gt;AIM TO RADAR&lt;br /&gt;IF RADAR &amp;gt; 0 GOTO SCAN&lt;br /&gt;0 - RADAR TO SHOT&lt;br /&gt;GOTO CHECK&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Scanner is a simple stationary warrior. The first instruction (at scan) turns the gun 7° clockwise. The next instruction (at check) lines up the radar with the gun. The radar returns a positive number if it detects nothing, otherwise it returns minus the distance to the opponent.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The next line jumps back to scan if the radar returns positive. Otherwise a shell is fired by the penultimate instruction and the next line jumps back to check.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;RobotWar earned a strong following in the early 1980's. Computer Gaming World organised annual tournaments and a group of enthusiasts formed the Postal RobotWar Club of America.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://corewar.co.uk/robotwar/index.htm"&gt;RobotWar&lt;/a&gt; has inspired a huge number of clones, I'll just mention a select few here:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/crobots/"&gt;CROBOTS&lt;/a&gt; by Tom Poindexter (1985) uses a subset of C&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/probots/"&gt;P-Robots&lt;/a&gt; by David Malmberg (1988) uses a Pascal subset&lt;/li&gt;&lt;li&gt;&lt;a href="http://necrobones.com/atrobots/"&gt;AT-Robots&lt;/a&gt; by Ed T Toten (1992) uses assembly language&lt;/li&gt;&lt;li&gt;&lt;a href="http://robocode.sourceforge.net/"&gt;Robocode&lt;/a&gt; by Mathew Nelson (2001) uses Java&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Robocode is currently the most active. More information is available on the &lt;a href="http://robowiki.net/"&gt;RoboWiki&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please let me know if you think I've missed an important robot programming game or one of historical note. Also I'd love to hear from you if you have any memories of the above.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6457424989442185670?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6457424989442185670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/07/robotwar-and-army-of-clones.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6457424989442185670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6457424989442185670'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/07/robotwar-and-army-of-clones.html' title='RobotWar and the Army of Clones'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SlZCzpZQb1I/AAAAAAAAA9E/G4DJbeUQe2M/s72-c/robotwar2.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-1373354396919780806</id><published>2009-07-02T01:49:00.000-07:00</published><updated>2009-07-02T03:35:44.162-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='home computers'/><title type='text'>Five Computers I Longed to Possess in the 1980s</title><content type='html'>Back in the 1980's I owned a couple of computers, a Commodore 16 and a Spectrum +2. However, this didn't stop me wanting to own a whole range of other machines.&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Jupiter_Ace"&gt;Jupiter Ace&lt;/a&gt;: I loved this from the moment I read about it. A Z80 based micro with a built in Forth interpreter, what more could I desire? Only about 9000 machines were manufactured and I've been waiting patiently ever since for one to come up on eBay.&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Sam_Coupe"&gt;Sam Coupé&lt;/a&gt;: a Sinclair Spectrum clone with 256K memory, a 6MHz Z80, optional internal disk drives and a 25MHz Z80 processor upgrade. Somewhere in the region of 12000 units were sold. A few years ago I picked up one of these at a car boot sale for a fiver! ;-)&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/NeXT_Computer"&gt;NeXT Computer&lt;/a&gt;: from the moment I saw screenshots and read about this workstation built around Motorola's 68030 I knew I had to have one. After seeing the hefty price tag I knew I never would. Even now these sell for a small fortune on eBay.&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Dragon_32/64"&gt;Dragon 64&lt;/a&gt;: the Dragon's 6809 processor looked amazing compared to the 6502 used in most computers of the time. It boasted two stacks, plenty of registers and on chip multiplication. Whenever I wrote code for the 6502 I'd secretly hope to write for the 6809 one day. &lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/KITT"&gt;KITT&lt;/a&gt;: a sentient, artificially intelligent computer built by Knight Industries and installed into a Pontiac Firebird Trans Am. Unfortunately my diecast model came without William Daniels' voice and the cool red lights. If KITT is ever on eBay I'll likely sell my house to buy it!&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Let me know if you think I've missed off any cool machines :-)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-1373354396919780806?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/1373354396919780806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/07/five-computers-i-longed-to-possess-in.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1373354396919780806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1373354396919780806'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/07/five-computers-i-longed-to-possess-in.html' title='Five Computers I Longed to Possess in the 1980s'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4250728217725861601</id><published>2009-06-30T08:38:00.000-07:00</published><updated>2010-03-20T06:57:54.572-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='optimisation'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='compression'/><title type='text'>Executable Compressors</title><content type='html'>An exe packer is a utility to reduce the size of executable files. It compresses a program and creates a new program with the compressed data and code to extract and run the original. Commonly used compression techniques include variants of Run Length Encoding and members of the LZ family of algorithms.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's debatable whether there's still any real benefit to compressing exe files. Originally the reduced storage space would have been an advantage as would the slightly reduced disk (or even tape) load time. Nowadays the potential benefits are lower network bandwidth and smaller downloads.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Exe compressors present some interesting challenges for a programmer. The effectiveness of the compression has to be balanced against the size of the decompressor. The compression algorithm has to be chosen carefully for speedy decompression. If the program has a relocation table, what's the best way to optimise it? How can the additional memory requirements be minimised?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It shouldn't come as any surprise that hundreds of programmers have risen to the challenge and written an exe packer. A quick search of the net turns up at least 80 for DOS / Windows and several for other environments.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In 8086 assembly, a Run Length decoder for a DOS .COM file can be written in under 40 bytes and decoders for the simplest LZ77 derivatives in under 50 bytes. Here's an example RLE decoder:&lt;/div&gt;&lt;pre&gt;; 8086 .COM RLE decoder&lt;br /&gt;&lt;br /&gt;move:   ; copy unpacker and compressed&lt;br /&gt;; code elsewhere in memory&lt;br /&gt;&lt;br /&gt;mov si, unpack&lt;br /&gt;mov di, freemem&lt;br /&gt;mov cx, codeend-unpack&lt;br /&gt;push di&lt;br /&gt;rep movsb&lt;br /&gt;&lt;br /&gt;; setup RLE paremeters&lt;br /&gt;&lt;br /&gt;mov si, freemem+code-unpack&lt;br /&gt;mov di, program&lt;br /&gt;mov bx, num_of_tokens&lt;br /&gt;&lt;br /&gt;; transfer control to unpack&lt;br /&gt;&lt;br /&gt;ret&lt;br /&gt;&lt;br /&gt;; unpack compressed program&lt;br /&gt;&lt;br /&gt;unpack: push di&lt;br /&gt;rle:    lodsb&lt;br /&gt;cmp al, token&lt;br /&gt;jne single&lt;br /&gt;lodsw&lt;br /&gt;mov cl,ah&lt;br /&gt;db 0F3h ; rep&lt;br /&gt;single: stosb&lt;br /&gt;dec bx&lt;br /&gt;jne rle&lt;br /&gt;&lt;br /&gt;; transfer control to program&lt;br /&gt;&lt;br /&gt;ret&lt;br /&gt;&lt;br /&gt;code:   ; .....&lt;br /&gt;&lt;br /&gt;codeend:&lt;br /&gt;&lt;/pre&gt;If you have any thoughts on the advantages / disadvantages of exe packers or any implementation ideas I'd love to hear them. Also does anyone know anything about the history of exe packers? The earliest I've found is from November 1987.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4250728217725861601?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4250728217725861601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/06/stuff-programmers-love-to-play-with-1.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4250728217725861601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4250728217725861601'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/06/stuff-programmers-love-to-play-with-1.html' title='Executable Compressors'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-4694062841806937818</id><published>2009-06-01T13:14:00.000-07:00</published><updated>2009-06-01T14:01:33.585-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forth'/><category scheme='http://www.blogger.com/atom/ns#' term='contest'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Implement MIN in Forth without Conditional Code</title><content type='html'>While lurking in the &lt;a href="irc://irc.freenode.net/#forth"&gt;#forth&lt;/a&gt; channel on irc.freenode.net I was pointed to an interesting problem from the Gforth tutorial. The problem is to implement MIN in Forth without any conditionally executed code.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;DO, LOOP, BEGIN, UNTIL, REPEAT, WHILE, IF, ELSE and THEN are all forbidden.  MIN removes the top two values from the data stack then puts the lower of the two back on.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Can you implement MIN under these conditions? If so I challenge you implement it in as few Forth words as possible! Let me know if your implementation is under 10 words :-)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-4694062841806937818?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/4694062841806937818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/06/implement-min-in-forth-without.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4694062841806937818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/4694062841806937818'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/06/implement-min-in-forth-without.html' title='Implement MIN in Forth without Conditional Code'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-8300206182420444987</id><published>2009-05-22T23:33:00.000-07:00</published><updated>2009-06-01T13:47:32.996-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bf'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='bf joust'/><title type='text'>BF Joust King of the Hill</title><content type='html'>BF Joust is a capture the flag programming game based on the esoteric Brainf*** programming language. Recently ais523 revised the language and enviroment, setting up a king of the hill tournament.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The game is played between two programs on a tape with a length randomly chosen between 10 and 30 cells. The cells initially contain 0 with the exception of the cells at either end which contain the flag 128.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Each program views the tape with their own flag on the left and the opponent's flag on the right. The object of the game is to find and set the opponents flag to 0 and keep it 0 for two consecutive cycles. If a program's pointer points to a location off the tape, it loses.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's a quick summary of the instruction set:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th align="left"&gt;Op&lt;/th&gt;&lt;th align="left"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&amp;lt;&lt;/td&gt;&lt;td&gt;move the pointer to the left&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&amp;gt;&lt;/td&gt;&lt;td&gt;move the pointer to the right&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+&lt;/td&gt;&lt;td&gt;add 1 to the value stored at pointer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;subtract 1 from the value stored at pointer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[&lt;/td&gt;&lt;td&gt;jump past the matching ] if the cell at pointer is 0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;]&lt;/td&gt;&lt;td&gt;jump to instruction after matching [ unless cell at pointer is 0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;.&lt;/td&gt;&lt;td&gt;no operation, do nothing&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;The interpreter also understands certain macros. Instructions inside parentheses are repeated a number of times. For example &lt;code&gt;(&amp;gt;-)*4&lt;/code&gt; expands to &lt;code&gt;&amp;gt;-&amp;gt;-&amp;gt;-&amp;gt;-&lt;/code&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For full details see the rules on the &lt;a href="http://esolangs.org/wiki/BF_Joust"&gt;BF Joust Wiki page&lt;/a&gt; and check the &lt;a href="http://codu.org/eso/bfjoust/report.txt"&gt;current hill standings&lt;/a&gt;. To submit a program to the BF Joust hill, join the channel &lt;a href="irc://irc.freenode.net/#esoteric"&gt;#esoteric on irc.freenode.net&lt;/a&gt; and send a message to egobot:&lt;/div&gt;&lt;pre&gt;/msg egobot !bfjoust program_name program_code&lt;/pre&gt;&lt;div&gt;It isn't possible to remove a program, but it can be replaced by submitting another with the same name.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, I'll leave you with the code for shortsword the current king of the hill with 100% wins ;-)&lt;/div&gt;&lt;div&gt;&lt;pre&gt;(&gt;++&gt;--)*2(&gt;)*6([-[+]]&gt;)*20&lt;/pre&gt;The standings:&lt;br /&gt;&lt;pre&gt;ID Score Pts Program&lt;br /&gt;18 90.00  18 shortsword.bfjoust&lt;br /&gt;19 71.12  12 stranger.bfjoust&lt;br /&gt;16 69.75  11 scythe_impomatic.bfjoust&lt;br /&gt; 1 59.38   9 ais523_attack5.bfjoust&lt;br /&gt; 6 42.50   4 ais523_defend5.bfjoust&lt;br /&gt; 2 41.50   6 ais523_attackslow.bfjoust&lt;br /&gt; 7 38.00   2 asie1.bfjoust&lt;br /&gt; 0 37.00   0 ais523_attack2.bfjoust&lt;br /&gt;12 32.38  -1 fool1.bfjoust&lt;br /&gt; 9 28.00   0 attack1.bfjoust&lt;br /&gt; 4 18.25  -4 ais523_defend0_1.bfjoust&lt;br /&gt; 3 16.25  -5 ais523_defend0.bfjoust&lt;br /&gt;11 11.88  -9 ehirdomatic.bfjoust&lt;br /&gt;10 10.50  -7 defend1.bfjoust&lt;br /&gt; 5 10.50  -5 ais523_defend1.bfjoust&lt;br /&gt;17  5.62  -4 shield.bfjoust&lt;br /&gt;15  5.62  -9 programname.bfjoust&lt;br /&gt;14  2.62 -10 nop.bfjoust&lt;br /&gt; 8  2.62  -8 asie2.bfjoust&lt;br /&gt;20  0.00   0 stuff.bfjoust&lt;br /&gt;13  0.00   0 iwin.bfjoust&lt;br /&gt;&lt;/pre&gt;Let me know if you have any success with BF Joust.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-8300206182420444987?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/8300206182420444987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/05/bf-joust-king-of-hill.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8300206182420444987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8300206182420444987'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/05/bf-joust-king-of-hill.html' title='BF Joust King of the Hill'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-81331347620306366</id><published>2009-05-09T00:21:00.001-07:00</published><updated>2009-05-09T02:28:45.461-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='core war'/><category scheme='http://www.blogger.com/atom/ns#' term='corelife'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='corewar'/><title type='text'>CoreLife: Programming in 2 Dimensions!</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://corewar.co.uk/corelife"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 300px; height: 225px;" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SgUvWSFMWZI/AAAAAAAAA2s/26eHfuI1aKg/s400/snow.png" border="0" alt="CoreLife: programming Corewar in 2 dimensions" /&gt;&lt;/a&gt;&lt;div&gt;For a while I've been promising to take a closer look at Dennis Luehring's &lt;a href="http://aiforge.net/game-links.htm"&gt;list of programming games&lt;/a&gt; to select a few for further investigation. The list contains over 1500 links in 200 categories!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first I've chosen is &lt;a href="http://corewar.co.uk/corelife"&gt;CoreLife&lt;/a&gt;, a 2D variant of Corewar by Brent Adams. CoreLife is one of the earliest 2D programming languages, predating Befunge by a few months.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Battles take place on a 100 × 100 memory grid. The outcome of a battle isn't uniquely determined by the initial conditions as there's a random element to the game.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Unfortunately, there's very little information about CoreLife strategies. There are 13 published battle programs. Most of these launch imps or bomb the grid with protected locations. Battle programs are often surrounded by a membrane or shield of protected locations. Despite this CoreLife has the potential to support more complex programs, for example replicators.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've set myself the challenge of writing a replicator. First I'll attempt to write something linear and if that's successful, a square replicator! Has anyone experimented with CoreLife and if so, did you create a successful program or discover anything interesting?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;For more information about programming games, take a look at Steven Robbins' &lt;a href="http://www.sumost.ca/steve/games"&gt;list of programming games&lt;/a&gt; or Dennis Luehring's &lt;a href="http://aiforge.net/game-links.htm"&gt;list of programming games&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-81331347620306366?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/81331347620306366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/05/corelife-programming-in-2-dimensions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/81331347620306366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/81331347620306366'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/05/corelife-programming-in-2-dimensions.html' title='CoreLife: Programming in 2 Dimensions!'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SgUvWSFMWZI/AAAAAAAAA2s/26eHfuI1aKg/s72-c/snow.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-5891487426301366931</id><published>2009-04-27T01:02:00.001-07:00</published><updated>2010-10-15T00:23:26.452-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><category scheme='http://www.blogger.com/atom/ns#' term='cellular automata'/><title type='text'>The Recursive Universe by William Poundstone</title><content type='html'>&lt;img alt="The Recursive Universe by William Poundstone" border="0" id="BLOGGER_PHOTO_ID_5329278749507456162" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SfVmyXVuDKI/AAAAAAAAA1k/6mNMj8CoPb8/s400/recursive_universe.jpg" style="float: left; height: 270px; margin: 0 10px 10px 0; width: 180px;" /&gt;In &lt;strong&gt;The Recursive Universe&lt;/strong&gt;, William Poundstone uses Conway's Life as a vehicle to explore complexity theory and modern physics. Poundstone demonstrates how simple rules can produce complex results when applied recursively and suspects our own universe was created in a similar manner.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Conway's Game of Life was devised by John Conway in 1970. The Game of Life is played on a grid of square cells, each of which can be in one of two states, dead or alive. Three simple rules are applied repeatedly, first to the initial pattern, then to each new pattern in turn:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;a live cell with less than 2 neighbours dies&lt;/li&gt;&lt;li&gt;a live cell with more than 3 neighbours dies&lt;/li&gt;&lt;li&gt;a dead cell with 3 neighbours becomes a live cell&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Each cell has eight neighbours, 2 horizontally, 2 vertically and 4 diagonally. Conway's Game of Life is also know as 23/3 Life. This indicate a live cell survives if it has 2 or 3 neighbours and a dead cell becomes live if it has 3 neighbours.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The Recursive Universe briefly explores some variations of Life, for example 34/34 Life. I'm currently experimenting with some other variations and will let you know the results shortly.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-5891487426301366931?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/5891487426301366931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/04/recursive-universe-by-william.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5891487426301366931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5891487426301366931'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/04/recursive-universe-by-william.html' title='The Recursive Universe by William Poundstone'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SfVmyXVuDKI/AAAAAAAAA1k/6mNMj8CoPb8/s72-c/recursive_universe.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7554050778399536045</id><published>2009-03-25T10:57:00.000-07:00</published><updated>2009-03-25T11:38:57.910-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bookshelf'/><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>A Quick Look at a Programmer's Bookshelf</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/ScpxLT7nEaI/AAAAAAAAAwU/H5ePLNyuJPw/s1600-h/bookshelf.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 360px;" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/ScpxLT7nEaI/AAAAAAAAAwU/H5ePLNyuJPw/s400/bookshelf.jpg" border="0" alt="my programming books" id="BLOGGER_PHOTO_ID_5317186749207089570" /&gt;&lt;/a&gt;&lt;blockquote&gt;One of the best ways to get to know someone is to look at their bookshelf. -- Kathy Sierra&lt;/blockquote&gt;Here's a quick look at the programming section of the bookshelf next to my desk. It reflects my current interests pretty well:&lt;div&gt;&lt;ul&gt;&lt;li&gt;algorithms, Knuth and Introduction to Algorithms&lt;/li&gt;&lt;li&gt;compilers, including the red and green dragon books&lt;/li&gt;&lt;li&gt;operating system development&lt;/li&gt;&lt;li&gt;artificial life&lt;/li&gt;&lt;li&gt;assembly language, books on 68000, 8086 and 6809&lt;/li&gt;&lt;li&gt;computer history, Hackers and Fire in the Valley&lt;/li&gt;&lt;li&gt;web development&lt;/li&gt;&lt;/ul&gt;What's on your bookshelf?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7554050778399536045?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7554050778399536045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/03/quick-look-at-programmers-bookshelf.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7554050778399536045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7554050778399536045'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/03/quick-look-at-programmers-bookshelf.html' title='A Quick Look at a Programmer&apos;s Bookshelf'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/ScpxLT7nEaI/AAAAAAAAAwU/H5ePLNyuJPw/s72-c/bookshelf.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2850048535402287480</id><published>2009-03-11T06:51:00.001-07:00</published><updated>2009-03-11T07:02:14.860-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='microcontroller'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Playing with the Arduino Microcontroller Board</title><content type='html'>&lt;div&gt;Here are a couple of pictures of my latest toy, the Arduino Duemilanove microcontroller. It's equipped with 16K flash memory, 1K SRAM and 0.5K EEPROM and is currently sitting on my desk, flashing out "hello world" in Morse Code. The processor is an Atmel ATMega168 running at 16MHz.&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SbfCQI2oczI/AAAAAAAAAvU/YNdyFwCNPkM/s1600-h/microcontroller_arduino_duemilanove.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SbfCQI2oczI/AAAAAAAAAvU/YNdyFwCNPkM/s400/microcontroller_arduino_duemilanove.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5311927868017111858" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SbfCPwFgnxI/AAAAAAAAAvM/qKu8MopHgMk/s1600-h/reverse_arduino_duemilanove.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SbfCPwFgnxI/AAAAAAAAAvM/qKu8MopHgMk/s400/reverse_arduino_duemilanove.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5311927861368626962" /&gt;&lt;/a&gt;Now I just need to learn the assembly language so I can implement something useful :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2850048535402287480?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2850048535402287480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/03/playing-with-arduino-microcontroller.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2850048535402287480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2850048535402287480'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/03/playing-with-arduino-microcontroller.html' title='Playing with the Arduino Microcontroller Board'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SbfCQI2oczI/AAAAAAAAAvU/YNdyFwCNPkM/s72-c/microcontroller_arduino_duemilanove.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-890697624101010720</id><published>2009-02-06T01:17:00.000-08:00</published><updated>2009-05-22T23:32:07.762-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bf'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='bf joust'/><title type='text'>Hostile Programming on the BF Joust Hill</title><content type='html'>For the past couple of days I've been playing on the &lt;a href="http://faculty.washington.edu/kerim/nomic/bf/"&gt;BF Joust Hill&lt;/a&gt;. BF (or Brainf***) is a simple programming language with 8 instructions as follows:&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th align="left"&gt;Op&lt;/th&gt;&lt;th align="left"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&amp;lt;&lt;/td&gt;&lt;td&gt;move pointer to the left&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&amp;gt;&lt;/td&gt;&lt;td&gt;move pointer to the right&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+&lt;/td&gt;&lt;td&gt;increment the value stored at pointer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td&gt;decrement the value stored at pointer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[&lt;/td&gt;&lt;td&gt;jump past the matching ] if the cell at pointer is 0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;]&lt;/td&gt;&lt;td&gt;jump to the matching [&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;,&lt;/td&gt;&lt;td&gt;character input (not used by BF Joust)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;.&lt;/td&gt;&lt;td&gt;character output (not used by BF Joust)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;The object of the game is to capture the flag. The size of memory is chosen at random in the range 135 - 167. Memory is initialise to 0. Both flags are set to 128. Your flag is at the far left end of memory, the opponent's flag is to the right.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The object is to set the opponent's flag to 0. If your flag is set to 0, or your pointer runs off either end of memory, you lose.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A simple strategy would be to keep moving right, setting any non-zero memory to 0:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;[&amp;gt;[-]-]&lt;br /&gt;&lt;/pre&gt;Against the last 15 warriors on BF Joust, this scores 76. The maximum score is 300.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What would happen if we build a decoy to slow down the opponent? We could set a few non-zero memory cells next to the flag:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-[&amp;gt;[-]-]&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;The new score is 103. Some memory cells are incremented to 1, others are decremented to -1 (255). It doesn't matter whether the opponent is using &lt;code&gt;[-]&lt;/code&gt; or &lt;code&gt;[+]&lt;/code&gt; to set memory to zero, it will be delayed for hundreds of cycles.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;How can we avoid wasting time if the opponent has a similar decoy? One technique is to increment the memory cell just before entering the decrement loop:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-&amp;gt;+&amp;gt;-[&amp;gt;+[-]-]&lt;/pre&gt;If there's a -1 decoy, it's changed to 0 and the &lt;code&gt;[-]&lt;/code&gt; loop is never executed. The new code scores 140.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can prevent the opponent from benefiting from a similar technique as follows:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---[&amp;gt;+[-]-]&lt;/pre&gt;This scores 181 :-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, we know the enemy's flag is in the memory range 135-167. We can quickly skip ahead to location 135:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&amp;gt;+++&amp;gt;---&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;+[&amp;gt;+[-]-]&lt;/pre&gt;Scoring 209!&lt;/div&gt;&lt;div&gt;&lt;pre&gt;Rank             Program  TOT&lt;br /&gt;-----------------------------&lt;br /&gt;  1      woggle_050109_2  246&lt;br /&gt;  2              joust12  240&lt;br /&gt;  3      woggle_050109_1  228&lt;br /&gt;  4      woggle_060109_3  213&lt;br /&gt;* 5           Challenger  209&lt;br /&gt;  6      wooble_231208_2  188&lt;br /&gt;  7       ehird_060109_1  143&lt;br /&gt;  8    BPilgrim_271208_1  132&lt;br /&gt;  9      wooble_191208_1  130&lt;br /&gt; 10      ais523_201208_1  121&lt;br /&gt; 11       ehird_201208_4  103&lt;br /&gt; 12    BPilgrim_271208_2   77&lt;br /&gt; 13       ehird_191208_3   55&lt;br /&gt; 14       comex_241208_1   46&lt;br /&gt; 15       comex_241208_3   16&lt;br /&gt; 16       comex_241208_2   16&lt;br /&gt;-----------------------------&lt;/pre&gt;Let me know if you've discovered a better technique, or if you can beat 209.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-890697624101010720?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/890697624101010720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/02/bf-joust-hill.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/890697624101010720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/890697624101010720'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/02/bf-joust-hill.html' title='Hostile Programming on the BF Joust Hill'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-7963018420770530622</id><published>2009-01-18T09:25:00.000-08:00</published><updated>2009-01-18T11:09:06.347-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='urisc'/><category scheme='http://www.blogger.com/atom/ns#' term='rssb'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><category scheme='http://www.blogger.com/atom/ns#' term='oisc'/><title type='text'>Hello World for the RSSB Virtual Computer</title><content type='html'>The &lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;RSSB&lt;/acronym&gt; virtual computer has a single instruction, reverse subtract and skip if borrow. Each instruction has one operand, a pointer into memory. &lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;RSSB&lt;/acronym&gt; subtracts the accumulator from the contents of memory and the result is stored in both. If the accumulator was greater than the number in memory, the next instruction is skipped.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;Jumps can be implemented by manipulating the instruction pointer at memory location 0, which normally requires 4 instructions. A conditional jump requires 6 instructions. Other special locations are as follows:&lt;/div&gt;&lt;ol&gt;&lt;li&gt;accumulator&lt;/li&gt;&lt;li&gt;always contains 0&lt;/li&gt;&lt;li&gt;character input&lt;/li&gt;&lt;li&gt;character output&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;The four lines of code below demonstrate the shortest jump:&lt;/div&gt;&lt;pre&gt;        rssb   acc       ; set acc to 0&lt;br /&gt;        rssb   $+2       ; set acc to loop offset&lt;br /&gt;        rssb   ip        ; subtract acc from ip&lt;br /&gt;        rssb   $-loop    ; the loop offset&lt;/pre&gt;&lt;div&gt;The code below implements hello world for the &lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;RSSB&lt;/acronym&gt; virtual computer. The sum deserves an explanation. Each character is subtracted from sum until sum passes zero, indicating all character have been printed. The final value of sum is the offset required by the conditional jump!&lt;/div&gt;&lt;pre&gt;loop    rssb   acc       ; acc = character from ptr&lt;br /&gt;ptr     rssb   hello        &lt;br /&gt;&lt;br /&gt;        rssb   out       ; display character&lt;br /&gt;&lt;br /&gt;        rssb   zero      ; acc = -acc&lt;br /&gt;&lt;br /&gt;        rssb   zero      ; always skipped&lt;br /&gt;&lt;br /&gt;        rssb   sum       ; subtract acc from sum&lt;br /&gt;&lt;br /&gt;        rssb   ip        ; skipped if sum is &lt;0&lt;br /&gt;                         ; otherwise jump to 0&lt;br /&gt;&lt;br /&gt;one     rssb   acc       ; subtract 1 from ptr&lt;br /&gt;        rssb   one&lt;br /&gt;        rssb   ptr&lt;br /&gt;&lt;br /&gt;        rssb   acc       ; jump to loop&lt;br /&gt;        rssb   loopoff&lt;br /&gt;        rssb   ip&lt;br /&gt;loopoff rssb   $-loop&lt;br /&gt;&lt;br /&gt;sum     rssb   -1116&lt;br /&gt;&lt;br /&gt;        rssb   33        ; '!'&lt;br /&gt;        rssb   100       ; 'd'&lt;br /&gt;        rssb   108       ; 'l'&lt;br /&gt;        rssb   114       ; 'r'&lt;br /&gt;        rssb   111       ; 'o'&lt;br /&gt;        rssb   87        ; 'W'&lt;br /&gt;        rssb   32        ; ' '&lt;br /&gt;        rssb   44        ; ','&lt;br /&gt;        rssb   111       ; 'o'&lt;br /&gt;        rssb   108       ; 'l'&lt;br /&gt;        rssb   108       ; 'l'&lt;br /&gt;        rssb   101       ; 'e'&lt;br /&gt;hello   rssb   72        ; 'H'&lt;/pre&gt;&lt;div&gt;If you can improve the code above, or you've seen any other programs inplemented with &lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;RSSB&lt;/acronym&gt;, please leave a message below.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-7963018420770530622?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/7963018420770530622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/01/hello-world-for-rssb-virtual-computer.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7963018420770530622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/7963018420770530622'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/01/hello-world-for-rssb-virtual-computer.html' title='Hello World for the RSSB Virtual Computer'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-8295256438619803535</id><published>2009-01-15T03:18:00.000-08:00</published><updated>2009-01-25T06:47:15.695-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='urisc'/><category scheme='http://www.blogger.com/atom/ns#' term='subleq'/><category scheme='http://www.blogger.com/atom/ns#' term='sbn'/><category scheme='http://www.blogger.com/atom/ns#' term='subneg'/><category scheme='http://www.blogger.com/atom/ns#' term='rssb'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='oisc'/><title type='text'>The Ultimate RISC, One Instruction Set Computers</title><content type='html'>A One Instruction Set Computer is a virtual computer designed to use only one instruction. There are two common methods to implement a &lt;acronym title="One Instruction Set Computer"&gt;OISC&lt;/acronym&gt;:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Reverse Subtract and Skip if Borrow&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The instruction has one operand which points to a memory location. The program counter is stored at location 0 and the accumulator at location 1. Location 2 always contains zero, location 3 is used for input and location 4 for output.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;&lt;/acronym&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;acronym title="Reverse Subtract and Skip if Borrow"&gt;RSSB&lt;/acronym&gt; subtracts the accumulator from the contents of a memory location, storing the result in both.  If the accumulator was greater than the memory location, the next instruction will be skipped. Jumps can be implemented by manipulating location 0.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Subtract and Branch if Negative&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;acronym title="Subtract and Branch if Negative"&gt;SBN&lt;/acronym&gt; requires three operands, &lt;i&gt;a&lt;/i&gt;, &lt;i&gt;b&lt;/i&gt; and &lt;i&gt;c&lt;/i&gt;.  The contents of memory location &lt;i&gt;a&lt;/i&gt; is subtracted from the contents of &lt;i&gt;b&lt;/i&gt; and the result is stored in &lt;i&gt;b&lt;/i&gt;. If the value originally stored in &lt;i&gt;a&lt;/i&gt; was greater than the value in &lt;i&gt;b&lt;/i&gt;, &lt;acronym title="Subtract and Branch if Negative"&gt;SBN&lt;/acronym&gt; will jump to &lt;i&gt;c&lt;/i&gt;. A variation on the theme is Subtract and Branch unless Positive.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll publish my implementation in &lt;a href="http://corewar.co.uk"&gt;Redcode&lt;/a&gt; shortly. In the meantime, why not take a look at projects listed below. If you're aware of any other implementations, please leave a comment with the details.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://bitstuff.blogspot.com/2007/02/subtract-and-branch-if-negative.html"&gt;Luke Valenty&lt;/a&gt; built a &lt;acronym title="Subtract and Branch if Negative"&gt;SBN&lt;/acronym&gt; machine using 7400 series logic gates&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://eigenratios.blogspot.com/2006/09/mark-ii-oisc-self-interpreter.html"&gt;Clive Gifford&lt;/a&gt; has written a &lt;acronym title="Subtract and Branch unless Positive"&gt;SUBLEQ&lt;/acronym&gt; self-interpreter&lt;/li&gt;&lt;li&gt;&lt;a href="http://mazonka.com/subleq/"&gt;Oleg Mazonka&lt;/a&gt; implemented a &lt;acronym title="Subtract and Branch unless Positive"&gt;SUBLEQ&lt;/acronym&gt; interpreter in C++&lt;/li&gt;&lt;li&gt;&lt;a href="http://safalra.com/programming/esoteric-languages/misc/"&gt;Safalra&lt;/a&gt; has designed a variation called &lt;acronym title="Minimal Instruction Set Computer"&gt;MISC&lt;/acronym&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-8295256438619803535?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/8295256438619803535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2009/01/ultimate-risc-one-instruction-set.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8295256438619803535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/8295256438619803535'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2009/01/ultimate-risc-one-instruction-set.html' title='The Ultimate RISC, One Instruction Set Computers'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6796156411140443832</id><published>2008-12-16T14:29:00.000-08:00</published><updated>2008-12-16T23:59:20.445-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='demo'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='128b'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>What can you Write in 128 Bytes?</title><content type='html'>&lt;div&gt;In contrast to the ever increasing memory available, a number of programmers are choosing to demonstrate their coding prowess by squeezing as much as possible into an incredibly tiny program. It has become a popular passtime to code an impessive graphical display in either 128 or 256 bytes.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before zooming off to try this for yourself, why not check out some of the competition? Five of the best are listed below, and also my own contribution.&lt;/div&gt;&lt;div&gt;&lt;hr style="clear: left"&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=32928"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7fxYLtpI/AAAAAAAAAic/AI-Jb6JRvqU/s400/oko.jpg" border="0" alt="OKO" id="BLOGGER_PHOTO_ID_5280535980108658322" /&gt;&lt;/a&gt;OKO by Ind. The coloured rings sway gently. Good use of colour.&lt;hr style="clear: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=29601"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7fxvdaiI/AAAAAAAAAiU/pIUVFXcEg_M/s400/interference.jpg" border="0" alt="Interference" id="BLOGGER_PHOTO_ID_5280535980206287394" /&gt;&lt;/a&gt;Interference by New Generation Crew. A fast moving interference pattern between two sets of rings. Supplied with source code.&lt;hr style="clear: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=51765"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7fcf2iZI/AAAAAAAAAiM/gAHG25Eqd4Q/s400/ctverecky.jpg" border="0" alt="Ctverecky" id="BLOGGER_PHOTO_ID_5280535974503680402" /&gt;&lt;/a&gt;Ctverecky by RRRola. A chaotic, spiralling pattern. Only 93 bytes long. Supplied with source code.&lt;hr style="clear: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=27113"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7fGpkldI/AAAAAAAAAiE/GiDv10YsXA0/s400/corkscrew.jpg" border="0" alt="Corkscrewed" id="BLOGGER_PHOTO_ID_5280535968638866898" /&gt;&lt;/a&gt;Corkscrewed by lord Kelvin - a smooth, gentle swirl slowly draws you in. Great use of colour. Supplied with source code.&lt;hr style="clear: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=29015"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7ev6pqdI/AAAAAAAAAh8/WEf_cZOGRgU/s400/colordream.JPG" border="0" alt="Color Dream" id="BLOGGER_PHOTO_ID_5280535962536487378" /&gt;&lt;/a&gt;Color Dream by Digimind - a chaotic looking swarm of spheres. Impressive in motion.&lt;hr style="clear: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://pouet.net/prod.php?which=17702"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 100px;" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/SUij8-LmXII/AAAAAAAAAik/0ogeXaD9nZY/s400/plaswave.jpg" border="0" alt="Plasma Wave" id="BLOGGER_PHOTO_ID_5280650830971034754" /&gt;&lt;/a&gt;Plasma Wave by John Metcalf - my own contribution. A display of flowing plasma. Supplied with source code.&lt;hr style="clear: left"&gt;&lt;div&gt;If there's a program you think I should have included, or you want to show off your own demo, please leave a comment below.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6796156411140443832?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6796156411140443832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/12/what-can-you-write-in-128-bytes.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6796156411140443832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6796156411140443832'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/12/what-can-you-write-in-128-bytes.html' title='What can you Write in 128 Bytes?'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kDyMtZ_dJwQ/SUg7fxYLtpI/AAAAAAAAAic/AI-Jb6JRvqU/s72-c/oko.jpg' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-3121365075483729153</id><published>2008-11-17T00:02:00.000-08:00</published><updated>2010-07-15T11:23:27.961-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='core war'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='corewar'/><title type='text'>Core War - Hostile Programming</title><content type='html'>Core War is a game from the 80's, played between computer programs written in Redcode, a language similar to assembly.  The programmers design their battle programs to remove opponents from the memory of the &lt;acronym title="Memory Array Redcode Simulator"&gt;MARS&lt;/acronym&gt; virtual computer by any means possible.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some of the simpler techniques include blindly overwriting memory, searching for the opponent or spawning off new processes. These are commonly known as stone, scissors, paper after the popular playground game.  Stone usually wins against scissors, scissors normally defeat paper, and paper mostly beats stone.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's an example of a typical Core War program:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;org   wipe&lt;br /&gt;&lt;br /&gt;step  equ 5&lt;br /&gt;first equ bomb-10&lt;br /&gt;&lt;br /&gt;bomb:mov.i #1,       -1&lt;br /&gt;&lt;br /&gt;ptr: sub   #step,    #first&lt;br /&gt;wipe:jmz.f ptr,      @ptr&lt;br /&gt;&lt;br /&gt;mov   bomb,     &gt;ptr&lt;br /&gt;djn.f wipe,     {ptr-5&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;This simple example of scissors once held a 20 point lead over it's rivals. The first instruction is never executed, it's the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;bomb&lt;/span&gt; used to overwrite opponents.  The next two instructions form a loop which look through memory for an opponent, and the final two instructions actually overwrite it.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Core War is still going strong, and celebrates it's 25th anniversary in 2009. If you'd like to discover more about Core War, here are the top resources:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://vyznev.net/corewar/guide.html"&gt;The Beginner's Guide to Redcode&lt;/a&gt; will teach you the language of Core War&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/pmars"&gt;pMARS&lt;/a&gt; is a portable implementation of the Core War virtual machine&lt;/li&gt;&lt;li&gt;&lt;a href="http://corewar.co.uk/guides.htm"&gt;Core War Tutorials&lt;/a&gt; exist on virtually every aspect of the game&lt;/li&gt;&lt;li&gt;&lt;a href="http://users.obs.carnegiescience.edu/birk/COREWAR/koenigstuhl.html"&gt;Koenigstuhl&lt;/a&gt; is an archive of thousands of published Core War programs&lt;/li&gt;&lt;li&gt;&lt;a href="http://sal.math.ualberta.ca/"&gt;SAL&lt;/a&gt; organises a number of on-going king of the hill tournaments&lt;/li&gt;&lt;li&gt;&lt;a href="http://sfghoul.blogspot.com/"&gt;sfghoul&lt;/a&gt; and &lt;a href="http://impomatic.blogspot.com/"&gt;impomatic&lt;/a&gt; report the latest Core War news on their blogs&lt;/li&gt;&lt;li&gt;&lt;a href="irc://irc.freenode.net/#COREWARS"&gt;#corewars&lt;/a&gt; is the official Core War discussion channel, hosted by &lt;a href="irc://irc.freenode.net/#COREWARS"&gt;irc.freenode.net&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;What are your experiences with Core War, have you ever had any success?&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-3121365075483729153?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/3121365075483729153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/11/core-war-hostile-programming.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3121365075483729153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3121365075483729153'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/11/core-war-hostile-programming.html' title='Core War - Hostile Programming'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-9044694149220896188</id><published>2008-10-26T02:44:00.000-07:00</published><updated>2010-10-15T00:16:36.003-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cave'/><category scheme='http://www.blogger.com/atom/ns#' term='semaphore'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='redcode'/><category scheme='http://www.blogger.com/atom/ns#' term='koch curve'/><category scheme='http://www.blogger.com/atom/ns#' term='z80'/><title type='text'>Programming in Strange Places!</title><content type='html'>Earlier this month I spent a week in Cornwall without access to a computer. In the true spirit of recreational programmers everywhere, this didn't curtail my programming activity. I managed to discover a number of solutions to the &lt;a href="http://impomatic.blogspot.com/2008/10/more-semaphores-in-redcode.html"&gt;Semaphore Problem in Redcode&lt;/a&gt; while watching the waves!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, programming on the beach, public transport, restaurants and even a theme park appear pretty normal alongside the place where I wrote Koch Curve for the Sinclair Spectrum.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One October night 14 years ago I took shelter from the wind and rain in &lt;a href="http://caving.atspace.com/victoria.html"&gt;Victoria Cave&lt;/a&gt;.  After setting up for the night and studying the map, I eventually tried to code an idea I'd had a few days earlier.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Working by candlelight on scraps of paper I programmed, optimized and hand assembled Koch Curve for the Speccy's Z80. Perhaps the surroundings explain the strange names I used for labels!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What's the strangest place you've written a program? I'd love to know.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;img style="width: 264px; height: 200px;" src="http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SQRgnaVfvjI/AAAAAAAAAW8/O4bq4yIjeEk/s400/victoria.jpg" border="0" alt="Victoria Cave, near Settle" id="BLOGGER_PHOTO_ID_5261436494876229170" /&gt;&lt;img style="width: 264px; height: 200px;" src="http://4.bp.blogspot.com/_kDyMtZ_dJwQ/SQRgnX_4vkI/AAAAAAAAAXE/G_VLa10m1fY/s400/koch.png" border="0" alt="Koch Curve on the Sinclair Spectrum" id="BLOGGER_PHOTO_ID_5261436494248721986" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-9044694149220896188?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/9044694149220896188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/10/programming-in-strange-places.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9044694149220896188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/9044694149220896188'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/10/programming-in-strange-places.html' title='Programming in Strange Places!'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kDyMtZ_dJwQ/SQRgnaVfvjI/AAAAAAAAAW8/O4bq4yIjeEk/s72-c/victoria.jpg' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-5253529032199087784</id><published>2008-09-21T00:01:00.000-07:00</published><updated>2008-09-21T00:37:40.338-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='8088'/><category scheme='http://www.blogger.com/atom/ns#' term='optimisation'/><category scheme='http://www.blogger.com/atom/ns#' term='optimise'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='z80'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>Optimising Assembly Like an 80's Hacker</title><content type='html'>Forget about fancy algorithms and data structures. If you want respect as an 80's hacker, follow these simple tips.&lt;br /&gt;&lt;br /&gt;Never get caught setting a register to zero without using xor:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Z80 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;ld a,0           ; bad, 2 bytes / 7 cycles&lt;br /&gt;&lt;br /&gt;xor a            ; good, 1 byte / 4 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;8088 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;mov ax,0         ; bad, 3 bytes / 4 cycles&lt;br /&gt;&lt;br /&gt;xor ax,ax        ; good, 2 bytes / 3 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Never set two 8 bit register independently. Code readability is not required:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Z80 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;ld b,10          ; bad, 4 bytes / 14 cycles&lt;br /&gt;ld c,32&lt;br /&gt;&lt;br /&gt;ld bc,10*256+32  ; good, 3 bytes / 11 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;8088 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;mov ch,10        ; bad, 4 bytes / 8 cycles&lt;br /&gt;mov cl,32&lt;br /&gt;&lt;br /&gt;mov cx,10*256+32 ; good, 3 bytes / 4 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Never compare to zero:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Z80 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;cp 0             ; bad, 2 bytes / 7 cycles&lt;br /&gt;&lt;br /&gt;or a             ; good, 1 byte / 4 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;8088 Code&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;cmp ax,0         ; bad, 3 bytes / 4 cycles&lt;br /&gt;&lt;br /&gt;test ax,ax       ; good, 2 bytes / 3 cycles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Remember, you don't need to worry about code alignment, order of instructions or processor penalties.  Follow these simple tips and your super-optimised bubble sort will demand the utmost respect!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-5253529032199087784?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/5253529032199087784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/09/optimising-assembly-like-80s-hacker.html#comment-form' title='34 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5253529032199087784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/5253529032199087784'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/09/optimising-assembly-like-80s-hacker.html' title='Optimising Assembly Like an 80&apos;s Hacker'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>34</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-3283675412019218546</id><published>2008-09-12T07:22:00.000-07:00</published><updated>2010-10-15T00:17:16.519-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='primes'/><category scheme='http://www.blogger.com/atom/ns#' term='contest'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Al Zimmermann's Programming Contests</title><content type='html'>Normally I don't participate in programming challenges, but something about the latest of &lt;a href="http://www.azspcs.net"&gt;Al Zimmermann's Programming Contests&lt;/a&gt; caught my attention.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The idea is to submit sets of numbers so their combination by addition and subtraction generates the most distinct primes.  There are 12 problems, for sets of 3 to 14 numbers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A pen and paper should be sufficient to find the optimal solution for 3 numbers.  Don't be fooled however, the solutions for 4+ require a program to search through the possibilities.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4 yields easily to a computer search with at least three optimal solutions waiting to be discovered.  Despite writing a program which tests 280,000 potential solutions per second, I haven't found the top solution for 5.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Currently I'm restricting the search space to one odd number, one multiple of 6 and the remaining numbers all multiples of 30.  Maybe this is too restrictive?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's the program I'm using.  Any suggestions how I can improve the speed?&lt;/div&gt;&lt;pre&gt;n1 equ 1&lt;br /&gt;n2 equ 6&lt;br /&gt;n3 equ 30&lt;br /&gt;n4 equ 90&lt;br /&gt;n5 equ 270&lt;br /&gt;&lt;br /&gt;i1 equ 600&lt;br /&gt;i2 equ 600&lt;br /&gt;&lt;br /&gt;vprime equ 7000&lt;br /&gt;&lt;br /&gt;numb equ 5&lt;br /&gt;&lt;br /&gt;; *** generate list of primes&lt;br /&gt;&lt;br /&gt;mov si,prime+4&lt;br /&gt;mov bx,5&lt;br /&gt;nextpr:&lt;br /&gt;mov di,prime+2&lt;br /&gt;try:&lt;br /&gt;mov ax,bx&lt;br /&gt;xor dx,dx&lt;br /&gt;div word[di]&lt;br /&gt;or dx,dx&lt;br /&gt;jz notpr&lt;br /&gt;scasw&lt;br /&gt;ja try&lt;br /&gt;mov word[si],bx&lt;br /&gt;cmpsw&lt;br /&gt;notpr:&lt;br /&gt;inc bx&lt;br /&gt;inc bx&lt;br /&gt;cmp si,prime+vprime&lt;br /&gt;jne nextpr&lt;br /&gt;&lt;br /&gt;; *** fill prime table with zero&lt;br /&gt;&lt;br /&gt;xchg ax,bx&lt;br /&gt;mov di,tabl&lt;br /&gt;xchg ax,cx&lt;br /&gt;xor ax,ax&lt;br /&gt;rep stosb&lt;br /&gt;&lt;br /&gt;; *** update values to test&lt;br /&gt;&lt;br /&gt;testnew:&lt;br /&gt;add word[xa],2&lt;br /&gt;cmp word[xa],n1+i1+10&lt;br /&gt;jc gogo&lt;br /&gt;mov word[xa],n1&lt;br /&gt;&lt;br /&gt;add word[xb],6&lt;br /&gt;cmp word[xb],n2+i2+10&lt;br /&gt;jc gogo&lt;br /&gt;mov word[xb],n2&lt;br /&gt;&lt;br /&gt;add word[xc],30&lt;br /&gt;mov ax,word[xc]&lt;br /&gt;cmp ax,word[xd]&lt;br /&gt;jc gogo&lt;br /&gt;mov word[xc],n3&lt;br /&gt;&lt;br /&gt;add word[xd],30&lt;br /&gt;mov ax,word[xd]&lt;br /&gt;cmp ax,word[xe]&lt;br /&gt;jc gogo&lt;br /&gt;mov word[xd],n4&lt;br /&gt;&lt;br /&gt;add word[xe],30&lt;br /&gt;&lt;br /&gt;; *** mark primes in table&lt;br /&gt;&lt;br /&gt;gogo:&lt;br /&gt;mov ax,word[xa]&lt;br /&gt;add ax,word[xe]&lt;br /&gt;add ax,word[xd]&lt;br /&gt;add ax,word[xc]&lt;br /&gt;add ax,word[xb]&lt;br /&gt;xchg dx,ax&lt;br /&gt;mov si,prime&lt;br /&gt;ptab:&lt;br /&gt;lodsw&lt;br /&gt;cmp dx,ax&lt;br /&gt;jc fini&lt;br /&gt;add ax,tabl&lt;br /&gt;xchg bx,ax&lt;br /&gt;mov byte[bx],1&lt;br /&gt;cmp si,prime+vprime&lt;br /&gt;jne ptab&lt;br /&gt;fini:&lt;br /&gt;&lt;br /&gt;; *** test&lt;br /&gt;&lt;br /&gt;xor bp,bp&lt;br /&gt;mov ax,word[xa]&lt;br /&gt;mov bx,word[xe]&lt;br /&gt;mov cx,word[xd]&lt;br /&gt;mov dx,word[xc]&lt;br /&gt;mov di,word[xb]&lt;br /&gt;&lt;br /&gt;call x2&lt;br /&gt;&lt;br /&gt;; *** if there's a new top score...&lt;br /&gt;&lt;br /&gt;xchg ax,bp&lt;br /&gt;cmp ax,word[xhigh]&lt;br /&gt;jl next&lt;br /&gt;&lt;br /&gt;; *** ... display the winning numbers&lt;br /&gt;&lt;br /&gt;mov word[xhigh],ax&lt;br /&gt;call printdec&lt;br /&gt;&lt;br /&gt;mov dl,' '&lt;br /&gt;call printchar&lt;br /&gt;mov dl,'-'&lt;br /&gt;call printchar&lt;br /&gt;&lt;br /&gt;mov cx,numb&lt;br /&gt;lea si,word[xa]&lt;br /&gt;disp:&lt;br /&gt;mov dl,' '&lt;br /&gt;call printchar&lt;br /&gt;lodsw&lt;br /&gt;call printdec&lt;br /&gt;loop disp&lt;br /&gt;&lt;br /&gt;mov dl,0D&lt;br /&gt;call printchar&lt;br /&gt;mov dl,0A&lt;br /&gt;call printchar&lt;br /&gt;&lt;br /&gt;; *** and repeat&lt;br /&gt;&lt;br /&gt;next:&lt;br /&gt;mov ah,1&lt;br /&gt;int 016h&lt;br /&gt;jz redo&lt;br /&gt;int 020h&lt;br /&gt;redo:&lt;br /&gt;jmp testnew&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;x2:&lt;br /&gt;push ax&lt;br /&gt;add ax,bx&lt;br /&gt;call x3&lt;br /&gt;pop ax&lt;br /&gt;push ax&lt;br /&gt;sub ax,bx&lt;br /&gt;call x3&lt;br /&gt;pop ax&lt;br /&gt;&lt;br /&gt;x3:&lt;br /&gt;push ax&lt;br /&gt;add ax,cx&lt;br /&gt;call x4&lt;br /&gt;pop ax&lt;br /&gt;push ax&lt;br /&gt;sub ax,cx&lt;br /&gt;call x4&lt;br /&gt;pop ax&lt;br /&gt;&lt;br /&gt;x4:&lt;br /&gt;push ax&lt;br /&gt;add ax,dx&lt;br /&gt;call x5&lt;br /&gt;pop ax&lt;br /&gt;push ax&lt;br /&gt;sub ax,dx&lt;br /&gt;call x5&lt;br /&gt;pop ax&lt;br /&gt;&lt;br /&gt;x5:&lt;br /&gt;push ax&lt;br /&gt;add ax,di&lt;br /&gt;call x6&lt;br /&gt;pop ax&lt;br /&gt;push ax&lt;br /&gt;sub ax,di&lt;br /&gt;call x6&lt;br /&gt;pop ax&lt;br /&gt;&lt;br /&gt;x6:&lt;br /&gt;xabs:&lt;br /&gt;neg ax&lt;br /&gt;js xabs&lt;br /&gt;add ax,tabl&lt;br /&gt;xchg ax,si&lt;br /&gt;cmp byte[si],0&lt;br /&gt;je notprx&lt;br /&gt;inc bp&lt;br /&gt;mov byte[si],0&lt;br /&gt;notprx:&lt;br /&gt;xchg ax,si&lt;br /&gt;ret&lt;br /&gt;&lt;br /&gt;; *** print number in ax&lt;br /&gt;&lt;br /&gt;printdec:&lt;br /&gt;push ax&lt;br /&gt;push cx&lt;br /&gt;push dx&lt;br /&gt;mov cx,10&lt;br /&gt;xor dx,dx&lt;br /&gt;div cx&lt;br /&gt;test ax,ax&lt;br /&gt;je pdbye&lt;br /&gt;call printdec&lt;br /&gt;pdbye:&lt;br /&gt;add dl,'0'&lt;br /&gt;call printchar&lt;br /&gt;pop dx&lt;br /&gt;pop cx&lt;br /&gt;pop ax&lt;br /&gt;ret&lt;br /&gt;&lt;br /&gt;printchar:&lt;br /&gt;mov ah,2&lt;br /&gt;int 021&lt;br /&gt;ret&lt;br /&gt;&lt;br /&gt;xhigh:dw 0&lt;br /&gt;&lt;br /&gt;xa:dw n1-2&lt;br /&gt;xb:dw n2&lt;br /&gt;xc:dw n3&lt;br /&gt;xd:dw n4&lt;br /&gt;xe:dw n5&lt;br /&gt;&lt;br /&gt;prime:&lt;br /&gt;dw 2&lt;br /&gt;dw 3&lt;br /&gt;&lt;br /&gt;tabl equ prime+vprime+10&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-3283675412019218546?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/3283675412019218546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/09/al-zimmermanns-programming-contests.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3283675412019218546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/3283675412019218546'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/09/al-zimmermanns-programming-contests.html' title='Al Zimmermann&apos;s Programming Contests'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-256449800090723264</id><published>2008-09-02T07:24:00.000-07:00</published><updated>2008-09-25T08:38:32.598-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming books'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Five Programming Books I Couldn't Survive Without</title><content type='html'>There's roughly 400 programming books on my bookshelf.  If I had to reduce it to just five, here are the books I just couldn't live without.&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Introduction to Algorithms&lt;/span&gt; - Cormen, Leiserson, Rivest &amp;amp; Stein.  This programming book provides in depth yet accessible coverage of many algorithms.  If I want to get the job done as quickly and painfree as possible, I reach for &lt;span class="Apple-style-span" style="font-style: italic; "&gt;Introduction to Algorithms&lt;/span&gt; before Knuth's &lt;span class="Apple-style-span" style="font-style: italic;"&gt;The Art of Computer Programming&lt;/span&gt; every time.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Compilers: Principles, Techniques and Tools&lt;/span&gt; - Aho, Sethi &amp;amp; Ullman.  "The Dragon Book" provides an excellent introduction to compiling before getting stuck into the inner workings of analysis, translation, code generation and optimisation.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;The New Turing Omnibus&lt;/span&gt; - Dewdney.  Sitting atop the fun programming books category, Dewdney's book offers 66 articles covering a variety of computer science topics and recreational computing problems.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Fundamentals of Operating Systems&lt;/span&gt; - Lister.  The way the structure of this book mirrors the structure of an operating system makes it an easier point of reference than books such as Krakowiak's &lt;span class="Apple-style-span" style="font-style: italic;"&gt;Principles of Operating Systems&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Advanced Spectrum FORTH&lt;/span&gt; - Thomasson.  Depite being written for a sadly obsolete platform, &lt;span class="Apple-style-span" style="font-style: italic;"&gt;Advanced Spectrum FORTH&lt;/span&gt; remains one of the best FORTH programming books.  The source code for the dictionary provides a valuable resource.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Disagree?  Think I've missed out a classic programming book?  Drop me a comment below.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-256449800090723264?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/256449800090723264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/09/five-programming-books-i-couldnt.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/256449800090723264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/256449800090723264'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/09/five-programming-books-i-couldnt.html' title='Five Programming Books I Couldn&apos;t Survive Without'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-6382077670611448818</id><published>2008-08-20T23:00:00.000-07:00</published><updated>2008-09-20T23:46:05.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quotes'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Programming Quotes</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;Beware of bugs in the above code; I have only proved it correct, not tried it.&lt;br /&gt;&lt;/blockquote&gt;&lt;cite&gt;Donald Knuth, 1977&lt;/cite&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;It is practically impossible to teach good programming style to students that have had prior exposure to Basic; as potential programmers they are mentally mutilated beyond hope of regeneration.&lt;br /&gt;&lt;/blockquote&gt;&lt;cite&gt;Edsger W. Dijkstra, 1982&lt;/cite&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Measuring programming progress by lines of code is like measuring aircraft building progress by weight.&lt;br /&gt;&lt;/blockquote&gt;&lt;cite&gt;Bill Gates&lt;/cite&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.&lt;br /&gt;&lt;/blockquote&gt;&lt;cite&gt;John von Neumann, 1951&lt;/cite&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration.&lt;br /&gt;&lt;/blockquote&gt;&lt;cite&gt;Stan Kelly-Bootle&lt;/cite&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-6382077670611448818?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/6382077670611448818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/08/programming-quotes.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6382077670611448818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/6382077670611448818'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/08/programming-quotes.html' title='Programming Quotes'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-1945938564935383640</id><published>2008-06-29T03:02:00.000-07:00</published><updated>2009-01-07T05:22:50.025-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='8080'/><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='infinite loop'/><category scheme='http://www.blogger.com/atom/ns#' term='z80'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>Infinite Loop</title><content type='html'>More often than not, infinite loops are created by programming errors and are quickly dealt with.  In sympathy for this highly persecuted group of programs, a safe haven has been created on &lt;a href="http://retrocode.blogspot.com/"&gt;retro code&lt;/a&gt;.  The two infinite loops below are highly optimized examples.  In fact, the actual loops are only 1 byte long!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Z80 Infinite Loop&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;  ld hl, HERE&lt;br /&gt;HERE:jp (hl)&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-size:130%;"&gt;8080 Infinite Loop&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;  lxi h, HERE&lt;br /&gt;HERE:pchl&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-size:130%;"&gt;Corewar Infinite Loop&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;  jmp #0, &lt;-5 &lt;/pre&gt;In &lt;a href="http://corewar.co.uk/"&gt;Corewar&lt;/a&gt;, the infinite loop finds its niche destroying small mobile programs called imps!&lt;br /&gt;&lt;br /&gt;If you know any infinite loops in need of shelter, please post them in the comments below.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-1945938564935383640?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/1945938564935383640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/06/infinite-loop.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1945938564935383640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/1945938564935383640'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/06/infinite-loop.html' title='Infinite Loop'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4757118446768919900.post-2047744744664382947</id><published>2008-06-12T00:08:00.000-07:00</published><updated>2010-01-17T14:47:41.730-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='privacy'/><title type='text'>Privacy Policy</title><content type='html'>&lt;div&gt;&lt;span style="font-size: large;"&gt;Privacy&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I respect your privacy. &amp;nbsp;The following policy explains how information is collected on &lt;a href="http://retrocode.blogspot.com/"&gt;Retro Code&lt;/a&gt;. &amp;nbsp;Your personal information will never be sold or disclosed to a third party, except where required by law.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: large;"&gt;Statistics&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I use Google Analytics to track aggregate statistics about visitors to Retro Code. &amp;nbsp;This information is not linked to personally identifiable information.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: large;"&gt;Cookies&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Cookies are small data files stored by a website on a user's computer. &amp;nbsp;Retro Code does not uses cookies. &amp;nbsp;However, some of my advertising partners use cookies. &amp;nbsp;I have no access to cookies set by advertisers.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: large;"&gt;Advertisers&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I use advertising partners to display ads on Retro Code. &amp;nbsp;These partners may use cookies. &amp;nbsp;I work with Google Adsense and Amazon. &amp;nbsp;Please check the advertising partners' websites for their privacy policies.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: large;"&gt;Contact Information&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you have any questions please contact John Metcalf at digital.wilderness@googlemail.com.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4757118446768919900-2047744744664382947?l=www.retroprogramming.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.retroprogramming.com/feeds/2047744744664382947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.retroprogramming.com/2008/06/privacy-policy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2047744744664382947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4757118446768919900/posts/default/2047744744664382947'/><link rel='alternate' type='text/html' href='http://www.retroprogramming.com/2008/06/privacy-policy.html' title='Privacy Policy'/><author><name>John</name><uri>http://www.blogger.com/profile/09108374348083307900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_kDyMtZ_dJwQ/SPJWvCQ5QpI/AAAAAAAAAWY/cnwIw9hloA0/S220/me.jpg'/></author><thr:total>0</thr:total></entry></feed>
