<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WinSoft.se &#187; C128</title>
	<atom:link href="http://www.winsoft.se/tag/c128/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.winsoft.se</link>
	<description>Development with focus on Visual Basic .NET</description>
	<lastBuildDate>Thu, 26 Jan 2012 19:28:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sequential data on 5.25 inch floppies</title>
		<link>http://www.winsoft.se/2012/01/sequential-data-on-5-25-inch-floppies/</link>
		<comments>http://www.winsoft.se/2012/01/sequential-data-on-5-25-inch-floppies/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 20:02:01 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1808</guid>
		<description><![CDATA[If you have an actual 1571 disk drive for your Commodore 128, insert a blank disk, format it using the HEADER command. Something like this: HEADER "MY DISK", I44, D0 (Formatting a disk takes a while.) If you are running a virtual Commodore 128 in VICE, click File, Attach disk image, Drive 8. Create a [...]]]></description>
			<content:encoded><![CDATA[<p>If you have an actual 1571 disk drive for your Commodore 128, insert a blank disk, format it using the <strong>HEADER</strong> command. Something like this:</p>
<pre>HEADER "MY DISK", I44, D0</pre>
<p>(Formatting a disk takes a while.)</p>
<p>If you are running a virtual Commodore 128 in <a href="http://www.viceteam.org/" target="_blank">VICE</a>, click <em>File</em>, <em>Attach disk image</em>, <em>Drive 8</em>. Create a d64 image file and attach that image. To create the file, enter a desired filename, like <em>test.d64</em>, provide a name, click <em>Create Image</em>, then click <em>Attach</em>.</p>
<p>(The commands I use are available Commodore Basic 4.0 on Commodore PET, but I run Commodore Basic 7 on a C128.)</p>
<p>Your disk is now inserted and completely empty. You can check the content using the <strong>DIRECTORY</strong> command.</p>
<p><img class="alignnone size-full wp-image-1809" title="" src="http://www.winsoft.se/wp-content/uploads/seq1.jpg" alt="" width="280" height="144" /></p>
<p>As a Commodore user, you know that you sometimes have to refer to your disk drive using its drive number (the first disk drive is <strong>0</strong>) and sometimes you have to use the device number (the first disk drive is <strong>8</strong>). The <strong>OPEN</strong> command operates on any device, therefore a device number is required in this case. The first parameter is the logical file number (just a number that identifies the file), the second is the device number (<strong>8</strong>). The third argument is a channel number &#8211; enter <strong>2</strong>. Then, in one single string argument, you type in the file name, the file type and the file mode. I want to create a file called <strong>TEST.DAT</strong> as a sequential file and I want to write to it, so I my string holds <strong>&#8220;TEST.DAT,SEQ,WRITE&#8221;</strong>.</p>
<pre>10 OPEN 1, 8, 2, "TEST.DAT,SEQ,WRITE"</pre>
<p>To fill your file with data, use the <strong>PRINT#</strong> command. Anything goes here. This will print one string, one integer, and then yet another string. You provide your logical file number so that <strong>PRINT#</strong> knows what file you are targeting.</p>
<pre>20 PRINT#1, "ONE STRING"
30 PRINT#1, 5
40 PRINT#1, "ANOTHER STRING"</pre>
<p>If you like, more data can be added in one line.<br />
When you are done writing, close the file using the <strong>CLOSE</strong> command. Again, provide your logical file number.</p>
<pre>50 CLOSE 1</pre>
<p>After running this program, you should have a small sequential file called <strong>TEST.DAT</strong> on your disk. If any disk error occurred, the lamp on your drive is flashing now &#8211; it shouldn&#8217;t do that.</p>
<p>Continued <a href="http://www.winsoft.se/2012/01/reading-sequential-data-from-your-5-25-inch-floppy/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2012/01/sequential-data-on-5-25-inch-floppies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plotting graphics</title>
		<link>http://www.winsoft.se/2011/10/plotting-graphics/</link>
		<comments>http://www.winsoft.se/2011/10/plotting-graphics/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 19:06:19 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>
		<category><![CDATA[C64]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1772</guid>
		<description><![CDATA[The Commodore 128 has a nice API for setting graphics mode and plotting graphics, that can be used in 40 column mode. The GRAPHIC command takes a mode (0 to 5) and a &#8220;clear screen flag&#8221;, and changes the current graphics mode. 0 is the 40 column text mode and 1 is the high resolution [...]]]></description>
			<content:encoded><![CDATA[<p>The Commodore 128 has a nice API for setting graphics mode and plotting graphics, that can be used in 40 column mode. The GRAPHIC command takes a mode (0 to 5) and a &#8220;clear screen flag&#8221;, and changes the current graphics mode. 0 is the 40 column text mode and 1 is the high resolution monochrome graphics mode. This program sets a few random pixels on the screen using the DRAW command:</p>
<pre>10 GRAPHIC 1, 1
20 FOR A = 1 TO 100
30 DRAW 1, RND(1) * 320, RND(1) * 200
40 NEXT A</pre>
<p>When the program is run, the text is hidden, so to retain the text cursor, just type GRAPHIC 0 and hit Enter. If you like, you can add this to your program.</p>
<p>The Commodore 64 does not provide any API for graphics, so on the C64 this task is accomplished by <a href="http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/">manipulating bits</a> in a memory area. You can jump to graphics mode by setting the bit 6 on byte 53265 to 1 and return to text mode by setting it to 0. While plotting, you must make sure you know how to handle bit patterns. The screen area can be located at 8192 if we set a flag for this (bit 4 at byte 53272), like so:</p>
<pre>10 POKE 53272, PEEK(53272) OR 8</pre>
<p>The screen consist of 8000 bytes, so in this case from 8192 to 9191. Then, enter graphics mode:</p>
<pre>20 POKE 53265, PEEK(53265) OR 32</pre>
<p>Now we don&#8217;t have the service to get a clean color map (that is Commodore 128 luxury), so random boxes (8&#215;8 pixels) will have strange colors. No worries, this is expected.</p>
<p>Finally, these lines of code will draw a few horizontal lines in the upper left 8&#215;8 pixel area:</p>
<p><img src="http://www.winsoft.se/wp-content/uploads/c64.jpg" alt="Set graphics mode" title="Set graphics mode" class="alignnone size-thumbnail wp-image-1773" /></p>
<pre>30 POKE 8192, 255
40 POKE 8193, 0
50 POKE 8194, 255
60 POKE 8195, 0
70 POKE 8196, 255
80 POKE 8197, 0
90 POKE 8198, 255
100 POKE 8199, 0</pre>
<p><img src="http://www.winsoft.se/wp-content/uploads/c641.jpg" alt="Click to view" title="C64 high resolution graphics" class="alignnone size-thumbnail wp-image-1775" /></p>
<p>When the program has run, you will not see the text cursor, but to restore everything, type:</p>
<pre>POKE 53272, 21
POKE 53265, 27</pre>
<p>&#8230;and our horizontal lines will be gone and the text cursor is back.</p>
<p><img src="http://www.winsoft.se/wp-content/uploads/c642.jpg" alt="Restoring." title="Restoring." class="alignnone size-thumbnail wp-image-1776" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/10/plotting-graphics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CP/M on a Commodore machine &#8211; online resources</title>
		<link>http://www.winsoft.se/2011/05/cpm-on-a-commodore-machine-online-resources/</link>
		<comments>http://www.winsoft.se/2011/05/cpm-on-a-commodore-machine-online-resources/#comments</comments>
		<pubDate>Sun, 29 May 2011 19:31:21 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1680</guid>
		<description><![CDATA[To get started with CP/M, you will need a Commodore 128 with a disk drive or a computer that runs Vice (X128). The disks you need can be downloaded from here. The CP/M boot disk, the additional utilities, &#8220;more CP/M additional utilities&#8221;, the Assembler utilities and Microsoft Basic 80 (two disks). If you run this [...]]]></description>
			<content:encoded><![CDATA[<p>To get started with CP/M, you will need a Commodore 128 with a disk drive or a computer that runs Vice (X128). The disks you need can be downloaded from <a href="http://www.cpm8680.com/cpmc64/cpmsys2.htm" target="_blank">here</a>. The CP/M boot disk, the additional utilities, &#8220;more CP/M additional utilities&#8221;, the Assembler utilities and Microsoft Basic 80 (two disks).</p>
<p>If you run this on a physical machine, make sure to insert the boot disk, and to push in the &#8220;40/80 display&#8221; key on your computer, before turning it on. If you are running this from Vice emulator, start your machine by passing these arguments to the x128 executable (adjust the path if necessary):</p>
<pre>x128.exe -80 -autostart "C:\cpm\zpmsys.d64"</pre>
<p>This is a text only environment, but pseudo graphics can be used, and a graphics library is <a href="http://www.z80.eu/gsx.html" target="_blank">available</a> as an add-on.</p>
<p>The basic usage of CP/M is described in the Commodore 128 user guide, <a href="http://www.commodore.ca/manuals/128_system_guide/sect-11.htm" target="_blank">chapter 11</a>. If you know DOS, you will probably feel rather at home. You have the concepts of programs and arguments. DIR shows the available commands. The actual Commodore extensions consist of keyboard short cuts and are described in <a href="http://www.commodore.ca/manuals/128_system_guide/sect-15.htm">chapter 15</a> of the Commodore 128 user guide.</p>
<p>What I see as the biggest challenge, is inserting the correct disk. Let&#8217;s say that you want to read the content of a file. This requires the TYPE.COM file that is located on the additional utilities disk, so you must insert that disk to be able to run that command. To avoid frustration, use two disk drives &#8211; one for the CP/M disks, and one for your files.</p>
<p>To start Microsoft Basic, insert the correct disk and type MBASIC. Then, watch a movie or something. After a while, your Commodore 128 will say:</p>
<pre>MBASIC-80 Rev. 5.21
[CP/M Version]
Copyright 1977-1981 (C) by Microsoft
Created: 28-Jul-81
34350 Bytes free
Ok</pre>
<p>If you want to write programs, the MBASIC manual can be downloaded from <a href="http://www.classiccmp.org/cini/pdf/Microsoft/mbasic.pdf" target="_blank">here</a>.</p>
<p>A five minute Turbo Pascal 3.0 demo on the Commodore 128:</p>
<p><iframe width="425" height="349" src="http://www.youtube.com/embed/jon8TVEqPmM" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/05/cpm-on-a-commodore-machine-online-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s make the screen flash!</title>
		<link>http://www.winsoft.se/2011/04/lets-make-the-screen-flash/</link>
		<comments>http://www.winsoft.se/2011/04/lets-make-the-screen-flash/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 13:12:26 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>
		<category><![CDATA[C64]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1662</guid>
		<description><![CDATA[This program will make the screen flash on the Commodore 128, and it will also run on the Commodore 64. The background color of the screen is stored at D021 (53281), so this effect is accomplished by manipulating the value at that address, multiple times. This program cannot be written in Basic, because the Basic [...]]]></description>
			<content:encoded><![CDATA[<p>This program will make the screen flash on the Commodore 128, and it will also run on the Commodore 64. The background color of the screen is stored at D021 (53281), so this effect is accomplished by manipulating the value at that address, multiple times. This program cannot be written in Basic, because the Basic interpreter is too slow.</p>
<p>Remember that the machine code monitor expects code in one format, and displays it in another, so what I show here, is what I actually type in. I will write my program at location 1000 (4096) in the memory. Type <strong>MONITOR</strong> to enter the machine code monitor, and type <strong>F 1000 1100 0</strong> to create some free space.</p>
<p>To begin writing code, type <strong>.</strong> directly followed by the address you want to add an instruction to, followed by the instruction and the desired parameters. This stores what you just typed in, and expects you to type in the next command, or just hit Enter to exit the edit mode.</p>
<pre>.1000 LDA #$01
STA $D021
NOP
NOP
NOP
LDA #$0B
STA $D021
NOP
NOP
NOP</pre>
<p>(and so on&#8230;)</p>
<p>Let the final command in your program be <strong>JMP $1000</strong>.</p>
<p>Press Enter to exit edit mode, type <strong>X</strong> and Enter to exit the monitor. Start your program by typing <strong>SYS 4096</strong>. Your screen should now be flashing hysterically!</p>
<p>On the first row, <strong>.1000</strong> tells the Commodore 128 machine code monitor that I want my program to start at address 1000 (4096). <strong>LDA</strong> loads a value to the accumulator, and <strong>STA</strong> stores current value in the accumulator to the given memory address, D021 (53281). The specific memory address D021 controls the background color. <strong>NOP</strong> means &#8220;no operation&#8221; and is used only to make the effect less hysterical. Finally, <strong>JMP</strong> jumps to the given address, creating an infinite loop. Who needs fireworks now?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/04/lets-make-the-screen-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collision detection</title>
		<link>http://www.winsoft.se/2011/04/collision-detection/</link>
		<comments>http://www.winsoft.se/2011/04/collision-detection/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 16:31:17 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1633</guid>
		<description><![CDATA[A nice and quick way to create two filled sprites (sprite 1 and 2) is to enter the monitor and type: F 0E00 0E3E FF F 0E3F 0E7E FF Of course you can fill both at once, but this the above code nicely declares the two memory areas I am using in this example. Now, [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://imghost.winsoft.se/upload/370201301675289col.jpg" class="alignright" width="187" height="147" />A nice and quick way to create two filled sprites (sprite 1 and 2) is to enter the monitor and type:</p>
<pre>F 0E00 0E3E FF
F 0E3F 0E7E FF</pre>
<p>Of course you can fill both at once, but this the above code nicely declares the two memory areas I am using in this example. Now, let&#8217;s write a simple Basic program to fire the two sprites so that they collide now and then. This will make one sprite white and the other cyan, and fire the movements.</p>
<pre>10 SPRITE 1, 1, 2, 0
20 MOVSPR 1, 100, 100
30 MOVSPR 1, 90#1
40 SPRITE 2, 1, 2, 0
50 MOVSPR 2, 100, 115
60 MOVSPR 2, 270#1</pre>
<p>To detect collision between the two sprites, we can use the <strong>BUMP</strong> function. <strong>BUMP(1)</strong> returns a bit pattern telling us what sprites has collided, and <strong>BUMP(2)</strong> returns a bit pattern that tells us what sprites has collided with static graphics on screen. We would expect <strong>BUMP(1)</strong> to return 3 if sprite 1 and 2 is colliding, given that no other sprites are colliding as well, because the binary number 00000011 represents the decimal number 3. And indeed. Add these two lines to your program to see what <strong>BUMP(1)</strong> returns:</p>
<pre>70 PRINT BUMP(1)
80 GOTO 70</pre>
<p>To interrupt the program, press RunStop. If you are using the VICE emulator, that key might be mapped to the Escape key. <strong>BUMP(1)</strong> is actually just returning the bit pattern in the byte located at D01E, so <strong>BUMP(1)</strong> is equivalent to <strong>PEEK(53278)</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/04/collision-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poking graphics on the C128</title>
		<link>http://www.winsoft.se/2011/03/poking-graphics-on-the-c128/</link>
		<comments>http://www.winsoft.se/2011/03/poking-graphics-on-the-c128/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 18:04:22 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1621</guid>
		<description><![CDATA[The skills of using PEEK, POKE and logical operators that I write about for the Commodore PET here, can be used to create graphics on the Commodore 128, in 40-column mode. Before you begin, you might want to clear the screen using the SCNCLR command. Odd name, I know. The C128 has a built in [...]]]></description>
			<content:encoded><![CDATA[<p>The skills of using <strong>PEEK</strong>, <strong>POKE</strong> and logical operators that I write about for the Commodore PET <a href="http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/">here</a>, can be used to create graphics on the Commodore 128, in 40-column mode. Before you begin, you might want to clear the screen using the <strong>SCNCLR</strong> command. Odd name, I know.</p>
<p>The C128 has a built in sprite engine. A sprite is a 2 dimensional area with its own memory area that can be handled separately from the rest of the screen. The C128 sprite engine supports eight sprites. Use the <strong>SPRITE</strong> command to activate a sprite. Here, I have activated the first of eight sprites:</p>
<pre>SPRITE 1, 1, 1, 0</pre>
<p>The first sprite is now activated. The default position is up to the right of the screen. However, the sprite might be invisible. If there is junk data in the address space of the sprite, you will see some obscure pixels. The sprite data is located in the memory at 3584 (0E00). Each sprite is 3 bytes (or 24 pixels) wide and 21 pixels high. Each sprite consumes 63 bytes. This information is enough to clear the sprite. In the machine code monitor, use  In the machine code monitor, use <strong>M 0E00 0E3E</strong> to see the sprite data. Note that the monitor displays eight bytes at a time, so it will actually display 0E00 to 0E3F. To clear the sprite, type:</p>
<pre>F 0E00 0E3E 0</pre>
<p><img alt="" src="http://imghost.winsoft.se/upload/173251301421702sprites.jpg" class="alignright" width="322" height="109" />Leave the monitor using X. Make sure the sprite is visible by typing in <strong>SPRITE 1, 1, 1, 0</strong> again. Now, use the <strong>POKE</strong> statement to control which pixels should be visible and which should be hidden, according to the rules I demonstrated <a href="http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/03/poking-graphics-on-the-c128/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing individual bits on a Commodore PET</title>
		<link>http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/</link>
		<comments>http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 15:18:14 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1610</guid>
		<description><![CDATA[On a Commodore PET, each byte that can be read using the PEEK function, and set using the POKE statement. A byte consist of 8 bits, and represent a number between 0 and 255. This code writes the value 5 to the memory address 1020, and then reads it back. The output is of course [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://imghost.winsoft.se/upload/644631301149597pet.gif" class="alignright" width="220" height="228" />On a Commodore PET, each byte that can be read using the <strong>PEEK</strong> function, and set using the <strong>POKE</strong> statement. A byte consist of 8 bits, and represent a number between 0 and 255. This code writes the value 5 to the memory address 1020, and then reads it back. The output is of course 5.</p>
<pre>POKE 1024, 5
PRINT PEEK(1024)</pre>
<p>The <strong>POKE</strong> statement affects all eight bits at the given address (1024), but bits can be filtered out using logical operators <strong>AND</strong> and <strong>OR</strong>. The first (from right to left) of the eight bits represents the value 1, the second bit represents 2, the third 4, the fourth 8, the fifth 16, the sixth 32, the seventh 64 and the last bit represents the value 128.</p>
<p>Since the value 5 is stored at 1024, you would expect all the bits being 0 except the first and the third, since 1 + 4 equals 5. This code reads the first four bits at 1024, and the output is 1, 0, 4 and 0. 1 because the first bit (representing 1) is set, 0 because the second isn&#8217;t set, 4 because the third (representing 4) is set and 0 because the fourth isn&#8217;t set.</p>
<pre>PRINT PEEK(1024) AND 1 : REM Read bit 1 - (1 if set)
PRINT PEEK(1024) AND 2 : REM Read bit 2 - (2 if set)
PRINT PEEK(1024) AND 4 : REM Read bit 3 - (4 if set)
PRINT PEEK(1024) AND 8 : REM Read bit 4 - (8 if set)</pre>
<p>Multiple bits can also be read. This code reads both the first and the third bit on the address 1024:</p>
<pre>PRINT PEEK(1024) AND 5</pre>
<p>The result will be 0 if neither is set, 1 if the first is set, 4 if the second is set and 5 if both the first and third is set. The bit pattern of the value is 00000101, so the bits that are pointed out are the first and the third (from right to left).</p>
<p>Also, you can set individual bits. <strong>OR</strong> [n] turns a bit on, where [n] is the value that the bit represents. 1, 2, 4, 8, 16, 32, 64 or 128. This code turns on the last bit at 1024:</p>
<pre>POKE 1024, PEEK(1024) OR 128</pre>
<p><img alt="" src="http://imghost.winsoft.se/upload/815731301149888Commodore_4040.jpg" class="alignright" width="240" height="144" />The bit pattern at 1024 is now 10000101. The value that is stored at 1024 is 133, because 1 + 4 + 128 equals 133. To turn the last bit (128) back to zero, use <strong>AND</strong> together with bit pattern that contains a one at all positions that you want the existing flag to remain, and 0 at the positions you want to turn bytes off. To turn the last bit from the right off, you would want a bit pattern that looks like this: 01111111. All bytes remains, but the last bit from the right is 0. The number 127 has this pattern.</p>
<pre>POKE 1024, PEEK(1024) OR 127</pre>
<p>Now, the bit pattern at 1024 is changed back from 10000101 to 00000101. The value that is stored in the byte at 1024 is now 5 again.</p>
<p>What can <a href="http://www.winsoft.se/2011/03/poking-graphics-on-the-c128/">be done with this knowledge</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2011/03/accessing-individual-bits-on-a-commodore-pet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some cool software for the C128: GEOS</title>
		<link>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-geos/</link>
		<comments>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-geos/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 11:36:17 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1214</guid>
		<description><![CDATA[So CP/M is the text based disk operating system for the Commodore 128. You could buy a window based operating on disk called GEOS (Graphic Environment Operating System). GEOS was available for some of the Commodore machines and the Apple II. GEOS is not &#8220;smashing&#8221; either, but it solved some problems that text based systems [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://imghost.winsoft.se/upload/97439127642765223081_636105944_2330_n.jpg" class="alignright" width="200" height="200" style="margin: 0px 0px 5px 5px;" /><br />
So CP/M is the text based disk operating system for the Commodore 128. You could buy a window based operating on disk called GEOS (Graphic Environment Operating System). GEOS was available for some of the Commodore machines and the Apple II. GEOS is not &#8220;smashing&#8221; either, but it solved some problems that text based systems had at that time. It presented the features of the applications and the system itself, so that the user could point and click on the feature that user wants to use. These screenshots show GEOS in all its glory on an enormous 320 by 200 pixel screen.</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/270361276428230geos1.gif" class="alignnone" width="320" height="200" /></p>
<p>At startup, GEOS shows the content of the system disk. To access some of the useful applications, you would insert that disk, and click <strong>Disk</strong> and <strong>Open</strong> to refresh the screen. GEOS was delivered with word processor, a painting program, among other things. Not very sophisticated compared to what you could get for your Macintosh or Windows, but a life saver for any C128 user.</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/657321276428627geos2.gif" class="alignnone" width="320" height="200" /></p>
<p>GEOS did not multitask very well. Here, when I use the calculator, I can&#8217;t move the mouse outside the calculator window. I need to close it, before I can access the applications window behind, and that window cannot be moved around. It can be closed, and reopened from the <strong>Disk</strong> menu.</p>
<p>GEOS was relesed in 1986 and from what I know, the GEOS disks are not available for download.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-geos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some cool software for the C128: CP/M</title>
		<link>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-cpm/</link>
		<comments>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-cpm/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 20:11:31 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1199</guid>
		<description><![CDATA[CP/M, the disk operating system for the Commodore 128 This is one of the strange things about this machine. Microsoft DOS was around, and Commodore was already making computers running DOS. But the Commodore 128 was supposed to run CP/M. Who used this? If you want to boot CP/M, download the image from here. In [...]]]></description>
			<content:encoded><![CDATA[<p><strong>CP/M, the disk operating system for the Commodore 128</strong></p>
<p>This is one of the strange things about this machine. Microsoft DOS was around, and Commodore was already making computers running DOS. But the Commodore 128 was supposed to run CP/M. Who used this?</p>
<p>If you want to boot CP/M, download the image from <a href="http://www.cpm8680.com/cpmc64/">here</a>. In the ctools/x128 folder, attach the &#8220;cpm128.d64&#8243; image to device 8 and type <strong>BOOT</strong> (or reset the machine).</p>
<p>Attach the first file to drive 8 and type <strong>BOOT</strong> (or reset the machine). If you&#8217;re doing this from a physical C128, make sure to have the 80 col key pressed down. If you&#8217;re doing this from the Vice emulator, send the <strong>-80</strong> argument to <strong>x128.exe</strong> at startup.</p>
<pre>X128.exe -80</pre>
<p><img alt="" src="http://imghost.winsoft.se/upload/157821276286370cpm1.jpg" class="alignnone" width="500" height="275" /></p>
<p>It takes a while to boot, and watching the prompt is sort of just as fun as watching it boot. What can it do? Most of the operations will require that other disks are inserted to the drive. They were delivered with your machine when you bought it, but you probably reformatted those disks to make room for some pirated games. However, you can show the contents of a disk by typing <strong>dir</strong> and you can get help by typing <strong>help</strong>. Hang on, it is working on providing you help. No it didn&#8217;t crash, it is working on providing you help! Yes, it is. Ah there you go. Like I said, it can provide help!</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/870751276286600cpm2.jpg" class="alignnone" width="500" height="227" /></p>
<p>In purple and everything!</p>
<p>Some commands worth mentioning are <strong>PIP</strong> to copy or combine files (<strong>PIP</strong> can be used without any extra disks), <strong>ED</strong> to edit a file, <strong>DUMP</strong> to display a file and <strong>FORMAT</strong> to format a CP/M disk.</p>
<p>Have fun. Or perhaps: Have &#8220;<em>fun</em>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2010/06/some-cool-software-for-the-c128-cpm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic data management</title>
		<link>http://www.winsoft.se/2010/06/basic-data-management/</link>
		<comments>http://www.winsoft.se/2010/06/basic-data-management/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 20:30:53 +0000</pubDate>
		<dc:creator>Anders Hesselbom</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[C128]]></category>

		<guid isPermaLink="false">http://www.winsoft.se/?p=1196</guid>
		<description><![CDATA[If you want to do this on a real Commodore 128, you will need a blank floppy disk, and if you are doing this from an emulator, you will need a blank floppy image. I have created a blank d64 image from the Vice emulator. To do that, click File, Attach disk image, and Drive [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to do this on a real Commodore 128, you will need a blank floppy disk, and if you are doing this from an emulator, you will need a blank floppy image. I have created a blank d64 image from the Vice emulator. To do that, click <strong>File</strong>, <strong>Attach disk image</strong>, and <strong>Drive 8</strong> to display the <strong>Attach disk image</strong> dialog. There, type in a filename, click <strong>Create image</strong>, and finally click <strong>Attach</strong>.</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/282281276113057create_image.jpg" class="alignnone" width="428" height="311" /></p>
<p>You can make sure that your disk is correctly attached by typing <strong>DIRECTORY</strong>. This is what you should see:</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/517801276113594create_image2.jpg" class="alignnone" width="322" height="106" /></p>
<p>To create a blank area of memory, enter the machine code monitor and fill a memory area with the value zero. Type:</p>
<pre>MONITOR

F 1000 1100 0</pre>
<p>To ensure that memory now is blank, type <strong>M 1000</strong>. Type <strong>X</strong> to leave the machine code monitor. Note that the monitor is using the hexadecimal, so the area that we have blanked out is from address 4096 to address 4352.</p>
<p>From the Basic parser (that is, outside the machine code monitor) the <strong>POKE</strong> command is used to set a byte and the <strong>PEEK</strong> function is used to get a byte. Commodore Basic uses the decimal number system but is equipped with functions to convert between the systems.</p>
<p>So, to set a byte at position 4096 (in this case, the value 5) type:</p>
<pre>POKE 4096, 5</pre>
<p>To read the same byte, type:</p>
<pre>PRINT PEEK(4096)</pre>
<p>Also, you can enter the monitor and type <strong>M 1000</strong>. This is what you should see:</p>
<p><img alt="" src="http://imghost.winsoft.se/upload/334731276114487readmem.jpg" class="alignnone" width="322" height="202" /></p>
<p>The C128 has built in commands for saving memory to disk and loading memory to disk. Let&#8217;s say that we want to save our byte and some following bytes, use the BSAVE command (Binary Save). This will save 4 bytes to a file called TEST.DAT, where the first byte is our value 5. The second argument is the device (B0 is device 8), the third argument is the address range (the character P must occur before the number).</p>
<pre>BSAVE "TEST.DAT", B0, P4096 TO P4100</pre>
<p>Type <strong>DIRECTORY</strong> to make sure the file is located there.</p>
<p>To load this file, use <strong>BLOAD</strong> (Binary Load). This is a test you can do.</p>
<p>Type <strong>PRINT PEEK(4110)</strong> to ensure address 4110 is empty. Load the file into the address 4110 by typing:</p>
<pre>BLOAD "TEST.DAT", B0, P4110</pre>
<p>Type <strong>PRINT PEEK(4110)</strong> again to see that it now holds the value 5, as loaded from the file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winsoft.se/2010/06/basic-data-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

