<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>6502 &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/6502/</link>
	<description>Feed of posts on WordPress.com tagged "6502"</description>
	<pubDate>Mon, 07 Dec 2009 12:25:02 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[BSave and BLoad for the Commodore 64]]></title>
<link>http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/</link>
<pubDate>Thu, 06 Aug 2009 01:15:42 +0000</pubDate>
<dc:creator>Jim Lawless</dc:creator>
<guid>http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/</guid>
<description><![CDATA[I wrote this little subroutine package for the Commodore 64 in 2002. You can likely still find a cac]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I wrote this little subroutine package for the Commodore 64 in 2002.  You can likely still find a cached Usenet post to comp.sys.cbm referring to it.</p>
<p>I thought that I would add in an open-source license header and would present it here.</p>
<p>The source code below is for two machine language library routines which can be called from BASIC.  The first routine will save a section of the C64&#8217;s memory to disk.  The second will load a file from disk into a specific spot in memory.  These functions are akin to Applesoft BASIC&#8217;s <em>BSAVE</em> and <em>BLOAD</em> binary I/O commands.</p>
<p>I did not wedge the CHRGET routine to add any new command verbs to BASIC; one must use the SYS command to invoke each subroutine.  A jump-table at the beginning of the module controls which of the two functions you&#8217;ll execute.  Address 49152 is the BSAVE routine.  Address 49152+3 is the BLOAD routine.</p>
<p>Please note that the filename parameter must always be in a variable.  I didn&#8217;t have the routine that would parse a literal properly readily available &#8230; and still don&#8217;t remember how to do it off the top of my head. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<pre class="brush: ruby;">
; BSaVe and bLoaD extentsions for the Commodore 64
;
;  License: MIT / X11
;  Copyright (c) 2009 by James K. Lawless
;  jimbo@radiks.net http://www.radiks.net/~jimbo
;  http://www.mailsend-online.com
;
;  Permission is hereby granted, free of charge, to any person
;  obtaining a copy of this software and associated documentation
;  files (the &#34;Software&#34;), to deal in the Software without
;  restriction, including without limitation the rights to use,
;  copy, modify, merge, publish, distribute, sublicense, and/or sell
;  copies of the Software, and to permit persons to whom the
;  Software is furnished to do so, subject to the following
;  conditions:
;
;  The above copyright notice and this permission notice shall be
;  included in all copies or substantial portions of the Software.
;
;  THE SOFTWARE IS PROVIDED &#34;AS IS&#34;, WITHOUT WARRANTY OF ANY KIND,
;  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
;  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
;  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
;  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
;  OTHER DEALINGS IN THE SOFTWARE.
;
; To use in C64 BASIC:
;   sys 49152,a$,start-addr,end-addr
;      The above will save to file named in a$
;   sys 49152+3,a$,start-addr
;      The above will load a file named in a$
;      to the specified location
;
; To save the default BASIC screen:
;   a$=&#34;screen,s,w&#34;
;   sys 49152,a$,1024,1024+999
;
; To reload the default BASIC screen
;   a$=&#34;screen,s,r&#34;
;   sys 49152+3,a$,1024

   *=$c000
; jump table for functions
   jmp save
   jmp load
flag  .BYTE 00
save = *
   lda #$00
   sta flag
   jmp main
load = *
   lda #$01
   sta flag
   jmp main

main = *
   jsr $aefd    ; skip comma
   jsr $b08b    ; search for variable
   jsr $b185    ; find address
   sta $fb
   tya
   sta $fc
   lda #$00
   tay
   lda ($fb),y
   pha
   iny
   lda ($fb),y
   pha
   iny
   lda ($fb),y
   tay
   pla
   tax
   pla
   jsr $ffbd ; SETNAM
   lda #$02
   ldx #$08
   ldy #$00
   jsr $ffba ; SETLFS

   lda flag
   cmp #$00
   beq dosave
   jmp doload

dosave = *
   jsr $aefd ; skip comma
   jsr $ad8a ; eval expr
   jsr $b7f7 ; get uint in a,y
   sta $fc
   tya
   sta $fb

   jsr $aefd ; skip comma
   jsr $ad8a ; eval expr
   jsr $b7f7 ; get uint in a,y
   sta $fd
   tya
   tax
   ldy $fd
   lda #$fb

   jsr $ffd8 ; save ram
   rts

doload = *
   jsr $aefd ; skip comma
   jsr $ad8a ; eval expr
   jsr $b7f7 ; get uint in a,y
   sta $fd
   tya
   tax
   ldy $fd
   lda #$00
   jsr $ffd5 ; load ram
   rts
</pre>
<p><a href="http://del.icio.us/post?url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank"><img title="del_icio_us" src="http://www.mailsend-online.com/wp/del_icio_us.png" alt="del_icio_us" /></a> <a href="http://del.icio.us/post?url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank">Save to del.icio.us</a><br /><a href="http://digg.com/submit?phase=2&#38;url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank"><img title="digg" src="http://www.mailsend-online.com/wp/digg.png" alt="digg" /></a> <a href="http://digg.com/submit?phase=2&#38;url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank">Digg it</a><br /><a href="http://reddit.com/submit?url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank"><img title="reddit" src="http://www.mailsend-online.com/wp/reddit.png" alt="reddit" /></a> <a href="http://reddit.com/submit?url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/&#38;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank">Save to Reddit</a><br /><a href="http://www.facebook.com/share.php?u=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/" target="_blank"><img title="facebook" src="http://www.mailsend-online.com/wp/facebook.png" alt="facebook" /></a> <a href="http://www.facebook.com/share.php?u=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/" target="_blank">Share on Facebook</a><br /><a href="http://twitter.com/home?status=Check+out+http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/"><img title="twitter" src="http://www.mailsend-online.com/wp/twitter.gif" alt="twitter" /></a> <a href="http://twitter.com/home?status=Check+out+http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/" target="_blank">Share on Twitter</a><br /><a href="http://www.addthis.com/bookmark.php?pub=dvd&#38;url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank"><img title="aolfav" src="http://www.mailsend-online.com/wp/aolfav.gif" alt="aolfav" /></a> <a href="http://www.addthis.com/bookmark.php?pub=dvd&#38;url=http://jimlawless.wordpress.com/2009/08/05/bsave-and-bload-for-the-commodore-64/;title=BSave+and+BLoad+for+the+Commodore+64" target="_blank">More bookmarks</a>
<p><img src="http://www.mailsend-online.com/cgi-bin/wphit.pl" /><br />
<em>Unless otherwise noted, all code and text entries are Copyright © 2009 by James K. Lawless</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[a nice makro...]]></title>
<link>http://heaven6502.wordpress.com/2009/07/15/a-nice-makro/</link>
<pubDate>Wed, 15 Jul 2009 11:53:30 +0000</pubDate>
<dc:creator>heaven6502</dc:creator>
<guid>http://heaven6502.wordpress.com/2009/07/15/a-nice-makro/</guid>
<description><![CDATA[Jeff is using in most of his VIC games following makro to set a sprie on screen: (assuming here $0c,]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Jeff is using in most of his VIC games following makro to set a sprie on screen:</p>
<p>(assuming here $0c,$0d pointing to VRAM)</p>
<p>jsr calc_vram_vector ;$0c,$0d</p>
<p>ldy #collum<br />
sta  ($0c),y</p>
<p>lda $0d<br />
pha<br />
clc<br />
adc #$78 ;now pointing to color ram<br />
sta $0d<br />
lda #$02 ;f.e. in Gridrunner red is the &#8220;default color&#8221;<br />
sta ($0c),y<br />
pla<br />
sta ($0c),y<br />
&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MSX part 2]]></title>
<link>http://heaven6502.wordpress.com/2009/07/15/msx-part-2/</link>
<pubDate>Wed, 15 Jul 2009 07:46:25 +0000</pubDate>
<dc:creator>heaven6502</dc:creator>
<guid>http://heaven6502.wordpress.com/2009/07/15/msx-part-2/</guid>
<description><![CDATA[Basicly there are only 4 sound fx in Gridrunner. Before I am trying to implement them and mimic them]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Basicly there are only 4 sound fx in Gridrunner. Before I am trying to implement them and mimic them. first tries with vic2pokey translation tables were not as good as thought. VBL scanning of $900x sound registers not perfect either.</p>
<p>As they are only 4 of the sounds I will try to replicate them directly with own small pokey routines&#8230;</p>
<p>f.e. here you can have a look for the player shoot sound f.e.</p>
<p>$1422 ff. Player shot sound</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Gridrunner msx]]></title>
<link>http://heaven6502.wordpress.com/2009/07/14/gridrunner-msx/</link>
<pubDate>Tue, 14 Jul 2009 21:32:17 +0000</pubDate>
<dc:creator>heaven6502</dc:creator>
<guid>http://heaven6502.wordpress.com/2009/07/14/gridrunner-msx/</guid>
<description><![CDATA[I got the Gridrunner sound fx recreated in RMT by Miker. Let&#8217;s see how they fit and how I can ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I got the Gridrunner sound fx recreated in RMT by Miker. Let&#8217;s see how they fit and how I can implement them into the VBL system for playback.</p>
<p>Gridrunner itself only uses 4 sound fx in total.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[La Storia Del PC Engine #1]]></title>
<link>http://inserirelamemorycard.wordpress.com/2009/03/28/sla-storia-del-pc-engine-1/</link>
<pubDate>Sat, 28 Mar 2009 22:21:14 +0000</pubDate>
<dc:creator>Selector</dc:creator>
<guid>http://inserirelamemorycard.wordpress.com/2009/03/28/sla-storia-del-pc-engine-1/</guid>
<description><![CDATA[La nostra storia ha inizio più o meno a metà degli anni ‘80, quando un gruppo di baldi ingegneri di ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><img class="aligncenter" title="clicca per ingrandire l’immagine" src="http://www.gamesvillage.it/mm/G/01/41/26/pcengine.jpg" border="0" alt="" width="500" height="375" /></p>
<p style="text-align:justify;">La nostra storia ha inizio più o meno a metà degli anni ‘80, quando un gruppo di baldi ingegneri di stanza presso Hudson Soft (popolarissima software house dotata di un reparto di ricerca e sviluppo dedicato all&#8217;hardware) si ritrovarono per le mani, grazie ai loro immani sforzi, il progetto di una nuova console dalle caratteristiche quantomeno invitanti. Tale progetto, però, necessitava di ingenti finanziamenti per essere tradotto in realtà&#8230;</p>
<p style="text-align:justify;"><a href="http://www.gamesvillage.it/news/retrogaming/detail%5Bn=14126%5D.html" target="_blank"><strong>Leggi tutto »</strong></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A long long time ago]]></title>
<link>http://itsavvy.wordpress.com/2008/09/12/a-long-long-time-ago/</link>
<pubDate>Fri, 12 Sep 2008 06:38:45 +0000</pubDate>
<dc:creator>Stuart</dc:creator>
<guid>http://itsavvy.wordpress.com/2008/09/12/a-long-long-time-ago/</guid>
<description><![CDATA[At a computer far far away, I taught myself machine language on the 6502 processor (which at that ti]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>At a computer far far away, I taught myself machine language on the 6502 processor (which at that time was the heart of the Apple ][e, the BBC and a number of other computers).</p>
<p>The book that I referred to was called “Machine Language for Beginners”, and if you are incredibly interested (and/or incredibly bored), you can now access a copy online here:</p>
<div id="attachment_207" class="wp-caption aligncenter" style="width: 118px"><a href="http://www.atariarchives.org/mlb/" target="_blank"><img class="size-full wp-image-207" title="Machine Language for Beginners" src="http://itsavvy.wordpress.com/files/2008/09/cover-thumb.jpg" alt="Machine Language for Beginners" width="108" height="165" /></a><p class="wp-caption-text">Machine Language for Beginners</p></div>
<p>Guess I was always doomed to work in IT, given this is (one of the things) I did for fun at 14.</p>
<p>I still have the original copy, and even sadder, there is still a fully functional Apple ][e in my office.</p>
<p><div id="attachment_208" class="wp-caption aligncenter" style="width: 435px"><img class="size-full wp-image-208" title="Apple 2" src="http://itsavvy.wordpress.com/files/2008/09/appleii.jpg" alt="Apple ][" width="425" height="393" /><p class="wp-caption-text">Apple 2</p></div>(Pictured is an Apple ][, but the image looked more authentic being B&#38;W and grainy!)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Mein erstes Buch]]></title>
<link>http://boltac.wordpress.com/2008/08/28/mein-erstes-buch/</link>
<pubDate>Thu, 28 Aug 2008 13:08:00 +0000</pubDate>
<dc:creator>Boltac</dc:creator>
<guid>http://boltac.wordpress.com/2008/08/28/mein-erstes-buch/</guid>
<description><![CDATA[Um genau zu sein, mein erstes Programmier-Buch war: Das war Anfang der 80er und die einzige Möglichk]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Um genau zu sein, mein erstes Programmier-Buch war:</p>
<p><a href="http://boltac.wordpress.com/files/2008/08/51a59ckwf9l_ss500_.jpg"><img class="aligncenter size-full wp-image-73" src="http://boltac.wordpress.com/files/2008/08/51a59ckwf9l_ss500_.jpg" alt="" width="468" height="468" /></a></p>
<p>Das war Anfang der 80er und die einzige Möglichkeit auf meinem <a href="http://www.zock.com/8-Bit/D_Laser200.HTML">VZ200</a> Computer Spiele zu spielen war, ich musste sie selber programmieren.</p>
<p>Schnell wurde mir klar, dass ich mit dem eingebauten Basic nicht weit kam, also kaufte ich mir besagtes Buch, in der Ausgabe mit gelbem Cover und programmierte mein erstes Spiel.</p>
<p>Spiel war vielleicht zu viel gesagt, es handelte sich dabei um den 100m Lauf aus Decathlon. Aber immerhin wurde die Zeit gemessen und so konnte man zumindest versuchen seinen Rekord zu verbessern.</p>
<p>Als ich dann auf den C64 umstieg, begleitete mich auch dort das 6502 Buch von Rodnay Zaks und half mir dabei einen der ersten Floppy-Beschleuniger zu schreiben. Auch bei der meiner Meinung nach schnellsten Line-Routine auf dem C64 zog ich dieses Buch zur Optimierung (Taktzyklen zählen) des Algorithmus heran. Abgeleitet war er vom <a href="http://de.wikipedia.org/wiki/Bresenham-Algorithmus">Bresenham-Algorithums</a> den ich jedoch so vereinfachte, dass er ohne Abfragen und mit einfacher Integer Addition funktionierte.</p>
<p>Rodnay Zaks hat mich in die Geheimnisse der Maschinensprache eingeführt, und dafür bin ich ihm sehr dankbar. Ich kann somit durchaus behaupten, dass mein erstes Buch ein wirklich gutes Buch war <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Natürlich würde mich auch interessieren, welches euer erstes Buch war und welche Lehren ihr daraus gezogen habt. Also nicht genieren und hier antworten <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[COMFY-6502: hosting at github]]></title>
<link>http://jaoswald.wordpress.com/2008/05/06/comfy-6502-hosting-at-github/</link>
<pubDate>Tue, 06 May 2008 02:50:56 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2008/05/06/comfy-6502-hosting-at-github/</guid>
<description><![CDATA[Mostly to support my own development on multiple computers, I&#8217;ve moved my Common Lisp port of ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Mostly to support my own development on multiple computers, I&#8217;ve moved my Common Lisp port of COMFY-6502 to github. I chose the name cl-comfy-6502 for the repository, although the &#8220;cl&#8221; prefix is a bit ugly.</p>
<p>The <a title="30 April 2008 snapshot of Common Lisp COMFY-6502" href="http://github.com/jaoswald/cl-comfy-6502/tree/4f60b2a1d493f731f4702d29439112b31fa76f03" target="_blank">current snapshot of COMFY-6502</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[TRS-80 von TANDY]]></title>
<link>http://riwer.wordpress.com/2008/03/05/trs-80-von-tandy/</link>
<pubDate>Wed, 05 Mar 2008 12:17:30 +0000</pubDate>
<dc:creator>riwer</dc:creator>
<guid>http://riwer.wordpress.com/2008/03/05/trs-80-von-tandy/</guid>
<description><![CDATA[Der Nascom I Computer war mein erster Einstieg in dem Bereich Personal Computer, soweit man von eine]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Der <b>Nascom I</b> Computer war mein erster Einstieg in dem Bereich Personal Computer, soweit man von einem <b>Einplatinen Computer</b> schon von einem <b>Personal Computer</b> sprechen kann. Er kam als Bausatz und man musste schon wissen, wie man mit einem Lötkolben umgeht. Ziemlich schnell schon stieß ich mit meinen Wünschen, bzgl. der Möglichkeiten, die sich mir boten, an die Grenzen. Also musste ein besserer Computer her.</p>
<p><img style="float:left;margin:10px;" height="196" alt="trs80-model-i.jpg" src="http://riwer.wordpress.com/files/2008/03/trs80-model-i.jpg" width="226" border="1">1978 wurde sehr stark für drei Fertigcomputer in der Fachpresse geworben, dem <b><a href="http://de.wikipedia.org/wiki/PET_2001">PET 2001</a></b> von <b><a href="http://de.wikipedia.org/wiki/Commodore_International">Commodore</a></b>, dem <b><a href="http://de.wikipedia.org/wiki/Tandy_TRS_80_Model_1">TRS-80</a></b> von <b><a href="http://en.wikipedia.org/wiki/Tandy_Corporation">Tandy</a></b> und dem <b><a href="http://de.wikipedia.org/wiki/Apple_II">Apple II</a></b>. PET und Apple benutzten als Mikroprozessor den <b><a href="http://de.wikipedia.org/wiki/MOS_Technology_6502">6502</a></b> von <a href="http://de.wikipedia.org/wiki/MOS_Technology">MOS Technology</a> und der <b><a href="http://oldcomputers.net/trs80i.html">TRS-80</a></b> den <b><a href="http://de.wikipedia.org/wiki/Zilog_Z80">Z80</a></b> von <b><a href="http://de.wikipedia.org/wiki/Zilog">Zilog</a></b>.</p>
<p>Da ich durch den Nascom I mit der <b>Z80 CPU</b> vorbelastet war, entschied ich mich für den TRS-80. Mittlerweile war ich mit der Maschinen- Programmierung des Z80 so vertraut &#8211; alle 920 OP-Codes kannte ich auswendig -, dass mir kaum eine andere Wahl blieb.</p>
<p>Der TRS-80 bot mir in meiner Leidenschaft zum Amateurfunk neue Möglichkeiten. Eine meiner beliebtesten Betriebsarten war <b><a href="http://de.wikipedia.org/wiki/RTTY">RTTY</a></b> (Radio Teletype), für die Nicht- Eingeweihten: Funkfernschreiben (<b><a href="http://de.wikipedia.org/wiki/Telex">Telex</a></b>) für den Heimgebrauch. Auf einer Telex-Maschine empfing man Rundschreiben oder man unterhielt sich per Tastatur mit einem Partner, den heutigen <b><a href="http://de.wikipedia.org/wiki/Chat">Chats</a></b> vergleichbar, nur mit wesentlich mehr Aufwand und nur für den kleinen Kreis der <a href="http://de.wikipedia.org/wiki/Amateurfunk">Amateurfunker</a>. Da die Telex-Maschinen doch sehr klobig und unförmig waren, es handelte sich hier um ausgemusterte Geräte der <b><a href="http://de.wikipedia.org/wiki/Deutsche_Bundespost">Deutschen Bundespost</a></b>, kam schnell die Idee, den RTTY Betrieb mit einem Computer zu realisieren. Erste Programme waren schnell geschrieben und man konnte den empfangenen Text auf dem Bildschirm als Klarschrift lesen. Ich selbst entwickelte ein Programm, mit dem man den empfangenen Text lesen und gleichzeitig eine Antwort schreiben konnte, die ebenfalls auf dem Bildschirm sichtbar war (<b><a href="http://de.wikipedia.org/wiki/Split-Screen">Split-Screen</a></b>) und nach dem Empfang sofort versendet werden konnte. Ein erstes und echtes <a href="http://de.wikipedia.org/wiki/Multitasking">Multitasking</a>. Als nächstes Programm folgte ein <a href="http://de.wikipedia.org/wiki/Morsetelegrafie"><b>CW</b></a><b> (<a href="http://de.wikipedia.org/wiki/Morsetelegrafie">Morse</a>)</b> Dekodierprogramm. Die Töne der Morsezeichen wurden als lesbare Klarschrift auf dem Bildschirm angezeigt und auch das Vorschreiben war wie beim RTTY Programm möglich.</p>
<p><img style="float:right;margin:10px;" alt="trs80-model-iii.gif" src="http://riwer.wordpress.com/files/2008/03/trs80-model-iii.gif" border="1">Durch die Popularität des TRS-80 wurden auch kommerzielle Programme angeboten. Als passionierter Schachspieler ist mir das <b><a href="http://en.wikipedia.org/wiki/Sargon_%28chess%29">SARGON</a></b> Schachspiel noch in Erinnerung. Als Betriebssystem hatte sich <b><a href="http://de.wikipedia.org/wiki/CP/M">CP/M</a></b> etabliert. Es kam mit wenig Speicher aus und <b><a href="http://de.wikipedia.org/wiki/Wordstar">WORDSTAR</a></b> hieß meine erste Textverarbeitung.</p>
<p>Auch die Firma Tandy war nicht untätig. Auf Grund des Erfolges Ihres ersten Computers <b>TRS-80 Model I</b> kam gut zwei Jahre später ein Nachfolger auf den Markt, der <b>TRS-80 Model III</b>. Das Model II war ein Portable Computer. War man zur Datenspeicherung beim Model I noch auf einen Kassettenrecorder angewiesen, so war das Model III ein Kompaktmodell und die Speichermedien, 51/4&#8243; Diskettenlaufwerke mit einer Kapazität von 156 KB (Singlesided) waren im Gehäuse eingebaut. Der Verkaufserfolg des Modells war nicht mehr so gewaltig, weil immer mehr Firmen auf den Zug des Personal Computers aufgesprungen waren.</p>
<div class="wlWriterSmartContent" style="display:inline;margin:0;padding:0;">Technorati-Tags: <a href="http://technorati.com/tags/Personal%20Computer" rel="tag">Personal Computer</a>,<a href="http://technorati.com/tags/PET%202001" rel="tag">PET 2001</a>,<a href="http://technorati.com/tags/Commodore" rel="tag">Commodore</a>,<a href="http://technorati.com/tags/TRS-80" rel="tag">TRS-80</a>,<a href="http://technorati.com/tags/Tandy" rel="tag">Tandy</a>,<a href="http://technorati.com/tags/Apple%20II" rel="tag">Apple II</a>,<a href="http://technorati.com/tags/6502" rel="tag">6502</a>,<a href="http://technorati.com/tags/Z80" rel="tag">Z80</a>,<a href="http://technorati.com/tags/Zilog" rel="tag">Zilog</a>,<a href="http://technorati.com/tags/RTTY" rel="tag">RTTY</a>,<a href="http://technorati.com/tags/Amateurfunk" rel="tag">Amateurfunk</a>,<a href="http://technorati.com/tags/CW" rel="tag">CW</a>,<a href="http://technorati.com/tags/TRS-80%20Model%20I" rel="tag">TRS-80 Model I</a>,<a href="http://technorati.com/tags/TRS-80%20Model%20III" rel="tag">TRS-80 Model III</a></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[COMFY-6502: snapshot]]></title>
<link>http://jaoswald.wordpress.com/2008/03/05/comfy-6502-snapshot/</link>
<pubDate>Wed, 05 Mar 2008 01:34:39 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2008/03/05/comfy-6502-snapshot/</guid>
<description><![CDATA[Even though it is hardly a finished product, I&#8217;ve posted a snapshot of my current CL conversio]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Even though it is hardly a finished product, I&#8217;ve posted a <a href="http://josephoswald.nfshost.com/comfy/summary.html" title="COMFY-6502 snapshot" target="_blank">snapshot of my current CL conversion of COMFY-6502</a> Not that I expect a huge pent-up demand for the code, but it might be slightly more interesting than the output examples. Thanks to Henry Baker for allowing the release.</p>
<p>The page also contains a link to the TODO file describing my next steps. (Most immediately, my attempt to include JMP elision was messy enough to convince me I need a different class to represent opcodes+arguments as a unit.)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A Slight In(doctrination)troduction]]></title>
<link>http://robbryant.wordpress.com/2008/02/18/a-slight-indoctrinationtroduction/</link>
<pubDate>Tue, 19 Feb 2008 03:48:31 +0000</pubDate>
<dc:creator>Rob Bryant</dc:creator>
<guid>http://robbryant.wordpress.com/2008/02/18/a-slight-indoctrinationtroduction/</guid>
<description><![CDATA[Hello World! I love those words, and at the same time, I loathe them. Why is that? In the programmin]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hello World! I love those words, and at the same time, I loathe them. Why is that?</p>
<p>In the programming world, &#8220;Hello World&#8221; is usually the name of the first program you make in a given language that you&#8217;re starting to learn. For those that aren&#8217;t familiar, here&#8217;s a quick run down. You learn some basic coding for said new language, and implement a program to spit out two lovely words &#8212; Hello, and World. For the most part, this just lets you know that you&#8217;re on the right track. Nothing fancy or anything. When it&#8217;s a new language that you&#8217;re learning, and this happens, it&#8217;s pretty exciting! How I love those words!</p>
<p>Now let&#8217;s say you&#8217;ve gone to a year of community college where you started to learn how to program. You had to drop out after that year for one reason or another. Okay, fine, but you learned how to study for programming at least. Nice! Now you have the ability to pick up just about any programming language and apply yourself to it!</p>
<p>Okay, I was just talking about myself there obviously. If you couldn&#8217;t tell&#8230; damn. ANYWAY,  here&#8217;s where the loathing of &#8220;Hello World&#8221; comes in. I&#8217;m pretty darned lazy when it comes to programming. Well, I&#8217;m not sure if I&#8217;m actually lazy, or if I have problems understanding the more advanced stuff. I can always get the basics down it seems, but then my brain just won&#8217;t soak in things, and it gets SO aggravating haha Now that I think about it, I must just be lazy. I know how to study for this!</p>
<p>I&#8217;ve dabbled in a few different languages now; C++, VB.NET, PHP, and most recently 6502 assembly. I haven&#8217;t <i>excelled</i> in any per se, but  I&#8217;ve been able to do some minor things and be proud of them. This is why I love and hate the words, &#8220;Hello World.&#8221;</p>
<p>My name is Rob Bryant. Hi!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[COMFY-6502: a slight correction]]></title>
<link>http://jaoswald.wordpress.com/2008/02/11/comfy-6502-a-slight-correction/</link>
<pubDate>Mon, 11 Feb 2008 01:57:48 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2008/02/11/comfy-6502-a-slight-correction/</guid>
<description><![CDATA[After all the work to write a post showing off COMFY-6502&#8217;s ability to reproduce the Red Book ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>After all the work to write a post showing off COMFY-6502&#8217;s ability to reproduce the Red Book tone routine, I made a slight mistake in translation. The code I presented differed ever-so-slightly from the Red Book routine in the case where the Y-register reached zero.<br />
<!--more--><br />
In the original, when the Y-register reaches zero, the DEX is still executed. In the code I posted, the expiring &#8220;duration tick&#8221; skips a count on the pitch. A minor error, but one I should own up to.</p>
<p>Here&#8217;s a better effort. COMPILE-SYMBOLIC contains a MACROLET defining MODULE as a call to COMFY-6502:COMPILE.</p>
<pre class="brush: jscript;">
(compile-symbolic
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (module
   (comfy-6502:loop
      ;; repeat until some clause loses: actually, only exit is
      ;; through return, so each clause should be ensured of winning.
    (LDX pitch)
    (LDA speaker)
    (not
     (comfy-6502:loop  ;; repeat until whap time
     DEY
     (not (seq zero? (DEC duration) zero? return))
     (seq DEX (not zero?)))))))
</pre>
<p>resulting in </p>
<pre class="brush: jscript;">
(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
 ; spin
 (DEY)
 (BNE) (:BRANCH 6) ; not-duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH 2)
 (RTS)
 ; not-duration-tick
 (DEX)
 (BEQ) (:BRANCH 4) ; goto-reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -12) ; spin
 ; goto-reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -20) ; reload-pitch
)
</pre>
<p>For fun, I tried to get the code to emit the RTS at the very end, as in the original.</p>
<pre class="brush: jscript;">
(compile-symbolic
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (module
    (alt (loop (seq (LDX pitch) (LDA speaker))
            (not (while
                    (seq DEY (not (seq zero? (seq (DEC duration) zero?)))
                    (seq DEX (not zero?)))))
          RTS)))
</pre>
<pre class="brush: jscript;">
(; reload
  (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
  (LDA :ABSOLUTE) (:ABSOLUTE 49200)
  ; spin
  (DEY)
  (BNE) (:BRANCH 5) ; not-duration
  ; duration-tick
  (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
  (BEQ) (:BRANCH 10) ; exit
  ; not-duration
  (DEX)
  (BEQ) (:BRANCH 4) ; goto-reload
  ; goto-spin
  (JMP :ABSOLUTE) (:LONG-BRANCH -11)
  ; goto-reload
  (JMP :ABSOLUTE) (:LONG-BRANCH -19) ; reload
 ; exit
  (RTS))
</pre>
<p>&#8220;Loop tightening&#8221; could change (BEQ) (:BRANCH 4) to (BEQ) (:BRANCH -14); the (JMP :ABSOLUTE) (:LONG-BRANCH -19) is then never used, and could be omitted, changing (BEQ) (:BRANCH 10) to (BEQ) (:BRANCH 7).</p>
<p>&#8220;Loop compaction&#8221; could potentially recognize (BEQ) (:BRANCH -14) (JMP :ABSOLUTE) (:LONG-BRANCH -11), where no other instruction references the JMP, could be converted to (BEQ) (:BRANCH -14) (BNE) (:BRANCH -11), shortening the (BEQ) (:BRANCH 7) one byte more to (BNE) (:BRANCH 6).</p>
<p>Note some interesting equivalents I should probably implement as COMFY macros.</p>
<p>(if A B C) where C is do-nothing-but-win is (not (seq A (not B)). If A wins, B is executed to determine the result of the form. If A loses, the if wins. I will probably call this (when A B).</p>
<p>(if A B C) where B is a do-nothing-but-win is (alt A C), where alt is the &#8220;dual&#8221; of seq. (alt A B C &#8230;) == (not (seq (not A) (not B) (not C) &#8230;). For the two-argument case, I would call this (unless A B). </p>
<p>The one twist I can think of is to add an &#8220;implied SEQ&#8221; to these forms. (when A B C &#8230;) would be (when A (seq B C &#8230;)). (unless A B C &#8230;) would be (unless A (seq B C &#8230;)).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[COMFY-6502: work in progress]]></title>
<link>http://jaoswald.wordpress.com/2008/02/05/comfy-6502-work-in-progress/</link>
<pubDate>Tue, 05 Feb 2008 00:49:23 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2008/02/05/comfy-6502-work-in-progress/</guid>
<description><![CDATA[As I&#8217;ve mentioned before, I&#8217;ve become intrigued by Baker&#8217;s COMFY assembler, and ha]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>As I&#8217;ve mentioned before, I&#8217;ve become intrigued by Baker&#8217;s COMFY assembler, and have been working on porting it to Common Lisp, and making it a bit more powerful in the link stage.</p>
<p>One metric to judge the success of this kind of &#8220;medium-level&#8221; language is how well it compiles compared to hand-written assembler code. For the 6502, there are a few examples of code created by wizards like Steve Wozniak, which you can find copies of around the web, the largest being the Apple II monitor, the Integer Basic interpreter, and some medium-sized ones like the Apple II 6502 step/trace, the mini-assembler, the floating-point &#8220;Wozpack,&#8221; and the Sweet-16 virtual machine.</p>
<p>This kind of code has a lot of quirks that make it hard to straight-forwardly translate: lots of shared &#8220;tail code&#8221;, branches known by the programmer to always be taken (to save a precious extra byte consumed by an unconditional JMP), and the classic &#8220;fake RTS trick&#8221;, pushing a return address picked from a table onto the stack, then using an RTS instead of a zero-page indirect JMP. Common in Woz&#8217;s code is a further shortening of the code by arranging the destination addresses to all be in the same 256-byte page, so the high-order byte is a constant. Some of these ideas will likely be possible with intelligent macros, combined with address labels and computation on those labels. I&#8217;m puzzling a bit over how to optimize the &#8220;same page&#8221; condition: whether to include a &#8220;link-time assert&#8221;, which will issue an error if the code is emitted so as to cross a page, or an even more intelligent &#8220;link-time computation&#8221; which, given the current available memory space, can choose a location that meets the constraints.<br />
<!--more--><br />
That&#8217;s all still in development. The first test case I used was the classic &#8220;Red Book&#8221; tone routine.</p>
<pre class="brush: jscript;">
;; the original
;; location 00: pitch
;; location 01: duration
0002-  AD 30 C0   LDA  $C030 ; whap speaker
0005-  88         DEY
0006-  D0 04      BNE  $000C
0008-  C6 01      DEC  $01   ; y reaches 0: a duration tick
000A-  F0 08      BEQ  $0014 ; duration exhausted when reaches 0
000C-  CA         DEX        ; x counts time to &quot;whap&quot;
000D-  D0 F6      BNE  $0005
000F-  A6 00      LDX  $00   ; x reached 0, reload pitch
0011-  4C 02 00   JMP  $0002 ; and whap
0014-  60         RTS</pre>
<p>A few comments:</p>
<ol>
<li>Locating the code in zero-page needlessly wastes valuable zero-page locations. The code is easily relocatable to other locations.</li>
<li>X counts from the &#8220;pitch value&#8221; down to 0 at a fixed rate, &#8220;whapping&#8221; the speaker each time it reaches zero.</li>
<li>Y cycles around continuously at basically the same rate; each time it reaches zero, one tick is subtracted from the duration value. When duration reaches zero, the routine returns.</li>
<li>This classic tone routine has the important feature that duration is absolute, and not dependent on pitch</li>
<li>Y is uninitialized, which presumably causes a slight jitter in the duration, unless BASIC ensures Y=0. Likewise, X in the first pitch countdown is uninitialized.</li>
<li>duration is destroyed by the routine, but pitch is not.</li>
</ol>
<p>Here is my transcription to COMFY-6502. I have translated the &#8220;I&#8221;, &#8220;J&#8221;, and abbreviated &#8220;L&#8221;, &#8220;LI&#8221;, etc. opcodes for this example, but not yet changed Baker&#8217;s code to accept them.</p>
<pre class="brush: jscript;">
(let ((comfy-6502::*symbol-table* (make-hash-table)))
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (comfy-6502-tests::compile-code
     (comfy-6502:loop
       ;; repeat until some clause loses: actually, only exit is
       ;; through return, so each clause should be ensured of winning.
        (LDX pitch)
        (LDA speaker)
        (not (comfy-6502:loop  ;; repeat until whap time; &quot;whap&quot; time is when a clause loses; NOT wins, outer loop continues
                 DEY
                 (if =0? ; has Y reached zero?
                     (not (seq (DEC duration) ; Y has reached zero, duration ticks down
                               =0?       ; if duration has not reached zero, SEQ fails, NOT wins, IF wins, inner loop continues
                               RTS)) ; duration reached zero, return
                     (seq DEX ~=0?))))))) ; Y not zero, count down pitch. If X has reached zero, SEQ loses, IF loses, inner loop exits</pre>
<p>To understand the code, the basic COMFY principles must be understood.</p>
<ol>
<li>Conditional tests (such as &#8220;=0?&#8221;, corresponding to a BEQ or BNE), &#8220;win&#8221; if they are true, &#8220;lose&#8221; if they are false.</li>
<li>Ordinary machine operations (such as LDA, DEX, RTS) always &#8220;win&#8221;</li>
<li>SEQ sequentially each enclosed form, until one &#8220;loses&#8221;, in which case SEQ &#8220;loses&#8221;, or until they all &#8220;win&#8221;, in which case SEQ &#8220;wins.&#8221;</li>
<li>LOOP executes each enclosed form, until one &#8220;loses&#8221;, in which case LOOP &#8220;loses&#8221;, continuing at the top of the loop if every form &#8220;wins.&#8221; (I have introduced an &#8220;implied&#8221; seq to Baker&#8217;s ELisp implementation.) It is SEQ stuck on potentially endless repeat.</li>
<li>NOT executes the single enclosed form, but changes &#8220;win&#8221; into &#8220;lose&#8221; and vice-versa. This is useful to keep a nested &#8220;loss&#8221; from terminating all the enclosing forms.</li>
<li>(IF test win-form lose-form) executes TEST. If TEST &#8220;wins&#8221;, WIN-FORM is executed, and its win/lose result is passed out as the result of the IF. If TEST &#8220;loses&#8221;, LOSE-FORM is executed, and its win/lose result is passed out as the result of the IF.</li>
</ol>
<p>Note that I have chosen to initialize X on the first pass through the loop. That makes the code somewhat clearer, and I think is better style.</p>
<p>So what code does COMFY (as of today) generate for this? Behold.</p>
<pre class="brush: jscript;">
(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
; spin
 (DEY)
 (BEQ) (:BRANCH 6) ; duration-tick
 (DEX)
 (BNE) (:BRANCH 8 ) ; goto spin
 (BEQ) (:BRANCH 9) ; goto reload-pitch
; duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH 2) ; goto-spin
 (RTS)
; goto spin
 (JMP :ABSOLUTE) (:LONG-BRANCH -14)
; goto reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -22))</pre>
<p>This is a symbolic &#8220;intermediate&#8221; form, not yet relocated and linked. Some keys for interpretation.</p>
<ol>
<li>(BEQ), (JMP :ABSOLUTE) etc. represent one-byte opcodes, with the specified addressing mode (redundant in the case of branch instructions, which have only the branch-relative mode).</li>
<li>(:ZERO-PAGE 0) is a single-byte, value 0, tagged to indicate that it represents a reference to zero-page location 0, and is not just a immediate argument of value zero.</li>
<li>(:ABSOLUTE 49200) is a two-byte reference to the address #xC030, which will be emitted in the usual 6502 low-byte first as #x30 and #xC0.</li>
<li>(:BRANCH n) represents a short branch. It is one byte long. Note that the destination counts relative to the BRANCH byte, not relative to the next instruction, as the 6502 branch values do. (The relocater corrects for this when converting to 6502 code bytes.)</li>
<li>(:LONG-BRANCH n) is a long branch. It is two bytes long. JMP is absolute in the 6502; the relocated will deposit the absolute address by adding this value to the location of the first byte of this pair.</li>
</ol>
<p>I have added this intermediate form because Baker&#8217;s Elisp goes directly to bytes in a fixed memory area, starting from high addresses. My goal is for a high level &#8220;COMFY module&#8221; macro to result in an intermediate form that knows its length in bytes, what zero page locations it uses, and what internal entry points it exports. Otherwise, it is relocatable by the linker. I would also like the feature that the zero-page references are symbolic (e.g. (:ZERO-PAGE duration)), in which case the linker would allocate a byte in zero-page, and all modules referring to &#8220;duration&#8221; would refer to that address. Even nicer would be the ability to do math, for instance (:ZERO-PAGE (+ duration 1)), or to emit (:ABSOLUTE (- tone-entry 1)) to encode the module entry point in the &#8220;off-by-one&#8221; method used by the &#8220;fake RTS&#8221; trick. Similarly, one could have elements such as (:BYTE (HIGH tone-entry)), representing the high-order byte of the tone-entry address, and allowing arbitrary link-time math.</p>
<p>As for the code itself, it has <strike>the same</strike> similar semantics as the Red book routine.[UPDATE: but not quite. See more recent post for correction.] It has a somewhat minor change in that the DEY is followed by a BNE in the original code (taken 255 out of 256 times), and by a BEQ in the COMFY version (taken only 1 out of 256 times). Any difference in the execution time will, of course, change the pitch emitted. More serious is the fact that COMFY, as coded, is biased toward forward conditional branches. The two JMP instructions after the RTS are reached only through branches that could reach their destination directly. COMFY compiles, as I mentioned, from the last instruction toward the first. Forward branches are trivially resolved, but backward branches don&#8217;t know their destination, in particular, whether the destination is a short branch away or not. The backward JMPs are created by the code for LOOP, which first emits a &#8220;placeholder&#8221; absolute jump, compiles the loop forms, including branches that might land on that jump, then patches the JMP destination to point to the first form of the LOOP.</p>
<p>That suggests that LOOP might be enhanced to include a &#8220;loop-tightening&#8221; phase which examines the body of the loop for forward branches (:BRANCH x) to jumps (:LONG-BRANCH y), and if x+y+1 is within range of a short branch, replaces it. (The +1 is for the JMP opcode itself.) The result would be</p>
<pre class="brush: jscript;">
(; reload pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE #XC030)
; spin
 (DEY)
 (BEQ) (:BRANCH 6) ; duration-tick
 (DEX)
 (BNE) (:BRANCH -5) ; spin
 (BEQ) (:BRANCH -12) ; reload-pitch
; duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH -11) ; spin
 (RTS)
 (JMP :ABSOLUTE) (:LONG-BRANCH -14)
 (JMP :ABSOLUTE) (:LONG-BRANCH -22))</pre>
<p>The two JMPs are now unused. This is a special case, because RTS is itself a jump. Because LOOP knows that it freshly emitted the JMP, no external code can properly reference it. If all the branches to it have been patched, and the last instruction cannot reach it, the JMP itself can be omitted.Assuming I can convince COMFY to be smart enough to omit the (proven) redundant JMPs, we are ready for comparison. Let&#8217;s re-write the original code to match the explicit X initialization, and use COMFY&#8217;s discovery that moving the LDX to the front of the loop means the absolute JMP $0002 in the original can be replaced by a BEQ.</p>
<pre class="brush: jscript;">
reload-pitch LDX PITCH
             LDA $CO30
spin         DEY
             BNE not-tick ; actually, takes branch more often
; duration-tick
             DEC duration
             BEQ return
not-tick     DEX
             BNE spin
             BEQ reload-pitch ; save a byte compared to original JMP
return       RTS</pre>
<p>COMFY, with the yet-to-be-implemented loop tightening has made the code one byte shorter, and relocatable.As mentioned before, COMFY has luckily or unluckily chosen the branch after DEY to be taken infrequently, while the author of the tone routine chose it to be taken frequently. We cannot know whether the author de-optimized to reach a lower pitch range. If so, to match the timing more closely, I can reverse the sense of the IF, causing it to emit a BNE. In this case, the hypothetical loop-tightening can eliminate one JMP, but not the other.</p>
<pre class="brush: jscript;">
(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
; spin
 (DEY)
 (BNE) (:BRANCH 6) ; not-duration
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH -6) ; spin
 (RTS)
; not-duration
 (DEX)
 (BEQ) (:BRANCH -15) ; reload-pitch
; goto-spin
 (JMP :ABSOLUTE) (:LONG-BRANCH -12)</pre>
<p>We see this simple change affected the DEY test, but also affected the DEX test, biasing it to be taken less frequently.  Perhaps an annotation could added to the COMFY language to indicate &#8220;please prefer (or expect?) this test to win/lose.&#8221; This would disrupt the tight recursive elegance of the GENBRC routine, but it might prove handy in modern architectures with their branch-prediction tendencies. It is also not so simple to change the test after DEC (:ZERO-PAGE 1) to BEQ to the RTS. That would require moving the RTS to be emitted at the end, i.e. compiled by COMFY first. I&#8217;m more interested in implementing the loop-tightening logic than attacking that brain-teaser right now.The moral may be that COMFY (plus yet-to-be-implemented optimization passes) can emit code very much in the ballpark of humans, at least for these toy examples. For cycle-level timing, however, I might follow the lead of Sassy and allow for the human to code branches and jumps explicitly. (Sassy&#8217;s example &#8220;boot sector&#8221; code actually avoids pretty much all the COMFY primitives; however, the documentation also seems to suggest that loop tightening and similar optimizations have been implemented there.) And I have yet to successfully translate Woz&#8217;s code into COMFY, probably because I have to understand it first.(Note to self: AVOID the tempting WordPress &#8220;code&#8221; button. Use the <a href="http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/" title="How do I post sourcecode" target="_blank">sourcecode tag</a>, although it supports neither assembler nor Lisp.)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Another interesting mid-level assembler]]></title>
<link>http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/</link>
<pubDate>Mon, 17 Dec 2007 14:03:17 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/</guid>
<description><![CDATA[While I&#8217;m still digesting COMFY in my &#8220;ample spare time,&#8221; a post on comp.sys.apple]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>While I&#8217;m still digesting COMFY in my &#8220;ample spare time,&#8221; a <a href="http://groups.google.com/group/comp.sys.apple2/msg/a3eadb2e419930dd?" title="Announcement of SPL on comp.sys.apple2" target="_blank">post on comp.sys.apple2 mentioned some assemblers from &#8220;Ron&#8221; having a similar flavor</a>: <a href="http://home.comcast.net/~oneelkruns/" title="SPL assembler for the 6502, PIC0 assembler for PIC" target="_blank">SPL for the 6502 and PIC0 for PIC 10F2xx microcontrollers</a>. They are apparently implemented in Python, and inspired by Forth. They emit assembler.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[I take back some of what I said about Cedega....]]></title>
<link>http://mikepee.wordpress.com/2007/11/16/i-take-back-some-of-what-i-said-about-cedega/</link>
<pubDate>Fri, 16 Nov 2007 19:27:56 +0000</pubDate>
<dc:creator>mikepee</dc:creator>
<guid>http://mikepee.wordpress.com/2007/11/16/i-take-back-some-of-what-i-said-about-cedega/</guid>
<description><![CDATA[The following is a copy of my post from the cedega forum (abridged): Like everyone here I think we a]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The following is a copy of my post from the cedega forum (abridged):</p>
<p><em>Like everyone here I think we are dedicated to the cause (*nix+dx=gaming &#8211; cause we have to) and are willing to put our money where our mouth is.  We just want Cedega to put our money where the development is.  It&#8217;s like a union, we pay our dues now go sock it to the man(M$)!  It just occured to me that (M)arket ($)hare and (M)icro(S)oft&#8230; well you get it.</p>
<p>&#8212;-I&#8217;M A WIND BAD SO YOU CAN STOP READING HERE&#8212;-</p>
<p>#WARNING: I&#8217;M ON STEROIDS, WHICH IS LIKE SPEED&#8212;-<br />
#I CAN&#8217;T AND WON&#8217;T SHUT UP&#8212;-<br />
#-SOAP BOX + CANCER + PASSION = RAMBLING IDIOT&#8212;-</p>
<p># NOTE THE &#8216;#&#8217; I DID THAT FOR YOU SCRIPT/PROGRAMMER TYPES</p>
<p>A comment on the state of the union.  With Apple/*nix/Intel architecture in play, Windows LaVista hatred at all time high (I own a company that fixes computers (think geek squad but smaller)), and distros of linux that are so easy to install and maintain that your mom could do it.    It&#8217;s long assumed that any true developer/software engineer is already a *nix geek.  You add this up and it smells like all you need is the idiots that push the $$$$$ around to agree.  It&#8217;s the same reason every other movie is a squeal or based a TV show or is a complete rehack.  The dudes with the $$$$ have abandoned the creative risk takers and are all standing around the same vanilla ice cream cone patting each other on the backs.  Every once a while one of them throws us bone.  I pray for a revolution, like that of a Francis Ford Coppola movie studio reformation&#8230; the key was we bought it!  We bought The Godfather, Star Wars, Taxi Driver, Jaws we bought it all.  These filmmakers revolutionized our modern movie experience.  They are the reason we say filmmaker.</p>
<p>Y2K.  We thought the bug was a two digit disaster.  To me Y2K (circa 98~01) is the end of a lifestyle.  No idiots getting their patties in a bunch over Islam/Air Travel and freedom. Most people still are clueless about computers but they have herd about this internet thing.  Before Y2K we used a phone book.  Last time I got my phone book I just threw it in the garbage.  M$ still didn&#8217;t think you could make money giving anything away.  And I was still pining over the fact that my Atari 800XL and C64 still could play some pretty sweet games if only they&#8217;d make some!  6502.  If you read 6502 and it makes you feel something, we are brothers in arms.  We fought that war together.  (If know who Jay Miner was&#8230; well that&#8217;s enough I guess)</p>
<p>I hate MMORPG games but if we all start playing Eve from our Linux boxes those vanilla licking $$$$ dudes will say, &#8220;hey now that looks like a good flavor.&#8221;  I sure hope Eve is a totally bad ass game and inspires a thousands linux users to open their wallets.  If that happens.  I forgive all cedga&#8217;s short falls for this cancer of the summer of 2007.  I&#8217;m already in line&#8230; that&#8217;s the &#8216;thanks for everything, now I feel 2 inches tall, you are the visionary not me.&#8217; line.</p>
<p>Well I&#8217;m at it, if your still reading, which a part of me hopes you are not, a theory that I&#8217;m sure many subscribe to.  The XBox ruined PC gaming and M$ ruined a profitable reason for the industry to keep upgrading the crap out of their computers with it.  From the circa 95 till 2000 PC gaming was where it was at!  (And if your me, it really starts in &#8216;83 with the Atari 800XL) I believe it still is except where the hell are the games!  The GTA franchise would not exist if not for PC gaming.  Do you know how pissed off I get when I have to wait a year to play a new game that owes it&#8217;s existence and success to the PC platform!  The PC is a sandbox for the stupid and questionable ideas but once you find a piece of gold in the sand box don&#8217;t stop looking!  I guess I should feel exalted that the developer would still waste his time port the game over to the PC&#8230; I should be thanking them for what little crap they still throw our way.  Perfect example&#8230; do you know how badly made the Splinter Cell 4 game is for the PC!  No fix.  You actually have to have Internet Explorer open to play the game past level 3.  Why?  Don&#8217;t know.  Never saw a single article that told me that.  It was a total accident that it happened.  Then I got to a safe on level 5 and the game controls will not work to open the safe in the game!  This is a title that works awesome on the XBox360.  I got screwed out $50 for the game.</p>
<p>Word.</p>
<p>-Mike</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Baker's COMFY: a few notes]]></title>
<link>http://jaoswald.wordpress.com/2007/11/03/bakers-comfy-a-few-notes/</link>
<pubDate>Sat, 03 Nov 2007 21:22:57 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/11/03/bakers-comfy-a-few-notes/</guid>
<description><![CDATA[I&#8217;ve been working a bit with Baker&#8217;s COMFY-6502 code; a few notes of what I have learned]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve been working a bit with Baker&#8217;s COMFY-6502 code; a few notes of what I have learned so far.</p>
<p>First, a couple of tiny bugs in the genbrc; the code miscounts the size of the branch instructions, meaning that (- l 2) should be a (+ l 2) and so on. I found it handy to enumerate each clause of the cond. Each clause handles a particular case, such as when the &#8220;lose&#8221; continuation can be reached by a short branch instruction, while the &#8220;win&#8221; continuation is far enough away to require an absolute jump.</p>
<p>Second, genbrc, genbr, and compile all provide the address of the resulting &#8220;continuation&#8221; as the return value. This is perhaps clear when one traces out all the recursion, but it isn&#8217;t explicitly mentioned. One interesting case is genbrc when the &#8220;win&#8221; and &#8220;lose&#8221; branch destinations are the same: one could simply emit an unconditional branch to that destination, and return the address of that branch but actually returning the destination works just as well. (In the emit routine, if the continuation does not happen to be the next instruction, the unconditional branch is, after all, emitted, moving the continuation to the front of the instruction stream, ready for the non-branching instruction to be emitted just in front of it.)</p>
<p>As for &#8220;upgrades&#8221; to the package, I have been focused up to this point on moving the knowledge of 6502 opcodes and addressing modes from magic decimal numbers to symbolic processing. Instead of simply emitting a decimal opcode, I have been changing the code to emit symbolic opcodes, such as (ADC ABSOLUTE), with routines to reduce these symbolic forms to the appropriate opcode, including checking for invalid opcodes. Baker&#8217;s original code will happily emit opcodes with addressing modes not supported by the chip. Currently, the compiler emits these symbolic codes into the code vector, awaiting a processing step to convert them to the decimal equivalent. Ideally, one would detect invalid addressing modes in the compilation stage, not the post-processing stage.</p>
<p>Some other changes I am contemplating are allowing for symbolic jump destinations, so that object code can be relocated and external labels could be used to relax the restrictions of the current scheme, which requires manually sequencing compilation and storing of addresses.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[DIY 6502 Computers]]></title>
<link>http://xbelanch.wordpress.com/2006/09/18/diy-6502-computers/</link>
<pubDate>Mon, 18 Sep 2006 20:35:08 +0000</pubDate>
<dc:creator>Javier Belanche Alonso</dc:creator>
<guid>http://xbelanch.wordpress.com/2006/09/18/diy-6502-computers/</guid>
<description><![CDATA[Artículo en formato hipertexto de la fabricación de un prototipo de ordenador con micro 6502. El art]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Artículo en formato hipertexto de la fabricación de un prototipo de ordenador con micro 6502. El artículo apareció en la revista &#8220;The Computer Journal&#8221;, ahora desaparecida.</p>
<p><a href="http://www.hytherion.com/beattidp/comput/x65tools/diy6502/diy6502.htm">http://www.hytherion.com/beattidp/comput/x65tools/diy6502/diy6502.htm </a></p>
<p>Interesados en ejemplos de prototipos de ordenadores con micro 6502, en la línea DIY (Do It Yourself):</p>
<p><a href="http://www.6502.org/homebuilt/ ">http://www.6502.org/homebuilt/ </a></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
