<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Create your own Version of Microsoft BASIC for 6502</title>
	<atom:link href="http://www.pagetable.com/?feed=rss2&#038;p=46" rel="self" type="application/rss+xml" />
	<link>http://www.pagetable.com/?p=46</link>
	<description>Some Assembly Required</description>
	<lastBuildDate>Thu, 09 Sep 2010 09:36:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: goob</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-102525</link>
		<dc:creator>goob</dc:creator>
		<pubDate>Sun, 07 Mar 2010 20:13:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-102525</guid>
		<description>You guys are demented.

The CC65 compiler + VICE C128 emulator is a great way to verify pure C code segments within limited hardware for designing compact platform independent embedded applications...

...but what the hell am I going to do with Microsoft BASIC coded in 6502 assembly!

You guys need something better to do with your time, seriously :-)</description>
		<content:encoded><![CDATA[<p>You guys are demented.</p>
<p>The CC65 compiler + VICE C128 emulator is a great way to verify pure C code segments within limited hardware for designing compact platform independent embedded applications&#8230;</p>
<p>&#8230;but what the hell am I going to do with Microsoft BASIC coded in 6502 assembly!</p>
<p>You guys need something better to do with your time, seriously :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harry Dodgson</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-102366</link>
		<dc:creator>Harry Dodgson</dc:creator>
		<pubDate>Wed, 17 Feb 2010 16:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-102366</guid>
		<description>I just tried:
35072121 PRINT &quot;HI&quot; on AIM-65 BASIC and all I get is an &quot;?SN ERROR&quot;
Does that mean it is fixed?</description>
		<content:encoded><![CDATA[<p>I just tried:<br />
35072121 PRINT &#8220;HI&#8221; on AIM-65 BASIC and all I get is an &#8220;?SN ERROR&#8221;<br />
Does that mean it is fixed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralf</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-101194</link>
		<dc:creator>Ralf</dc:creator>
		<pubDate>Fri, 27 Nov 2009 20:37:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-101194</guid>
		<description>Anyone knows of a similar endeavor for the x86 based BASIC(A)/GW-BASIC?</description>
		<content:encoded><![CDATA[<p>Anyone knows of a similar endeavor for the x86 based BASIC(A)/GW-BASIC?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wim</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-99757</link>
		<dc:creator>Wim</dc:creator>
		<pubDate>Mon, 16 Mar 2009 13:59:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-99757</guid>
		<description>Anybody already worked on a R65C02 source for CBM-BASIC, making use of the STZ, PHX, SMB, RMB etc opcodes ?</description>
		<content:encoded><![CDATA[<p>Anybody already worked on a R65C02 source for CBM-BASIC, making use of the STZ, PHX, SMB, RMB etc opcodes ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Barr&#8217;s Blog &#187; Links for Monday, March 1, 2009</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-99638</link>
		<dc:creator>Jeff Barr&#8217;s Blog &#187; Links for Monday, March 1, 2009</dc:creator>
		<pubDate>Mon, 02 Mar 2009 13:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-99638</guid>
		<description>[...] PageTable.com: Create your own Version of Microsoft BASIC for 6502 - &#8220;This article also presents a set of assembly source files that can be made to compile into a byte exact copy of seven different versions of Microsoft BASIC, and lets you even create your own version.&#8220; [...]</description>
		<content:encoded><![CDATA[<p>[...] PageTable.com: Create your own Version of Microsoft BASIC for 6502 &#8211; &#8220;This article also presents a set of assembly source files that can be made to compile into a byte exact copy of seven different versions of Microsoft BASIC, and lets you even create your own version.&#8220; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 7 BASICs 6502 pour le prix d'un &#124; hilpers</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-99207</link>
		<dc:creator>7 BASICs 6502 pour le prix d'un &#124; hilpers</dc:creator>
		<pubDate>Sat, 17 Jan 2009 20:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-99207</guid>
		<description>[...] 7 BASICs 6502 pour le prix d&#039;un     C&#039;est ŕ dire 0 http://www.pagetable.com/?p=46 [...]</description>
		<content:encoded><![CDATA[<p>[...] 7 BASICs 6502 pour le prix d&#8217;un     C&#8217;est ŕ dire 0 <a href="http://www.pagetable.com/?p=46" rel="nofollow">http://www.pagetable.com/?p=46</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: M-ko</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98555</link>
		<dc:creator>M-ko</dc:creator>
		<pubDate>Mon, 24 Nov 2008 18:46:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98555</guid>
		<description>Working on figuring it out so I can have M$ BASIC on my virtual 6502 platforms.  Haven&#039;t yet. :/</description>
		<content:encoded><![CDATA[<p>Working on figuring it out so I can have M$ BASIC on my virtual 6502 platforms.  Haven&#8217;t yet. :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Big Mess o&#8217; Wires &#187; BASIC?</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98415</link>
		<dc:creator>Big Mess o&#8217; Wires &#187; BASIC?</dc:creator>
		<pubDate>Wed, 19 Nov 2008 03:46:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98415</guid>
		<description>[...] BASIC from the ROM image, or write my own, but then I found something much better. These guys have reverse-engineered 7 different versions of Microsoft BASIC, creating a set of well-documented 6502 assembly source files. It&#8217;s probably nearly as good [...]</description>
		<content:encoded><![CDATA[<p>[...] BASIC from the ROM image, or write my own, but then I found something much better. These guys have reverse-engineered 7 different versions of Microsoft BASIC, creating a set of well-documented 6502 assembly source files. It&#8217;s probably nearly as good [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Chamberlin</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98357</link>
		<dc:creator>Steve Chamberlin</dc:creator>
		<pubDate>Sat, 15 Nov 2008 05:28:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98357</guid>
		<description>This is fantastic! I&#039;m finishing a homemade 8-bit computer with a homemade microcoded CPU, and planning to get BASIC running on it. My computer&#039;s instruction set is a superset of the 6502, so in theory I should be able to start with one of the plain vanilla 6502 BASICs here, plug in my own character read/write routines, and have something up and running. I had feared I&#039;d need to reverse-engineer an exising BASIC, or write my own, but this will make my life much easier. I can&#039;t wait to get BASIC running on my machine... thanks!</description>
		<content:encoded><![CDATA[<p>This is fantastic! I&#8217;m finishing a homemade 8-bit computer with a homemade microcoded CPU, and planning to get BASIC running on it. My computer&#8217;s instruction set is a superset of the 6502, so in theory I should be able to start with one of the plain vanilla 6502 BASICs here, plug in my own character read/write routines, and have something up and running. I had feared I&#8217;d need to reverse-engineer an exising BASIC, or write my own, but this will make my life much easier. I can&#8217;t wait to get BASIC running on my machine&#8230; thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Kingsley</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98264</link>
		<dc:creator>Jeff Kingsley</dc:creator>
		<pubDate>Wed, 05 Nov 2008 07:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98264</guid>
		<description>Wow, what a trip back in time! My very first exposure to computers was a KIM-1 while I was doing undergrad research for a chemistry professor. He handed me a book on assembly language for the 6502 and told me to write a monitor program that would get input from the user, dial up the campus mainframe (acoustic 300 baud modem) and upload gas phase electron diffraction data that the KIM-1 had just collected.

I was instantly hooked on programming these new fangled computer gizmos. I bought myself an AIM-65 and all the bells and whistles (16kB RAM, extender board, ROM basic and assembler, etc). I bought a suitcase and mounted the entire thing inside so that I had a &#039;portable&#039; computer.

On the KIM-1, in addition to assembler, we also had MS Basic (on tape of course). There was some floating point math that the computer did prior to uploading the data. We wanted to speed this up so we interfaced an AMD9511 Math chip to the KIM-1 and then put hooks into MS Basic to use the chip instead of the FP routines. Worked great! 

A couple of years later I did something similar when the 8087 first came out for the IBM-PC. I created an alternate object library for the MS compilers that used the 8087 instead of the FP routines. I had to convert back and forth between MS FP format and IEEE format, but with my experience on the KIM-1 it was no problem. I got my first pre-production 8087 from a company that had given up doing that very thing due to their frustration in trying to convert the FP formats.

Thanks for the memory jog!</description>
		<content:encoded><![CDATA[<p>Wow, what a trip back in time! My very first exposure to computers was a KIM-1 while I was doing undergrad research for a chemistry professor. He handed me a book on assembly language for the 6502 and told me to write a monitor program that would get input from the user, dial up the campus mainframe (acoustic 300 baud modem) and upload gas phase electron diffraction data that the KIM-1 had just collected.</p>
<p>I was instantly hooked on programming these new fangled computer gizmos. I bought myself an AIM-65 and all the bells and whistles (16kB RAM, extender board, ROM basic and assembler, etc). I bought a suitcase and mounted the entire thing inside so that I had a &#8216;portable&#8217; computer.</p>
<p>On the KIM-1, in addition to assembler, we also had MS Basic (on tape of course). There was some floating point math that the computer did prior to uploading the data. We wanted to speed this up so we interfaced an AMD9511 Math chip to the KIM-1 and then put hooks into MS Basic to use the chip instead of the FP routines. Worked great! </p>
<p>A couple of years later I did something similar when the 8087 first came out for the IBM-PC. I created an alternate object library for the MS compilers that used the 8087 instead of the FP routines. I had to convert back and forth between MS FP format and IEEE format, but with my experience on the KIM-1 it was no problem. I got my first pre-production 8087 from a company that had given up doing that very thing due to their frustration in trying to convert the FP formats.</p>
<p>Thanks for the memory jog!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pagetable.com &#187; Blog Archive &#187; Commodore BASIC as a Scripting Language for UNIX and Windows - now Open Source</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98254</link>
		<dc:creator>pagetable.com &#187; Blog Archive &#187; Commodore BASIC as a Scripting Language for UNIX and Windows - now Open Source</dc:creator>
		<pubDate>Wed, 05 Nov 2008 01:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98254</guid>
		<description>[...] Create your own Version of Microsoft BASIC for 6502 [...]</description>
		<content:encoded><![CDATA[<p>[...] Create your own Version of Microsoft BASIC for 6502 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Sander-Cederlof</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98119</link>
		<dc:creator>Bob Sander-Cederlof</dc:creator>
		<pubDate>Fri, 31 Oct 2008 00:41:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98119</guid>
		<description>I thoroughly enjoyed reading this, and also the Easter Egg article. Thanks for all your work researching and writing.</description>
		<content:encoded><![CDATA[<p>I thoroughly enjoyed reading this, and also the Easter Egg article. Thanks for all your work researching and writing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Otten</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98101</link>
		<dc:creator>Hans Otten</dc:creator>
		<pubDate>Thu, 30 Oct 2008 17:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98101</guid>
		<description>Great job!
I have been playing with KIM-1 Microsoft Basic long long ago, bought an original version on tape before 1980  and it still loads. (eh, it did two years ago :) . 
With the aid of  a commented disassembly of PET Basic I could understand the workings, like the jumps into 3 byte instructions! and improve some nasty shortcomings in KIM Basic, like no working save and load.

What about SYM-1 and AIM-65 Basic? What I have seen of those versions I suppose it somewhere in the 1.1 branch, but much better integrated with the SYM-1 and AIM-65 operatings system.</description>
		<content:encoded><![CDATA[<p>Great job!<br />
I have been playing with KIM-1 Microsoft Basic long long ago, bought an original version on tape before 1980  and it still loads. (eh, it did two years ago :) .<br />
With the aid of  a commented disassembly of PET Basic I could understand the workings, like the jumps into 3 byte instructions! and improve some nasty shortcomings in KIM Basic, like no working save and load.</p>
<p>What about SYM-1 and AIM-65 Basic? What I have seen of those versions I suppose it somewhere in the 1.1 branch, but much better integrated with the SYM-1 and AIM-65 operatings system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harry Dodgson</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98084</link>
		<dc:creator>Harry Dodgson</dc:creator>
		<pubDate>Thu, 30 Oct 2008 10:50:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98084</guid>
		<description>Here is a hybrid version:

AIM 65 BASIC V1.1 (C) 1978 MICROSOFT has 9 digit FP,GET, and ROR - but only 2 char error messages.  It was shipped in 8K of ROM with the ATN() function left off for users to install to RAM if they wanted it.  The message in caps is at the end of the ROM.  Only the first part prints on startup.</description>
		<content:encoded><![CDATA[<p>Here is a hybrid version:</p>
<p>AIM 65 BASIC V1.1 (C) 1978 MICROSOFT has 9 digit FP,GET, and ROR &#8211; but only 2 char error messages.  It was shipped in 8K of ROM with the ATN() function left off for users to install to RAM if they wanted it.  The message in caps is at the end of the ROM.  Only the first part prints on startup.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bleuge - 76 tunguskas por minuto</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98016</link>
		<dc:creator>bleuge - 76 tunguskas por minuto</dc:creator>
		<pubDate>Mon, 27 Oct 2008 15:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98016</guid>
		<description>[...] lean esto y en general los artĂ­culos posteriores, donde se desemsambla y disecciona minuciosamente las [...]</description>
		<content:encoded><![CDATA[<p>[...] lean esto y en general los artĂ­culos posteriores, donde se desemsambla y disecciona minuciosamente las [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geeknews &#187; Create Your Own Version of Microsoft BASIC for 6502</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98014</link>
		<dc:creator>Geeknews &#187; Create Your Own Version of Microsoft BASIC for 6502</dc:creator>
		<pubDate>Mon, 27 Oct 2008 07:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98014</guid>
		<description>[...] walks you through the process of recompiling a byte exact copy of seven different versions of Microsoft BASIC, such as Applesoft, [...]</description>
		<content:encoded><![CDATA[<p>[...] walks you through the process of recompiling a byte exact copy of seven different versions of Microsoft BASIC, such as Applesoft, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Microsoft Basic, Computer Archeology &#124; Hans' blog</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-98007</link>
		<dc:creator>Microsoft Basic, Computer Archeology &#124; Hans' blog</dc:creator>
		<pubDate>Sun, 26 Oct 2008 19:24:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-98007</guid>
		<description>[...] who blogs at http://www.pagetable.com, refers to my online filesÂ while explaing not only the history and timelines of these Basic interpreter versions, but also publishes the commented [...]</description>
		<content:encoded><![CDATA[<p>[...] who blogs at <a href="http://www.pagetable.com" rel="nofollow">http://www.pagetable.com</a>, refers to my online filesÂ while explaing not only the history and timelines of these Basic interpreter versions, but also publishes the commented [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Zbiciak</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97981</link>
		<dc:creator>Joe Zbiciak</dc:creator>
		<pubDate>Wed, 22 Oct 2008 17:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97981</guid>
		<description>Eeek, my formatting got eaten.  To see it with proper formatting, look here:

http://community.livejournal.com/vintagecomputer/66963.html?thread=314771#t314771</description>
		<content:encoded><![CDATA[<p>Eeek, my formatting got eaten.  To see it with proper formatting, look here:</p>
<p><a href="http://community.livejournal.com/vintagecomputer/66963.html?thread=314771#t314771" rel="nofollow">http://community.livejournal.com/vintagecomputer/66963.html?thread=314771#t314771</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Zbiciak</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97980</link>
		<dc:creator>Joe Zbiciak</dc:creator>
		<pubDate>Wed, 22 Oct 2008 17:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97980</guid>
		<description>I&#039;m still musing over some of the unique aspects of the Intellivision Keyboard port.  The Keyboard is such an interesting beast, to be sure.  At least knowing the structure of Microsoft BASIC made it easy to intuit what the Keyboard-specific bits were trying to accomplish, even if I wasn&#039;t sure &lt;I&gt;how&lt;/I&gt; they were accomplishing them.  A prime example is in kbd_iscntc.s:
ISCNTC:
        jsr     LE8F3
        bcc     RET1
LE633:
        jsr     LDE7F
        beq     STOP
        cmp     #$03
        bne     LE633This code checks for a control-C, and is supposed to branch to an RTS instruction if no ^C is pending.  A cursory inspection of the above code indicates that the function at LE8F3 returns w/ carry set if there is a ^C pending.  But what does it do?  The code is mysteriously tacked in the end of print.s:
LE8F3:
        pha
        lda     $047F
        clc
        beq     LE900
        lda     #$00
        sta     $047F
        sec
LE900:
        pla
        rts
This checks location $047F to see if it&#039;s non-zero.  If it&#039;s non-zero, then it zeros it and returns with carry set, indicating (and acknowledging) ^C or some other error.  The rest of the ISCNTC code just drains the keyboard input FIFO either up until the ^C, or until it&#039;s empty.  (Trust me on that one.)

But where does $047F get set?  The only reference I can find is in a timer tick interrupt in the KC&#039;s 6502-side EXEC, where $047F gets counted down toward zero!  Take a look:
C1CB  AD 7F 04  LDA $047F       ; \
C1CE  F0 03     BEQ $C1D3       ;  &#124;-- If $047F isn&#039;t zero yet, decrement it
C1D0  CE 7F 04  DEC $047F       ; /
So what the heck is going on here?  I&#039;ve seen lots of references to locations to either side of $047F, but never $047F itself.  If this really does get decremented every tick, maybe it gets set to $FF on an error, and the error expires after ~4 seconds???

Clearly, I still haven&#039;t figured out all of the communication paths between the Master Component and the Keyboard Component, nor have I figured out where all the different flags get set from.  It&#039;s definitely an adventure reverse engineering an OS that spans two different CPU types, and includes such bizarre things as 10-bit wide RAM shared between them.  :-)

I really just ought to publish what I have reverse-engineering-wise and see what more eyes might bring.</description>
		<content:encoded><![CDATA[<p>I&#8217;m still musing over some of the unique aspects of the Intellivision Keyboard port.  The Keyboard is such an interesting beast, to be sure.  At least knowing the structure of Microsoft BASIC made it easy to intuit what the Keyboard-specific bits were trying to accomplish, even if I wasn&#8217;t sure <i>how</i> they were accomplishing them.  A prime example is in kbd_iscntc.s:<br />
ISCNTC:<br />
        jsr     LE8F3<br />
        bcc     RET1<br />
LE633:<br />
        jsr     LDE7F<br />
        beq     STOP<br />
        cmp     #$03<br />
        bne     LE633This code checks for a control-C, and is supposed to branch to an RTS instruction if no ^C is pending.  A cursory inspection of the above code indicates that the function at LE8F3 returns w/ carry set if there is a ^C pending.  But what does it do?  The code is mysteriously tacked in the end of print.s:<br />
LE8F3:<br />
        pha<br />
        lda     $047F<br />
        clc<br />
        beq     LE900<br />
        lda     #$00<br />
        sta     $047F<br />
        sec<br />
LE900:<br />
        pla<br />
        rts<br />
This checks location $047F to see if it&#8217;s non-zero.  If it&#8217;s non-zero, then it zeros it and returns with carry set, indicating (and acknowledging) ^C or some other error.  The rest of the ISCNTC code just drains the keyboard input FIFO either up until the ^C, or until it&#8217;s empty.  (Trust me on that one.)</p>
<p>But where does $047F get set?  The only reference I can find is in a timer tick interrupt in the KC&#8217;s 6502-side EXEC, where $047F gets counted down toward zero!  Take a look:<br />
C1CB  AD 7F 04  LDA $047F       ; \<br />
C1CE  F0 03     BEQ $C1D3       ;  |&#8211; If $047F isn&#8217;t zero yet, decrement it<br />
C1D0  CE 7F 04  DEC $047F       ; /<br />
So what the heck is going on here?  I&#8217;ve seen lots of references to locations to either side of $047F, but never $047F itself.  If this really does get decremented every tick, maybe it gets set to $FF on an error, and the error expires after ~4 seconds???</p>
<p>Clearly, I still haven&#8217;t figured out all of the communication paths between the Master Component and the Keyboard Component, nor have I figured out where all the different flags get set from.  It&#8217;s definitely an adventure reverse engineering an OS that spans two different CPU types, and includes such bizarre things as 10-bit wide RAM shared between them.  :-)</p>
<p>I really just ought to publish what I have reverse-engineering-wise and see what more eyes might bring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Abbatiello</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97967</link>
		<dc:creator>James Abbatiello</dc:creator>
		<pubDate>Wed, 22 Oct 2008 03:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97967</guid>
		<description>Update: I tried an OSI C1P emulator and it doesn&#039;t allow you to enter the line &quot;10 PRINT [FF]&quot; (where [FF] is the character with code 0xFF).  It just drops it silently and deletes any existing definition for line 10 if there is one.  If I manually edit the memory to include that statement it produces an error at runtime.  So it seems there is no need for the FF special case in the OSI.</description>
		<content:encoded><![CDATA[<p>Update: I tried an OSI C1P emulator and it doesn&#8217;t allow you to enter the line &#8220;10 PRINT [FF]&#8221; (where [FF] is the character with code 0xFF).  It just drops it silently and deletes any existing definition for line 10 if there is one.  If I manually edit the memory to include that statement it produces an error at runtime.  So it seems there is no need for the FF special case in the OSI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Abbatiello</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97966</link>
		<dc:creator>James Abbatiello</dc:creator>
		<pubDate>Wed, 22 Oct 2008 00:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97966</guid>
		<description>CONFIG_DATAFLG is for machines with 8-bit character sets.  Tokens are stored internally as bytes with the high bit set.  When you LIST a program and it sees a byte with the high bit set it normally prints out the string representation of the token.  With CONFIG_DATAFLG on it keeps track of whether you are in a quoted string and prints the token if you aren&#039;t or the literal character if you are.  This lets you have literal strings containing characters with the high bit set and still have your programs list properly.

It also causes the character 0xFF to list literally whether it is in a string or not.  On the Commodore 0xFF is the character for pi and you can use it as a constant.  The program
  10 PRINT Ď
will print out 3.14159265 when run.  When this program is LISTed we want the character to print literally and not be interpreted as a token (0xFF is not assigned to any token).

The OSI machine seems to have a small picture of a tank pointing up and to the left at 0xFF.  The special case may have been included in the OSI due to an oversight.  I don&#039;t know if you get 3.14159265 if you try to evaluate it.</description>
		<content:encoded><![CDATA[<p>CONFIG_DATAFLG is for machines with 8-bit character sets.  Tokens are stored internally as bytes with the high bit set.  When you LIST a program and it sees a byte with the high bit set it normally prints out the string representation of the token.  With CONFIG_DATAFLG on it keeps track of whether you are in a quoted string and prints the token if you aren&#8217;t or the literal character if you are.  This lets you have literal strings containing characters with the high bit set and still have your programs list properly.</p>
<p>It also causes the character 0xFF to list literally whether it is in a string or not.  On the Commodore 0xFF is the character for pi and you can use it as a constant.  The program<br />
  10 PRINT Ď<br />
will print out 3.14159265 when run.  When this program is LISTed we want the character to print literally and not be interpreted as a token (0xFF is not assigned to any token).</p>
<p>The OSI machine seems to have a small picture of a tank pointing up and to the left at 0xFF.  The special case may have been included in the OSI due to an oversight.  I don&#8217;t know if you get 3.14159265 if you try to evaluate it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Steil</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97963</link>
		<dc:creator>Michael Steil</dc:creator>
		<pubDate>Tue, 21 Oct 2008 19:19:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97963</guid>
		<description>@Mike: Yes, the source shows that this was fixed in Intellivision BASIC:

program.s:
&lt;pre&gt;
        lda     ERROR_MESSAGES+1,x
  .ifdef KBD
        and     #$7F
  .endif
        jsr     OUTDO
&lt;/pre&gt;

The &quot;.ifdef KBD&quot; should probably be an &quot;.ifdef CONFIG_2&quot;.</description>
		<content:encoded><![CDATA[<p>@Mike: Yes, the source shows that this was fixed in Intellivision BASIC:</p>
<p>program.s:</p>
<pre>
        lda     ERROR_MESSAGES+1,x
  .ifdef KBD
        and     #$7F
  .endif
        jsr     OUTDO
</pre>
<p>The &#8220;.ifdef KBD&#8221; should probably be an &#8220;.ifdef CONFIG_2&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Cohen</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97961</link>
		<dc:creator>Mike Cohen</dc:creator>
		<pubDate>Tue, 21 Oct 2008 15:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97961</guid>
		<description>One interesting quirk of OSI basic was how it displayed the two-letter error codes. The codes were stored internally with the high bit set on the second character. Since OSI systems used the high bit for graphics characters, it displayed a graphic character for the second character. I remember seeing lots of &#039;SËŠ Error&#039; messages :)</description>
		<content:encoded><![CDATA[<p>One interesting quirk of OSI basic was how it displayed the two-letter error codes. The codes were stored internally with the high bit set on the second character. Since OSI systems used the high bit for graphics characters, it displayed a graphic character for the second character. I remember seeing lots of &#8216;SËŠ Error&#8217; messages :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97958</link>
		<dc:creator>Marco</dc:creator>
		<pubDate>Tue, 21 Oct 2008 10:38:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97958</guid>
		<description>- I still can&#039;t figure out, why you can use c-style comments in your source. But since putting a semicolon in front of /* suffices, I won&#039;t bother.
- My checksums are OK.
- Thanks for your suggestions regarding xpet. This seems to work. I&#039;ve written a script to launch xpet for the current build of cbmbasic2:
#!/bin/sh
mkdir -p pet
vice_dir=$(dirname $(readlink -f $(which xpet)))/..
cp $vice_dir/lib/vice/PET/edit2g pet
cp $vide_dir/lib/vice/PET/basic2 pet
dd if=tmp/cbmbasic2.bin of=pet/basic2 bs=1 count=8192
dd if=tmp/cbmbasic2.bin of=pet/edit2g conv=notrunc bs=1 skip=8192
xpet -model 3032 -basic pet/basic2 -editor pet/edit2g
#---

Apart from that: great work!</description>
		<content:encoded><![CDATA[<p>- I still can&#8217;t figure out, why you can use c-style comments in your source. But since putting a semicolon in front of /* suffices, I won&#8217;t bother.<br />
- My checksums are OK.<br />
- Thanks for your suggestions regarding xpet. This seems to work. I&#8217;ve written a script to launch xpet for the current build of cbmbasic2:<br />
#!/bin/sh<br />
mkdir -p pet<br />
vice_dir=$(dirname $(readlink -f $(which xpet)))/..<br />
cp $vice_dir/lib/vice/PET/edit2g pet<br />
cp $vide_dir/lib/vice/PET/basic2 pet<br />
dd if=tmp/cbmbasic2.bin of=pet/basic2 bs=1 count=8192<br />
dd if=tmp/cbmbasic2.bin of=pet/edit2g conv=notrunc bs=1 skip=8192<br />
xpet -model 3032 -basic pet/basic2 -editor pet/edit2g<br />
#&#8212;</p>
<p>Apart from that: great work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Steil</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97954</link>
		<dc:creator>Michael Steil</dc:creator>
		<pubDate>Tue, 21 Oct 2008 09:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97954</guid>
		<description>@Macro: I&#039;m using a  V2.12.9 that I compiled myself. Weird. I would be happy about your patches. :-)

Here are the MD5s of the original binaries:
applesoft.bin = 84b510725233ce4a9f12894d17c0c056
cbmbasic1.bin = 0aae8577c9e2d78a869f15fe73e3c0db
cbmbasic2.bin = 65fbddc1114c5ca4648cf31d6a9a2891
kb9.bin = 3272e79a92398bfceaab2f8178ce382f
kbdbasic.bin = 639f953ac2eb1d1ceb307eea843f3c27
microtan.bin = b28f19e5947bed5c771990ad0eb3fe36
osi.bin = 1f45d3c8c7e684901b453a443a93f2e9

Commodore BASIC 2 is the PET version and won&#039;t just work on a C64, for several reasons:
* It is compiled for $C000-$E000; the C64 has its own ROM and other parts there.
* It does a memory test by reading/writing memory (without preserving the data) until it hits unassigned memory or ROM - if you link cbmbasic2 to another address in RAM, it will overwrite itself.
* RAMSTART is $0400, while it should be $0800 on the C64.
These items can probably be fix pretty easily, but:
* Zero page layout is different on the PET and the C64: You must make sure that BASIC does not use zero page locations used by KERNAL. After all, BASIC on Commodore computers is not standalone, but requires the services of KERNAL, especially the screen editor.

Please note that the &quot;Commodore BASIC V2&quot; used in the VIC-20 and the C64 is unrelated to version 2 in the PET: C64 BASIC is based on the PET BASIC 4.0 source code, with all post-2.0 features stripped out again for space reasons. Among other things, C64 BASIC used CR instead of CR/LF everywhere, and it had some better abstractions between BASIC and the KERNAL: For example, on the C64, KERNAL detects the size of memory, and BASIC queries this information through a call into the KERNAL jump table.

So I suggest you replace the BASIC2 ($C000-$E000) ROM and the lower part of EDIT2G ($E000-E1DE) ROM in VICE with your assembled binary. Be careful that you don&#039;t overwrite the screen editor code. This way, your binary will work without changes. Be careful though to configure VICE to emulate the correct version of the PET.</description>
		<content:encoded><![CDATA[<p>@Macro: I&#8217;m using a  V2.12.9 that I compiled myself. Weird. I would be happy about your patches. :-)</p>
<p>Here are the MD5s of the original binaries:<br />
applesoft.bin = 84b510725233ce4a9f12894d17c0c056<br />
cbmbasic1.bin = 0aae8577c9e2d78a869f15fe73e3c0db<br />
cbmbasic2.bin = 65fbddc1114c5ca4648cf31d6a9a2891<br />
kb9.bin = 3272e79a92398bfceaab2f8178ce382f<br />
kbdbasic.bin = 639f953ac2eb1d1ceb307eea843f3c27<br />
microtan.bin = b28f19e5947bed5c771990ad0eb3fe36<br />
osi.bin = 1f45d3c8c7e684901b453a443a93f2e9</p>
<p>Commodore BASIC 2 is the PET version and won&#8217;t just work on a C64, for several reasons:<br />
* It is compiled for $C000-$E000; the C64 has its own ROM and other parts there.<br />
* It does a memory test by reading/writing memory (without preserving the data) until it hits unassigned memory or ROM &#8211; if you link cbmbasic2 to another address in RAM, it will overwrite itself.<br />
* RAMSTART is $0400, while it should be $0800 on the C64.<br />
These items can probably be fix pretty easily, but:<br />
* Zero page layout is different on the PET and the C64: You must make sure that BASIC does not use zero page locations used by KERNAL. After all, BASIC on Commodore computers is not standalone, but requires the services of KERNAL, especially the screen editor.</p>
<p>Please note that the &#8220;Commodore BASIC V2&#8243; used in the VIC-20 and the C64 is unrelated to version 2 in the PET: C64 BASIC is based on the PET BASIC 4.0 source code, with all post-2.0 features stripped out again for space reasons. Among other things, C64 BASIC used CR instead of CR/LF everywhere, and it had some better abstractions between BASIC and the KERNAL: For example, on the C64, KERNAL detects the size of memory, and BASIC queries this information through a call into the KERNAL jump table.</p>
<p>So I suggest you replace the BASIC2 ($C000-$E000) ROM and the lower part of EDIT2G ($E000-E1DE) ROM in VICE with your assembled binary. Be careful that you don&#8217;t overwrite the screen editor code. This way, your binary will work without changes. Be careful though to configure VICE to emulate the correct version of the PET.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco</title>
		<link>http://www.pagetable.com/?p=46&#038;cpage=1#comment-97952</link>
		<dc:creator>Marco</dc:creator>
		<pubDate>Tue, 21 Oct 2008 08:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.pagetable.com/?p=46#comment-97952</guid>
		<description>Which version of cc65 are you using? The posted source contains c-style comments in inline.s, poke.s and init.s which are not supported by V2.12.9 (20080831 snapshot) or the V2.12.0 release. If I fix this, then the resulting cbmbasic2.bin in tmp is 8670 bytes in length and does not run in vice (x64 -basic tmp/cbmbasic2.bin hangs). Any hints?</description>
		<content:encoded><![CDATA[<p>Which version of cc65 are you using? The posted source contains c-style comments in inline.s, poke.s and init.s which are not supported by V2.12.9 (20080831 snapshot) or the V2.12.0 release. If I fix this, then the resulting cbmbasic2.bin in tmp is 8670 bytes in length and does not run in vice (x64 -basic tmp/cbmbasic2.bin hangs). Any hints?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
