tag:blogger.com,1999:blog-41081985198081970572024-03-13T23:52:32.552-07:00Tech with DaveTechnical projects created by Dave Van WagnerDave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.comBlogger68125tag:blogger.com,1999:blog-4108198519808197057.post-43291749231266912242024-02-07T14:25:00.000-08:002024-02-07T14:27:40.120-08:00Calculator for Commodore 64 and other CBM BASIC models<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzW42hfTt0rSdb4_yvAylu9GUIb3_8DKx2tKuRy4QGCTXCQab1ObRGXXaF89SWS0CVJotTBV46IozcUpIZHWodhMcC4m6njrsHIqKsX4u2UfRC0XKYXvBeAo3QM8ulkWgKJ5TaNdYKHBpNYZO5ahWSisWPB-Y9nEjuCum8NXQvD3uJ3VYBzhmo_334jbcv/s3687/calc64.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2159" data-original-width="3687" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzW42hfTt0rSdb4_yvAylu9GUIb3_8DKx2tKuRy4QGCTXCQab1ObRGXXaF89SWS0CVJotTBV46IozcUpIZHWodhMcC4m6njrsHIqKsX4u2UfRC0XKYXvBeAo3QM8ulkWgKJ5TaNdYKHBpNYZO5ahWSisWPB-Y9nEjuCum8NXQvD3uJ3VYBzhmo_334jbcv/w400-h234/calc64.png" width="400" /></a></div><br /><p></p><h2 style="text-align: left;">Introduction</h2><p>Wow! A new desktop calculator for Commodore. Programmed all by myself in BASIC. Wow, so impressed! Or not. Doesn't even have decimals.</p><p>No, it's not the best thing since sliced bread, but it was fun. And it's just a start -- there's a bigger goal I'll get to in a while...</p><p>This was a puzzle programming exercise I challenged myself with. How to make the calculator, especially with the operator precedence feature.</p><p style="text-align: left;">Link: <span style="font-family: courier;"><a href="https://github.com/davervw/calc64" target="_blank">LOAD"CALC64",8</a></span></p><h2 style="text-align: left;">Implementation</h2><p>Let's go through how it was implemented.</p><h3 style="text-align: left;">User Interface</h3><p style="text-align: left;">First was the design of the user interface, by creating PRINT statements. Used reverse text to make a rectangular box with the keys displayed.</p><p style="text-align: left;">How to click on a key? I'm so used to a mouse or touch interface. Oops, Commodore doesn't have that usually, or not so easy. Ignoring the 1351 mouse for now. Most Commodore users are used to using the keyboard or joystick. Forget the joystick, this is not a game! Keyboard entry one key at a time will do just fine. Note that ENTER also acts as =, and DEL is equivalent to ←, and X is a synonym for *.</p><p style="text-align: left;">Entry of digits was the first processing, accepting up to the limit of the display. This stored as a string (V$) with keyed entries appended.</p><p style="text-align: left;">I started with 7 digits, but outgrew that in testing and increased to 9 digits.</p><p style="text-align: left;">At first, only positive numbers were supported, then fixed it to support negative numbers, with the negative sign taking up a position in the display. The N key toggles a number entry between positive and negative and back again.</p><p style="text-align: left;">Entries allowed by this calculator are interleaved numbers and binary (two argument) operators. Note that immediate operators like C and N usually take effect immediately, whereas binary operators require multiple arguments and a finalization (another binary operator or =).</p><p style="text-align: left;">There are exceptions allowed in entries to overwrite the prior value or the prior operator. Examples:</p><div><ul style="text-align: left;"><li>1+1=3 keyed entries will replace the 2 with a 3</li><li>2+x3 will replace the addition operator with multiplication operator</li></ul></div><h3 style="text-align: left;">Precedence needs a Stack</h3><p style="text-align: left;">One design requirement I set for myself was to include operator precedence. This means that multiplication and division have the same higher precedence over addition and subtraction at the same lower precedence. Usually math is evaluated left to right, but due to precedence issues, other operators may need to be done first. In other words the expression 1+2x3 is equivalent to 1 + (2x3) and then 1 + 6 and finally evaluates to 7. But 1 x 2 + 3 is equivalent to (1x2) + 3, then 2 + 3, and finally 5.</p><p style="text-align: left;">I simply put numbers and operators interchangeably on a stack in order of entry until enough information is present to start evaluating.</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p style="text-align: left;">Rule 1 - if user presses =, then evaluate</p><div>Rule 2 - if first operator is multiplication or division, once the second number is finalized with a second operator, simply evaluate the first expression</div><div><br /></div><div>Rule 3 - if first operator is addition or subtraction, defer until the second operator and third number is finalized (third operator present!), then figure out what to do - either evaluate first or second expression, reducing the work</div></blockquote><div><br /></div><div>The stack is implemented as a count C, and an array of strings S$, which is expected to only grow up to 6 items (0..5), example C=6, S$[0]="1" [1]="+" [2]="2" [3]="*" [4]="3" [5]="+"</div><div><br /></div><div>This example 1+2*3+ is reduced to 1+6+ and then to 7+, with the display updated to show the 7, but then wiped to disallow appending to it.</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhP06eMx-gAYFS4ZocNVd-WF-Wl1dsiJFxuzVrxTgiDD1chyJrApgV7XMj3S6S7-FUVwAyf2F7nSokwS9ehv-XgP7BLsafYw28dLCEDXfn0SH1Ci4Pk-NaRSW_eAuviMW7TB_pWNJ9aOVxKLmVLu5hif35Yq-eHkaQl7TJ9K-X0KIkN4wdIRBhIFOY9bazr" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="902" data-original-width="2089" height="173" src="https://blogger.googleusercontent.com/img/a/AVvXsEhP06eMx-gAYFS4ZocNVd-WF-Wl1dsiJFxuzVrxTgiDD1chyJrApgV7XMj3S6S7-FUVwAyf2F7nSokwS9ehv-XgP7BLsafYw28dLCEDXfn0SH1Ci4Pk-NaRSW_eAuviMW7TB_pWNJ9aOVxKLmVLu5hif35Yq-eHkaQl7TJ9K-X0KIkN4wdIRBhIFOY9bazr=w400-h173" width="400" /></a></div><br /></div><div>And no, I'm not doing RPN. I didn't grow up with an HP calculator, nor am I implementing one today. I grew up with Texas Instruments, and that's how my brain works. Keeping it in entry order keeps it orderly for me. Sure, there are other was to approach it. This is BASIC, not Lisp. And this is MY calculator, so I'm doing it MY way. Others can follow their own paths.</div><div><br /></div><div>Expression evaluation includes handling the equals = operation. In the context of this calculator, that finalizes a calculation, meaning the user wants the result now.</div><h3 style="text-align: left;">Subroutines</h3><div>There are several subroutines: 1) Evaluate and reduce stack, 2) Update display, 3) Display stack, 4) Evaluate simple expression involving two numbers and an operator.</div><div><br /></div><div>That last subroutine is a diagnostic useful most for development, but also shows work in progress compared to a regular simple desk calculator that usually won't show pending work.</div><h3 style="text-align: left;">Error conditions</h3><div><b>Overflow</b> is when the number to be displayed doesn't fit in the 9 digit display, when the string representation of the number is long than 9 characters and/or larger than the maximum whole integer value that can be displayed in that space. Note that the number is still internally represented and can still be acted on. If a resulting answer can be displayed it will be (example: divide a ten digit positive number by 10).</div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjcYsMFOBMAlT4HM5J-trTYbYA5-Y8v3EMd0jivRrZEE_n0mRZlkiSmmfdWFk0OwQENaD6rEy64uzaYHs1dCHOFCRoZoP5ariwBrCuX508jTiLxWj2VM-W1bpyehGhbW5UnDlab9Ic4eRSGsCsMC6O-lVbQ4abuPqr6apk_IHOXoSX1qzaBM7re6MKCdJRD" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="283" data-original-width="1020" height="56" src="https://blogger.googleusercontent.com/img/a/AVvXsEjcYsMFOBMAlT4HM5J-trTYbYA5-Y8v3EMd0jivRrZEE_n0mRZlkiSmmfdWFk0OwQENaD6rEy64uzaYHs1dCHOFCRoZoP5ariwBrCuX508jTiLxWj2VM-W1bpyehGhbW5UnDlab9Ic4eRSGsCsMC6O-lVbQ4abuPqr6apk_IHOXoSX1qzaBM7re6MKCdJRD=w200-h56" width="200" /></a></div><br /></div><div><b>Error </b>indicates that division by zero was attempted.</div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiZYfrfHXJYscgh0QAeKcEasE90qVel7TWuMnP-Xmdi-LqCehqJofnMfstPE6bJueZ1jn0YhCvhcv06h4-Sn1It8GEz4js3De0fr7bLPISkoD6yHF1_89bLn9vWcit6lgukxaj-nZt30cLEA9y43ILoISplWdc9qif6XJTUhDVQVPHjWoZX-HYK01I1ouYN" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="207" data-original-width="845" height="49" src="https://blogger.googleusercontent.com/img/a/AVvXsEiZYfrfHXJYscgh0QAeKcEasE90qVel7TWuMnP-Xmdi-LqCehqJofnMfstPE6bJueZ1jn0YhCvhcv06h4-Sn1It8GEz4js3De0fr7bLPISkoD6yHF1_89bLn9vWcit6lgukxaj-nZt30cLEA9y43ILoISplWdc9qif6XJTUhDVQVPHjWoZX-HYK01I1ouYN=w200-h49" width="200" /></a></div></div><h3 style="text-align: left;">Limitations</h3><div>Only integers are supported. No decimal numbers. No currency. Workaround required to calculate a percentage -- multiply by one hundred first, then divide by whole percentage. And division results in a whole number so 1/3= results 0, and 5/2= evaluates to 2.</div><div><br /></div><div>Non-negative numbers are limited 0 to 999999999 (nine digits). Negative numbers are limited -1 to -99999999 (note only 8 digits).</div><div><br /></div><div>Scientific notation is not supported.</div><div><br /></div><div>No paper tape, no printout, no record of operations.</div><div><br /></div><div>Limited user feedback. No keypress indicators.</div><div><br /></div><div>Stack diagnostic is a little technical, especially with a count, then colon, and the entries. (Could eliminate the count and colon, and/or show previous and pending operators before and after the display.)</div><div><br /></div><div>Keyboard entry.</div><div><br /></div><h3 style="text-align: left;">Extras</h3><div>The program was saved with a starting address $400, to support PET, so you must not load with secondary address 1 on a C64! And while the program assumes a screen bigger than a VIC-20, a few minor changes to the margin and startup text can remedy that.</div><div><br /></div><h2 style="text-align: left;">Next</h2><div>What does the future hold? Who can predict with any accuracy? I can say anything here, but doesn't mean I'll follow through. I originally was contemplating near limitless number of digits (considering the 8-bit platform, probably some 16-bit limitation). Maybe binary and hex? Maybe a scientific calculator? Fixed decimal? Near limitless decimals? Port to assembly for fun! We'll see...</div><div><br /></div><div>Have fun calculating!</div><div><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-60333147865541199062023-12-30T09:20:00.000-08:002023-12-30T09:20:32.737-08:00Commodore 128 VDC Reference<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN5ReNSrTp8PiZPTtymMTHi5D0sGIfZF1jYKUaFiCxhx9ezlv_wHGZSqcy3cwyMIUcXHd7XkHQ9Z5Q5-Sox1XqII-Hj89W5pWNraV7k6HKgmdex2bXAXDLnaJNgEKSqrFyP8UvH0uIrsc-5ezy1uCxFWFDUecKW3TAqUE3EN_UOTr4xWfaAY5cnfk1WfCF/s2092/image.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1939" data-original-width="2092" height="371" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN5ReNSrTp8PiZPTtymMTHi5D0sGIfZF1jYKUaFiCxhx9ezlv_wHGZSqcy3cwyMIUcXHd7XkHQ9Z5Q5-Sox1XqII-Hj89W5pWNraV7k6HKgmdex2bXAXDLnaJNgEKSqrFyP8UvH0uIrsc-5ezy1uCxFWFDUecKW3TAqUE3EN_UOTr4xWfaAY5cnfk1WfCF/w400-h371/image.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div>The VDC8563 and VDC8568 were used in Commodore 128 and Commodore 128D computers for the secondary 80-column text screen. There were other modes available to developers not exposed to BASIC end users (graphics, interlaced modes for higher resolutions including graphics and text, and lower resolution modes too).<p></p><div>I gathered this information from multiple sources including example data from VICE (sorry, didn't power on the DCR) while implementing support for my own emulator.</div><div><br /></div><div>Hope you find this useful!</div><div><br /></div><div>Link: <a href="https://drive.google.com/file/d/1fn5y2aeQLCL3-jb05kSyuV1p1u4nZnc9/view?usp=sharing" target="_blank">PDF</a></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-63276495826550230602023-12-09T22:40:00.000-08:002023-12-09T22:40:57.760-08:00Commodore keyboards go wireless for my portable emulators<p>The <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/master#cross-platform" target="_blank">c-simple-emu6502-cbm</a> project supports a number of ESP32 platforms to provide a subset of Commodore C64 (and Vic-20, C128) emulation, and many currently include BLE keyboard support. Originally for CardKB only, now I have added BLE support for Commodore keyboards (20 to 25 pins) to the m5, T-Display-S3, and ESP32-8048S070-7inch ports/branches into the encapsulated <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/m5/BLE_commodore_keyboard_server" target="_blank">BLE_commodore_keyboard_server</a> Arduino sketch.</p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh19WmhkEqsQubn6MFqeJHY1neIKd2cSpvbVCR-Bp5niLVkEiZE5seT3LHI_U8YERnxSaeZ1mpbRCeuwYq-7Q1dTtBtwLUovou3UNJlVC448z-E4TJR7nz6-ueLgJ5q4r4u2AXszmfxvTkmm1SnKE1ijiZY5KjGiROxBw3dTUSkQaFGzCk1XaeY5ExLN-jJ/s3475/20231209_214802.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1707" data-original-width="3475" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh19WmhkEqsQubn6MFqeJHY1neIKd2cSpvbVCR-Bp5niLVkEiZE5seT3LHI_U8YERnxSaeZ1mpbRCeuwYq-7Q1dTtBtwLUovou3UNJlVC448z-E4TJR7nz6-ueLgJ5q4r4u2AXszmfxvTkmm1SnKE1ijiZY5KjGiROxBw3dTUSkQaFGzCk1XaeY5ExLN-jJ/w400-h196/20231209_214802.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">BLE options: (a) Commodore keyboard (b) CardKB</td></tr></tbody></table><p>No expense spared for these awesome graphics, seems retro eh?</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUQTOfTop9u7UzqZhW-hot_GsvCgWvwZQOCGH-pNeQD6mrL-Se-m2WFtWAIfnYPY8WOHT_CUbvWrXBojONrxQerI0UV_kG7_oYylH3hxv9AH1rrK0tEZ2y9zJyUXdTXIBfff59U87ZzJp1oroNxnBElp3xF9cif-R7QetOoqxT6TrNez29yzpDxK5CSC2j/s4032/20230804_083216.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1816" data-original-width="4032" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUQTOfTop9u7UzqZhW-hot_GsvCgWvwZQOCGH-pNeQD6mrL-Se-m2WFtWAIfnYPY8WOHT_CUbvWrXBojONrxQerI0UV_kG7_oYylH3hxv9AH1rrK0tEZ2y9zJyUXdTXIBfff59U87ZzJp1oroNxnBElp3xF9cif-R7QetOoqxT6TrNez29yzpDxK5CSC2j/w400-h180/20230804_083216.jpg" width="400" /></a></div><div><br /></div>While I have wired in the full C128DCR keyboard in the past using a <a href="https://github.com/davervw/c128_keyscan/tree/ninetyone_tx2_itsy_bitsy" target="_blank">circuit and software sketch with an Adafruit ItsyBitsy</a>, now I trade the wire with another ESP32 and BLE communications.<div><br /></div><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO6vqnIlRH3dt9kBZvrQp1XScUx0Y4kYJmQsDxC-3qc7JDRqT2xO0AmnWcLa0LdyuhKv4Q0GREN65y1jJtnUneVfE9xoV8RLB_jSNQetSclfn6enj6-XOETYZygVcIS5o4KWAw3IaK_vh9MX4R3yFyP-tqaIq78BcjUHY5reQt_9XGO8J53jlnZ2dZxMwX/s3678/20231204_074702-EDIT.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1666" data-original-width="3678" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO6vqnIlRH3dt9kBZvrQp1XScUx0Y4kYJmQsDxC-3qc7JDRqT2xO0AmnWcLa0LdyuhKv4Q0GREN65y1jJtnUneVfE9xoV8RLB_jSNQetSclfn6enj6-XOETYZygVcIS5o4KWAw3IaK_vh9MX4R3yFyP-tqaIq78BcjUHY5reQt_9XGO8J53jlnZ2dZxMwX/w400-h181/20231204_074702-EDIT.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">M5Stick-C with CardKB BLE connected to T-Display-S3</td></tr></tbody></table><br />Actually we already had BLE CardKB support, and the protocol for the hard wired keyboard is exactly the same as sent over BLE (string of active C64 and C128 scan codes), it was just a little bit of further coding to make the choice between CardKB and hardwired keyboard. In fact, that code was already present for CardKB or hardwired keyboard in the <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/m5" target="_blank">M5 branch</a> itself. The tiny bit of extra work was to duplicate that in the BLE keyboard server project. And voila! More options all the way around.</div><div><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiddD7PQ_YKiuo5_9gZ5jpz3273UnMgs85fDspoh_U4RvJpifH9CjVaaA2TEpH7ty6cRfEPK7Ye-ik1j1DQula032HOLarieKTVIIiCNKr1uAlFfzKjKiCvNblYLqGqsl7G246gFw30E6kILtfcQLKzb3Amob42Irhch94LZcaC-UKyZOdFnaj9Ncf5gW2v/s3556/20231209_214022.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1644" data-original-width="3556" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiddD7PQ_YKiuo5_9gZ5jpz3273UnMgs85fDspoh_U4RvJpifH9CjVaaA2TEpH7ty6cRfEPK7Ye-ik1j1DQula032HOLarieKTVIIiCNKr1uAlFfzKjKiCvNblYLqGqsl7G246gFw30E6kILtfcQLKzb3Amob42Irhch94LZcaC-UKyZOdFnaj9Ncf5gW2v/w400-h185/20231209_214022.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Wired keyboards (a) Commodore (b) CardKB (c) Chrome Browser</td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">There were already three options for wired keyboards. And three common Commodore keyboards were represented, because they all have compatible pinouts, and because I do have both Vic-20 and C128DCR at home.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Dropping the wire from the wearable (or other ESP32 emulators) adds convenience to mobility, and also defers the need to support wired connections to any ESP32s missing Grove connectors and any that are not 5V tolerant, as both the ItsyBitsy and CardKB use 5V interfacing. BLE support, and improved BLE support provide more options to the emulators running on hardware such as the T-Display-S3 and the 7"LCD ports without any hardware interventions. While these latter ports would require extra circuitry for hardwired serial or I2C connections including 5V to 3V3 interfacing, using BLE means that the existing circuit support on the M5Stick-C acting as the BLE server can wire to those keyboards instead. Going wireless provides the equivalent functionality without requiring a hard-wired circuit to the final display device.</div><p>While wireless does have its convenience, it does require careful timing to pair correctly. Typically if both the BLE client and server are powered or reset at the same moment, they should pair. A few or more keystrokes may be necessary to confirm pairing is complete. If it doesn't work, just reset and try again.</p><p>Happy C64 computing over BLE!</p></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-36174857018854269212023-12-05T22:11:00.000-08:002023-12-09T21:08:30.127-08:007" LCD (ESP32) with C64 Text Emulator<p> </p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdmsI6oNokHrpqtZQbf3NniCrCFr5IMbaM3lQ4Yxw_Z_cbObFwOUKHSNKs8nDJbJgt8tAiYJAvd4_ZoDi98ma-_WJc4g5mTKPzQhW2eZAcqY03xc5C2xZ7M1WI9eYOASciFQSffggAENegiXZeV4yx9dPJeoh1A-55DClkEyCQzEzDPMJmcgE43qJP-wc7/s3192/20231205_211922.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1816" data-original-width="3192" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdmsI6oNokHrpqtZQbf3NniCrCFr5IMbaM3lQ4Yxw_Z_cbObFwOUKHSNKs8nDJbJgt8tAiYJAvd4_ZoDi98ma-_WJc4g5mTKPzQhW2eZAcqY03xc5C2xZ7M1WI9eYOASciFQSffggAENegiXZeV4yx9dPJeoh1A-55DClkEyCQzEzDPMJmcgE43qJP-wc7/w400-h228/20231205_211922.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">7" is giant compared to this much smaller screen</td></tr></tbody></table><br /><div>So this <a href="https://www.aliexpress.us/item/3256804766411337.html" target="_blank">ESP32-8048S070</a> showed up from AliExpress today. It is a 7" IPS with touchscreen with ESP32-S3-WROOM-1 module, 16MB flash, 8MB PSRAM, microSD card, USB-C serial (CH3400 serial), Speaker connector, and other IO connectors. The large LCD is 800x480 resolution.</div><div><br /></div><div>The ordering page had a ZIP download of the examples, so I made sure I could build their Arduino Hello World TFT sample (I downgraded to Arduino_GFX library 1.3.1), and then <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/ESP32-8048S070-7inch" target="_blank">ported my c-simple-emu6502-cbm project</a> including upscaling from one to four pixels to cover the screen with C64 goodness. Without upscaling, the C64 was using less than a quarter of the screen. I skipped the SD support, and went straight to <a href="https://github.com/davervw/filecmdproc-esp32" target="_blank">creating a FATFS partition and uploading a D64 image</a>. Saves me from pulling an SD, but moving files up and down will be a bit more cumbersome. Included in the project already was <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/ESP32-8048S070-7inch/BLE_commodore_keyboard_server" target="_blank">custom wireless BLE keyboard</a> support, so I was typing away and running my programs right away.</div><div><br /></div><div>The largest IPS I had on hand was 3.5" 480x320, so this is a definite upgrade. </div><div><br /></div><div>The only downsides to this board that I can tell are the lack of an enclosure (ships in a nice plastic storage box though - I hear there is a 3D printable one on github somewhere though), and the lack of direct connection to the native ESP32-S3 USB port. Then again, a permanent serial connection is more convenient for flashing Arduino sketches otherwise you have to keep selecting the COM port on other solutions.</div><div><br /></div><div>Even though I've worked with it only a few hours, I highly recommend this board!</div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-864575213442271522023-12-04T20:43:00.000-08:002023-12-09T21:07:25.982-08:00New! and Improved! C64 text emulator<p>There has been a steady stream of improvements to my wearable C64/C128 text emulators and related projects since the Summer 2023 <a href="https://techwithdave.davevw.com/2023/06/extremely-small-emulated-c64.html">debut</a> at VCF West 2023 in Mountain View. My Twitter/X account includes posts of many of these advancements.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHBbthzEpzItW8EQ-lvjAgRRjUvWIjRtO5qBOTb_OxhI5_eRAGyZxNEwJe1aszlGBwXgdvzXM-47A9-0etUb_90-503cWN9_fgqHpmLQqoGLNcu8CSy_97Is3UCQOC-qS2tQQKi8RJI1p5NkRjjeBYlRurF4zCmRj-MTK240h4ccSQZRNfuptriKAN9hYz/s2851/20231204_195352.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1816" data-original-width="2851" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHBbthzEpzItW8EQ-lvjAgRRjUvWIjRtO5qBOTb_OxhI5_eRAGyZxNEwJe1aszlGBwXgdvzXM-47A9-0etUb_90-503cWN9_fgqHpmLQqoGLNcu8CSy_97Is3UCQOC-qS2tQQKi8RJI1p5NkRjjeBYlRurF4zCmRj-MTK240h4ccSQZRNfuptriKAN9hYz/w400-h255/20231204_195352.jpg" width="400" /></a></div><p></p><ul style="text-align: left;"><li><a href="https://techwithdave.davevw.com/2023/11/when-emulation-goes-wrong.html">used a 6502 test suite</a> to find problems in my emulation</li><li>Vic-20 emulator</li><li>Vic-20 upscaled resolution</li><li>A few more hardware targets supported, including much smaller sizes</li><ul><li>M5Fire 320x200</li><li>M5Atom S3 128x128</li><li>M5Stick-C 160x80</li><li>LilyGo T-Display-S3 320x170</li></ul><li>Downscaling resolution as necessary</li><li>Tilt and pan for 1:1 resolution on tiny screen sizes</li><li>FATFS partition for files when no SD present, and when PSRAM not present</li><li>M5Stack CardKb support</li><li>wireless keyboard (BLE server/client)</li></ul><div>And all these changes are stored on GitHub of course!</div><div><br /></div><div><h2><a href="https://shop.m5stack.com/products/m5stack-fire-iot-development-kit-psram-v2-7?variant=44235142136065" target="_blank">M5Fire</a></h2></div><div>A fellow attendee at Vintage Computer Festival West 2023 sported a red M5Fire and it looked really good! So I ordered one soon after, it arrived with some other goodies, and I quickly ported the M5Core2 and M5CoreS3 solution to the M5Fire. Features are comparable.</div><div><br /></div><div>Then I added keyboard support to the on-screen buttons. Left goes up. Right goes down. Center is Return. Left+Center is Shift+Run with a ROM change to make it load the first program from disk. And Left+Right toggles between the different emulators (C64 -> C128 -> Vic-20) This made an actual keyboard optional for demos. I had a boot program to provide a listing of programs selectable by cursor keys and Return key. </div><div><br /></div><div>The only downside is that the M5Stack Fire is not watchband compatible in that the recharge circuit is in the detachable base, not in the unit itself. Otherwise it would make a classy wearable.</div><div><br /></div><div><br /></div><h2 style="text-align: left;">Vic-20</h2><div>The Vic-20 was my original home computer. It is what I used to deep dive into Commodore, learning BASIC and 6502 Assembly Language inside and out from about 1982 to 1985. I still have a fondness for this system.</div><div><br /></div><div>But it has an odd screen resolution. Text is 22 columns and 23 rows equating to 176x184 pixels.</div><div><br /></div><div>The M5Core series controllers have an LCD 320x240. This was just perfect to match the standard text screen of the C64 which is 320x200 pixels. </div><div><br /></div><div>Originally I simply increased the border sizes around 176x184 pixels.</div><div><br /></div><div>Then I revisited my Teensy C64 which has an option for a 480x320 LCD screen. For that project I researched upscaling, which involved scaling an 8x8 character cell to a 12x12 character cell, using color averaging.</div><div><br /></div><div>For the M5Core series, I similarly scaled the Vic-20 8x8 character cell to 12x8. To accomplish this, staring with pixel offset 1, an extra column is interpolated from the previous and next pixels, and repeated a total of four times. The LCD works in 16-bit color mode with 5 bits for red, 6 bits for green, 5 bits for blue. The color of the two pixels is broken down into its component red/green/blue parts, the corresponding color parts are averaged (totaled and divided by 2), then recombined into a 16-bit value for the interpolated pixel.</div><div><br /></div><div>So far only the M5Cores with PSRAM have Vic-20 and C128 support.</div><div><br /></div><h2 style="text-align: left;"><a href="https://shop.m5stack.com/products/atoms3-dev-kit-w-0-85-inch-screen" target="_blank">M5Atom S3</a></h2><div>This is the smallest target hardware I have ported to. Downscaling was implemented to see what would happen. The 8x8 character cell is downscaled to 3x4 pixels, so 64 pixels downscaled to 12 pixels which is a large number of pixels to through away. Priority was given to the center pixels, so it toggles between averaging 6 (3x2) or 4 (2x2) at once. It does a weighted average between the foreground color, and background color pixel counts, so the resulting downscaled pixel is closer to one or the other.</div><div><br /></div><div>Surprisingly, the screen is somewhat readable even with this resolution loss. But to compensate for loss a zoom and tilt to pan feature was implemented. The whole screen is mounted as a single pushbutton. Clicking it toggles between zoomed out to the downscaled resolution, and the zoomed in to the pixel perfect 320x200 resolution that is panned, by tilting the device. Zoomed in, hold the device level with the floor, with the screen pointed to the ceiling, and you will see the top center of the C64 screen. Tilt to the right and forward to see the top left corner of the emulated screen, and so forth to switch between one of six views of various parts of the emulated screen with every pixel shown. Click again to zoom out for an overview of the entire screen, but downscaled. Break out a magnifying loop or such to see the detail of the teeny tiny pixels.</div><div><br /></div><div>This platform does not include an external storage device such as SD card. Nor does it have PSRAM normally used by the D64 emulation. Instead, a FATFS partition was initialized, and individual C64 PRG files were selectively uploaded to the device. The "$" directory functionality is not present, but LOAD/SAVE/VERIFY are supported. There is room for about 1.5MB of files in the partition size selected, that's about 9 times larger than the standard single sided C64 floppy, so not too bad!</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk6XsHXZMw4VofirDRRfHHw-RkhJ76SsrjFOk8-5XIXh5Dj87uyjVNgOwEaaKgQkoCvmJesE2aAQey48cG8m2P37F0WmnAZ2wHJM4tT8uZvQkVcbBcIm96GhVRs2tv1xoX3dQo2nB29jZrRuXQMvcWjD6QWQv-S0AxJnicR9nEEnb4G8ifpAGmRkEnul1i/s2459/20231204_194212.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1367" data-original-width="2459" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk6XsHXZMw4VofirDRRfHHw-RkhJ76SsrjFOk8-5XIXh5Dj87uyjVNgOwEaaKgQkoCvmJesE2aAQey48cG8m2P37F0WmnAZ2wHJM4tT8uZvQkVcbBcIm96GhVRs2tv1xoX3dQo2nB29jZrRuXQMvcWjD6QWQv-S0AxJnicR9nEEnb4G8ifpAGmRkEnul1i/w400-h223/20231204_194212.jpg" width="400" /></a></div><h2 style="text-align: left;"><a href="https://shop.m5stack.com/products/stick-c">M5Stick-C</a></h2><div>I had forgotten about this hardware device. It was the first M5Stack device I had purchased, and I had squirreled it away in a project box. Obviously it was too small for a C64 screen so I didn't give it another thought. Until I saw a post on Twitter/X showing the solution with CardKB. Looks like it's using my text-only emulation, using LCD fonts. Of course I respond! That would work very well. I've just been so focused on LCD pixelized solutions simulating the look and feel of Commodore instead of remembering the roots of my text emulation efforts with C64. Just hook CHARIN and CHAROUT and you're golden. You don't need a screen editor. You can just do buffered line input (local edit), and character output. I was laughing at myself for not pursuing this myself. CardKB provides ASCII output (from I2C polling) of the alphanumeric characters, and other byte ranges for functions and cursor keys. </div><div><br /></div><div>I wanted to do CardKB, but as I have been focused on C64 scan code adapters, it seemed hard. But here was the challenge presented on the Internet. I had already implemented an adapter of sorts leveraging a SeeedStudio ATMEGA328P (Uno compatible) board with Grove connectors and an Arduino sketch to translate I2C reads into TTL serial scan code reports. And it worked, but was very clunky because of all the cords and extra board. My existing prototype solution was not great for a wearable solution.</div><div><br /></div><div>The M5Core and such were focused on using the Grove connector as a software serial port, receiving the C64 scan codes. I had the original C128/C64/Vic-20 keyboard to Grove adapter running on an Adafruit ItsyBitsy and that was my favorite keyboard connection because it was true to the original! Next best was a web page to USB Serial adapter I had also developed. The common ground was scan codes, and serial communication. But the CardKB runs I2C. So how to do CardKB and serial communication simultaneously on the same Grove port? Originally I thought of getting the source to CardKB and rewriting, reflashing it to do serial communication instead. That would make it compatible with my existing solutions. But I was avoiding the reflashing that would also requiring rigging a programming interface, using an Uno or compatible. </div><div><br /></div><div>Instead, I approached the Grove port as an either or, the emulators were updated to check for an I2C response at startup, and if found, regularly read from the I2C port for keyboard presses. Then adapt those presses from ASCII/function code presses into momentary C64 scan codes, and 1/60th of a second later, respond with no key pressed (key up) scan code response. This is an out of the box solution that will work for others too!</div><div><br /></div><div>M5Stick-C also leverages a FATFS partition as there is no built in SD port. Again 1.5 million bytes., Though I did have to revise the partition choices manually via a JSON file as FATFS was not included in the default partition schemes presented.</div><div><br /></div><div>But the screen resolution is 160x80, with downscaling of one character's 8x8 pixels to 4x3 pixels. This time the pixels are halved horizontally, and vertically there is an 8 to 3 pixel translation, very similar to </div><div>the downscaling on the AtomS3, but rotated to different axes.</div><div><br /></div><div>This is by far the worst unreadable display for individual text characters. More than halving the vertical resolution makes the text completely unreadable (such as the startup screen). It's not it's fault completely, and is a cute form factor when not pretending to be a C64.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgVxl2GN4QjJyRFjIA431LMpzWtKobDihdKEPLxzREsXky8AgsfghLHO2kyjuJ2_9Rq1xBNOWzxQF07vkzLnAp9G3vgubRcKoNMcBGqNSMEh8NQJ1dgaS4AOa8B2LJfD-_QXJRs2pRh_GJHTAi3QGo1VtEWcxiY4tA55KPmqOmMlUvnZfB7VyU4egIlxUb/s2811/20231204_194640.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1354" data-original-width="2811" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgVxl2GN4QjJyRFjIA431LMpzWtKobDihdKEPLxzREsXky8AgsfghLHO2kyjuJ2_9Rq1xBNOWzxQF07vkzLnAp9G3vgubRcKoNMcBGqNSMEh8NQJ1dgaS4AOa8B2LJfD-_QXJRs2pRh_GJHTAi3QGo1VtEWcxiY4tA55KPmqOmMlUvnZfB7VyU4egIlxUb/w400-h193/20231204_194640.jpg" width="400" /></a></div><h2 style="text-align: left;"><a href="https://www.lilygo.cc/products/t-display-s3" target="_blank">LilyGo T-Display-S3</a></h2><div>This is another inexpensive device with a wide yet shorter display 320x170. Oh so close to the necessary 200 pixels. So a custom downscaling algorithm favoring the center four vertical pixels of each character cell, while averaging the top two and bottom two pixels. This results in a very recognizable display of alphanumeric characters with some slight distortion at the top and bottom of each character.</div><div><br /></div><div>While this device has plenty of flash storage and PSRAM comparable to the best of M5Stack Cores, there is no built in SD card, so the implementation also leverages a FATFS partition successfully. But with the PSRAM included, D64 support could be included allowing for the floppy drive image feature.</div><div><br /></div><div>BLE keyboard support has also been included with this one, making it full featured.</div><div><br /></div><div>The features missing are no Grove connector, no socket for CardKB support, and Vic-20/C128 support. A bit more effort could transfer these features with software and hardware.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglL33oBs-rSPaqHWSiK7jd6LCH9yZ-ra2r4vS1Rf1lIMFJyoQzP9zvpR5HeM_MMXlK8hTdW8l-Pj1qod3fzYqt_cOKMefPwprXhOvKtZoSqKgcIT5eZDo_DepZWvsbPJ2tMejXJYnjp6HnSpJmWOHmOzaUX_cn7DTEFVU0Z9FnZ-NzFmsHOG9Wv0ZDLnTh/s4032/20231204_193714.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1816" data-original-width="4032" height="144" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglL33oBs-rSPaqHWSiK7jd6LCH9yZ-ra2r4vS1Rf1lIMFJyoQzP9zvpR5HeM_MMXlK8hTdW8l-Pj1qod3fzYqt_cOKMefPwprXhOvKtZoSqKgcIT5eZDo_DepZWvsbPJ2tMejXJYnjp6HnSpJmWOHmOzaUX_cn7DTEFVU0Z9FnZ-NzFmsHOG9Wv0ZDLnTh/s320/20231204_193714.jpg" width="320" /></a></div><h2 style="text-align: left;"><a href="https://shop.m5stack.com/products/cardkb-mini-keyboard-programmable-unit-v1-1-mega8a" target="_blank">CardKB</a></h2><div><span style="font-family: courier;"> Esc 1! 2@ 3# 4$ 5% 6↑</span><span style="font-family: courier;"> 7& 8* 9( 0) <x</span></div><div><span style="font-family: courier;"> Tab Q W E[ R] T/ Y£</span><span style="font-family: courier;"> U| I</span><span style="font-family: courier;">π</span><span style="font-family: courier;"> O' P" fn</span></div><div><span style="font-family: courier;"> Up Shift A; S: D F+ G- H←</span><span style="font-family: courier;"> J= K? L <-</span></div><div><span style="font-family: courier;">Lt Rt Sym Z X C V B N M ,< .> __</span></div><div><span style="font-family: courier;"> Dn</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;">fn+1..fn+0 is ctrl+1..ctrl+0</span></div><div><span style="font-family: courier;">fn+A..fn+Z is commodore+A..commodore+Z</span></div><div><span style="font-family: courier;">Esc is stop</span></div><div><span style="font-family: courier;">fn+Esc is stop+restore</span></div><div><span style="font-family: courier;">tab is load+run</span></div><div><span style="font-family: courier;">fn+tab is restore</span></div><div><span style="font-family: courier;">fn+<x is insert</span></div><div><span style="font-family: courier;">fn+up is clear</span></div><div><span style="font-family: courier;">fn+right is home</span></div><div><span style="font-family: courier;">fn+down is toggle case (cbm+shift)</span></div><h2 style="text-align: left;">Wireless BLE Keyboard</h2><div>Taking CardKB one step farther is joining it with a M5 controller such as M5Stick-C to turn it into a Bluetooth Low Energy keyboard. Currently integrated with M5Fire, M5Core2, M5CoreS3, and T-Display-S3, turn them both on at about the same time and they will automatically pair. While the keyboard is wired to the M5Stick-C, another ESP32 system can be battery powered and receive keystrokes over the air with the BLE (2.4GHz) radio. </div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrdEWx5i6zIx7Qxay8S12kKEReJoXYRHEPL7slVo9rKGigGoF6MT5GcxrRe8PH-RKYkBsxoJNKO7-40qLxK5u0j7jIU6wb9IzeyOWKXVEpo0wADdDxRqokQFCaNiXN8HG1jZP318-WGHBcgZj9oxi7g8OcthYDhjcqIIG9pgUfi993bKJawDZsBsiNp7cK/s3678/20231204_074702-EDIT.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1666" data-original-width="3678" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrdEWx5i6zIx7Qxay8S12kKEReJoXYRHEPL7slVo9rKGigGoF6MT5GcxrRe8PH-RKYkBsxoJNKO7-40qLxK5u0j7jIU6wb9IzeyOWKXVEpo0wADdDxRqokQFCaNiXN8HG1jZP318-WGHBcgZj9oxi7g8OcthYDhjcqIIG9pgUfi993bKJawDZsBsiNp7cK/w400-h181/20231204_074702-EDIT.jpg" width="400" /></a></div><br /><div><br /></div><div><br /></div><div>I used to wire the full size C128 keyboard to my wrist, and it was a hilarious irony in mobile computing.</div><div><br /></div><p></p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-24199816172283851922023-11-03T10:39:00.002-07:002023-11-05T21:31:23.920-08:00When Emulation goes wrong<p>My name is Dave and I'm a software developer.</p><p>I both create and fix defects in code that I've written. Hopefully I find the bugs quickly, but sometimes they linger for weeks, months, years, before being discovered or reproduced.</p><p>My story is not unique. It is difficult or impossible to write software without introducing defects. Computers are complex systems, but very obedient. They do exactly as they are told if you know how to speak their language, precisely, without misunderstanding or any inaccuracies. Problems can crop up if the developer didn't understand the system requirements in the first place (design/requirements issues), didn't thoroughly test all inputs and code paths, didn't understand concurrency issues, made assumptions, or makes the simplest of mistakes. As humans, we learn to overlook some inconsistencies, mistakes of others, so as to not disrupt the social norm. But with most of the languages we use with computers (Assembly, C, C++, C#, Java, etc.) many of these don't allow for the slightest of change. Some scripting languages (HTML, JavaScript, CSS, etc.) allow for some variance, but still are expecting a valid input.</p><p>Am I making an excuse for my mistakes? No, but explaining that they will exist. I wrote a limited Commodore/6502 <a href="https://github.com/davervw/c-simple-emu6502-cbm">emulator</a> a while back and have ported it to various platforms with demonstrable results. I can run Commodore 64 and related systems at the BASIC prompt and it appears to mostly function normally.</p><p>Then I ported to Vic-20 including adding full-screen editing support and conversion from Commodore 64 key scans to Vic-20 key scans. And it did not work. But I swore up and down that I did everything correctly (ha!). Then dove in deeper to see what was different. Turned out the ROL ABS and ASL ABS instructions were doing the value shift but not storing the result in memory. A normal 6502 knows how to do this just fine, but the emulator needed to accurately replicate this behavior to be correct. The fix was to store the result at the absolute 16-bit address.</p><p>My first mistake was that I never performed a formal test of the instruction set of the emulated 6502. I knew they existed, but when bringing up the C64 I only spot checked a few instructions, and even compared traces between Vice and my emulator to note differences, and correct the emulation in a few places. (There's a reason my trace looks exactly like that from Vice -- so the comparison would be easy!) But once the system <i>appeared</i> to function correctly, I stopped testing.</p><p>Fast forward over 3 years later, and I know that some of my systems are not 100% correct. The effort I had brushed away came back to nag me. I really should test better. I have a saying that if it's not tested, it's not working. And I had ignored that saying. But I buckled down and did the effort of running a 6502 test suite against my emulator. And sure enough there were problems.</p><p>And since I have multiple emulator instances, the problems were slightly different, as I hadn't applied fixes consistently between all of them (still have missed a few at date of this article! STM32, mbed, TypeScript still have known bugs). [update 2023-11-05: TypeScript emulator updated with fixes]</p><p>Here are the instructions and features of the 6502 that required fixes in my emulator:</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>ROL (absolute address)</p><p>LSR (absolute address)</p><p>PHP (B flag)</p><p>PLP (B flag)</p><p>IRQ (push processor state without B flag) </p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>(zp,X) indirect zero page indexed by X addressing not truncated to byte address when overlap page, affecting both load value and store value</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p style="text-align: left;">SBC resulting in a negative result when in decimal mode</p></blockquote><p>Many changes are now checked in for C++, C#, Arduino, M5, Teensy and related projects.</p><p>There are remaining bugs in emulation, probably closer to individual system systems outside the 6502 emulation. A few issues can be reproduced on demand, so I can tackle those next.</p><p>But the 6502 emulation should be good, at least as much as it has been tested.</p><p>Thanks to Klaus Dormann for these 6502 tests.</p><p>Reference: <a href="https://github.com/Klaus2m5/6502_65C02_functional_tests">6502_65C02_functional_tests</a></p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-88599088464562193592023-06-30T10:24:00.007-07:002023-08-04T21:47:47.022-07:00Extremely small emulated C64 and C128<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOW6MnZgQwgIvNcQta8tzAMYzdxNg_07nIHdeG0Ufp-Rl4GCq6wd0v8WreUzpMybaQjz3FUtmL8lQxn92sRG3wIa_wNPZI4dKl4yLNxqRcuNOGIdG0uRFotNpjeDtcA7_2ZmFSPIH58ZMvpqPC6lbNDvqjTMZoIEBRoi3bS5SB1GqrGT4qqA6RN24GKUdl/s4032/20230630_080112~2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1816" data-original-width="4032" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOW6MnZgQwgIvNcQta8tzAMYzdxNg_07nIHdeG0Ufp-Rl4GCq6wd0v8WreUzpMybaQjz3FUtmL8lQxn92sRG3wIa_wNPZI4dKl4yLNxqRcuNOGIdG0uRFotNpjeDtcA7_2ZmFSPIH58ZMvpqPC6lbNDvqjTMZoIEBRoi3bS5SB1GqrGT4qqA6RN24GKUdl/w400-h180/20230630_080112~2.jpg" width="400" /></a></div><p><br />This <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/m5" target="_blank">"portable" Commodore 64 and 128 emulator (m5 source code branch)</a> is my work in progress, one in a series of minimalist emulators ported to different hardware targets. Only text (on LCD) with background, foreground, border colors, keyboard entry via USB serial tethered web browser, and general 6502/6510 and C64 memory management emulation is present (no, won't play games, make sound, or do bitmapped graphics) with some D64 emulation [added 7/2/2023].</p><p>(Update 7/28/2023) Now with <a href="https://techwithdave.davevw.com/2022/05/go.html">GO 128</a> command.</p><p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjacm1Rl9f84bix6-hqXvmgu1voisCdLySw3vUHtQ8uHiqdSYuxQFIvtPJNWJQUWPSW4xNgv-7QqhkVjJJLV81k8_O8wYAIejg9m30fhpHj4WmbO_wRy7e7NLIB1AJPhGvb0tAN007XBpTsxR-iztc2qO-SlPTQbx7eMbIS8_SbpXtqUdi-U_Zawm-jMZEM/s2065/c128_on_m5.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="699" data-original-width="2065" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjacm1Rl9f84bix6-hqXvmgu1voisCdLySw3vUHtQ8uHiqdSYuxQFIvtPJNWJQUWPSW4xNgv-7QqhkVjJJLV81k8_O8wYAIejg9m30fhpHj4WmbO_wRy7e7NLIB1AJPhGvb0tAN007XBpTsxR-iztc2qO-SlPTQbx7eMbIS8_SbpXtqUdi-U_Zawm-jMZEM/w400-h135/c128_on_m5.png" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">GO 128 command</td></tr></tbody></table><br /><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHBzew_KrZMqAR5aQAQPQi1wk80isoY73S-Gg1019Ku8Bx1nmdx9_CcisfVmbXEp4Yg3BLL1qLkprJew9H6DFX0PYmiNaknYFZ3ORBxX2o3XEGRTbtmSEtbiYQMWZeZ0kUaWd2QndQ_6k5M41AVOV7kd7OH7yP5qs3DLz3SygKtL8k58_c0N3PsRh76jWV/s3941/IMG_9743~2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1832" data-original-width="3941" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHBzew_KrZMqAR5aQAQPQi1wk80isoY73S-Gg1019Ku8Bx1nmdx9_CcisfVmbXEp4Yg3BLL1qLkprJew9H6DFX0PYmiNaknYFZ3ORBxX2o3XEGRTbtmSEtbiYQMWZeZ0kUaWd2QndQ_6k5M41AVOV7kd7OH7yP5qs3DLz3SygKtL8k58_c0N3PsRh76jWV/w400-h186/IMG_9743~2.jpg" width="400" /></a></div><br /><p>Even my son asked, "Why do you need to do that?" Well, he has a point. I wanted a C64 that fit in my pocket or even on my wrist. And targeting new hardware platforms with my emulator is part of my hobby.</p><p>How does it work? Check out my highly technical drawing.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKWM8265pW46VYZgL6z1QrCcT07qC0PqaohrEgTZCpApJ1g4anlt5teaPxvZiL4T9DbzRG74L3M8bSsHSddcWzGe4DtE3FUqD-ldY6snYV0mt51TIL1q1fMgOo94Xo2AMMXeTqllyaGrSYQCGnNpP5n0QH3waKXJwKtWAkwNzkmSiyZJkatMtW5HHke8tE/s707/Screenshot%202023-06-30%209.42.07%20AM~3.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="662" data-original-width="707" height="375" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKWM8265pW46VYZgL6z1QrCcT07qC0PqaohrEgTZCpApJ1g4anlt5teaPxvZiL4T9DbzRG74L3M8bSsHSddcWzGe4DtE3FUqD-ldY6snYV0mt51TIL1q1fMgOo94Xo2AMMXeTqllyaGrSYQCGnNpP5n0QH3waKXJwKtWAkwNzkmSiyZJkatMtW5HHke8tE/w400-h375/Screenshot%202023-06-30%209.42.07%20AM~3.png" width="400" /></a></div><p>Now I already here you asking why I didn't connect Bluetooth to the M5Core, because certainly it has Bluetooth as well, and why didn't I use a USB keyboard connected to <a href="https://shop.m5stack.com/products/m5stack-cores3-esp32s3-lotdevelopment-kit" target="_blank">CoreS3</a>, because it includes USB Host. But I've had trouble tracking down examples of HID Host examples for M5; client examples are prevalent, but host?</p><p>Pictured here is a phone is running Chrome with a custom copy of <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/m5/browser-keyscan-helper" target="_blank">the html/javascript keyboard adapter</a> including <a href="https://github.com/google/web-serial-polyfill" target="_blank">web-serial-polyfill</a> because mobile Chrome doesn't directly include <a href="https://developer.mozilla.org/en-US/docs/Web/API/Serial" target="_blank">Serial API</a> support. A Palm Pilot foldable keyboard has a Bluetooth adapter, paired with the phone. HID keystrokes are captured by the web page, converted to C64 key scan codes, and a list of the active key scan codes (or 64 when keys released) is sent over USB Serial to the M5Core device which is running the C64 ROMs which are tricked into thinking a real keyboard is attached; keystrokes are processed by the C64 KERNAL IRQ as normal.</p><p>The <a href="https://shop.m5stack.com/collections/m5-controllers/CORE" target="_blank">M5Core</a> is being powered by the phone. Why M5Core? Because it's a polished packaged solution.</p><p>Yeah, we could just run a Commodore 64 emulator on the phone, but this way, I could have complete control over the keyboard emulation, what keys are present, how CTRL and Commodore keys work, etc. And it's just because I can, not because I should.</p><p>Why the Palm Keyboard? Because it folds in my pocket! And because I had one from back in the day. Any keyboard you can attach to a phone or computer should work. And <a href="https://youtu.be/gXvH2a8Eoss" target="_blank">this Bluetooth adapter</a> just makes it so cool, and easier than a tethered keyboard.</p><p>The next step is to merge this solution with my <a href="https://github.com/davervw/c128_keyscan" target="_blank">Commodore 128 keyboard adapter</a> to completely reject the portability feature. <strike>That would look really cool hooked up to my phone!</strike> Update (7/31/2023): check out <a href="https://youtu.be/y0CWe5HWwl8">YouTube</a> for connection from ItsyBitsy/keyboard to Core Port.A.</p><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6J6pstwrEt2DSVs_P9YqSWbhJqkCHkWCCJEEGMhe2MtneXMpgvFdrald8HfDipCDV15VKTAYnZZVOTsUhZ8BI0DJrXVG5KstwxiNUlAhOtTkpDjaqLFHpDNI73AmSA36jnwrUxihU1B4f9ujRRKjLwFSfpWwIVVPYdWxng89UzpJhu4GrrBlL1YXL5_fx/s1805/prototype2.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1015" data-original-width="1805" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6J6pstwrEt2DSVs_P9YqSWbhJqkCHkWCCJEEGMhe2MtneXMpgvFdrald8HfDipCDV15VKTAYnZZVOTsUhZ8BI0DJrXVG5KstwxiNUlAhOtTkpDjaqLFHpDNI73AmSA36jnwrUxihU1B4f9ujRRKjLwFSfpWwIVVPYdWxng89UzpJhu4GrrBlL1YXL5_fx/w400-h225/prototype2.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">C128 Keyboard Adapter Breadboarded Prototype<br /><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN7PSJBaCx0khk8THFs1gtqooAkGALrn20peKMEk9Cb8NVye6i5vxeXwfA86eAXapFQ0R0nnNfsdynLbdbDzXLoMSByu22-dS0DvXdC4ThICGbkgLV4CkEIX1uhSabCa5Htg76MQpzKbpf2zjWJq9oz9l67zHnK_oLwYefv3Iuc58RhDGmVO3KzWx7WUCF/s4032/20230723_202306.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1816" data-original-width="4032" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN7PSJBaCx0khk8THFs1gtqooAkGALrn20peKMEk9Cb8NVye6i5vxeXwfA86eAXapFQ0R0nnNfsdynLbdbDzXLoMSByu22-dS0DvXdC4ThICGbkgLV4CkEIX1uhSabCa5Htg76MQpzKbpf2zjWJq9oz9l67zHnK_oLwYefv3Iuc58RhDGmVO3KzWx7WUCF/w400-h180/20230723_202306.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">7/23/2023: PCB prototype keyboard adapter w/ <a href="https://www.adafruit.com/product/3677" target="_blank">ItsyBitsy</a></td></tr></tbody></table></td></tr></tbody></table><p>I am excited about my nonsense crazy adventures. Even if only I enjoy them.</p><p>=====</p><p>Update (7/2/2023): D64 support is currently working with Core2 only (Basic Core doesn't usually have the additional SPI RAM, but not yet sure why CoreS3 is failing to attach SD).</p><p>Update (7/3/2023): Got CoreS3 working with SD switching header to M5Unified.h for that target (was M5Cores3.h) and adding special definition, override logic for SD_CS to use GPIO_NUM_4 instead of default. See updates to M5Core.h.</p><p>Update (7/28/2023): Commodore 128D extended keyboard working with UART connection to Port.A of Core, and Commodore 128 emulation is ported as well.</p><p>=====</p><br />Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-16683547152860238152023-05-30T00:01:00.002-07:002023-05-30T00:01:09.300-07:00Bible with 8-bit feel interface<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDnbFB9cXWatYEIJ426NuTcIyJy_ouo3f3hl67xD4B9sZlkhZML0mJ5D597RYBwdjuRVXWb9x6Ac-J7JT5lpt-YphOu81iAPs2fpF_WD_tsb4HX8ylGtKmV3PHAQlolfNoqsva3zfbJWqtU-1xMPFqhUI7y1_lxbAS83p7lx2bZUoyEaY8HxA18Su3_g/s1710/Screenshot%202023-05-29%20134542.png" style="display: block; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="1235" data-original-width="1710" height="289" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDnbFB9cXWatYEIJ426NuTcIyJy_ouo3f3hl67xD4B9sZlkhZML0mJ5D597RYBwdjuRVXWb9x6Ac-J7JT5lpt-YphOu81iAPs2fpF_WD_tsb4HX8ylGtKmV3PHAQlolfNoqsva3zfbJWqtU-1xMPFqhUI7y1_lxbAS83p7lx2bZUoyEaY8HxA18Su3_g/w400-h289/Screenshot%202023-05-29%20134542.png" width="400" /></a></div>
<p><a href="https://davervw.github.io/cbmish-bible/?scale=3">Here</a> is my third iteration of an eBible interface -- browsing the Bible (<a href="https://en.wikipedia.org/wiki/King_James_Version">KJV</a>) by electronic means. <a href="https://techwithdave.davevw.com/2011/07/ebible.html">First</a> was a tiny 8x2 text screen on mbed NXP LPC1768 (ARM M3), <a href="https://techwithdave.davevw.com/2014/02/ebible-on-cortex-m0-with-mbed.html">second</a> was a Nokia cell phone screen on mbed NXP LPC1114 (ARM M0 through hole package), and this third one looks very similar to a familiar 8-bit system, running in the browser. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrxggBGpQ0dPKywovwZNBY8dDeVaKeeEGzaJ81zsfHr6jRq3Ce0c5imlWV3FgVhDedkrSmgX5uh7skDLVFVKNRM3SesbKEJmM7ywrJecI8QUDqpyL35RgDwAvwOoGskG90GgHI6L_7lu5uvF9GG-XmVq8VtTHUqXmCrJvDD_2-tfjRv0MD-orLUG1wZA/s2126/ebible1_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="735" data-original-width="2126" height="139" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrxggBGpQ0dPKywovwZNBY8dDeVaKeeEGzaJ81zsfHr6jRq3Ce0c5imlWV3FgVhDedkrSmgX5uh7skDLVFVKNRM3SesbKEJmM7ywrJecI8QUDqpyL35RgDwAvwOoGskG90GgHI6L_7lu5uvF9GG-XmVq8VtTHUqXmCrJvDD_2-tfjRv0MD-orLUG1wZA/w400-h139/ebible1_2.png" width="400" /></a></div><p>The third revision required no soldering, and works with desktop, tablet, mobile phone devices, anything with a modern web browser. This current iteration builds on <a href="https://techwithdave.davevw.com/2023/01/what-is-cbmish.html">cbmish-script</a>, providing the Commodore-like look and feel. </p><h3 style="text-align: left;">History</h3><p>Back 35+ years ago I brainstormed on how to put the Bible on a Commodore computer. For example, with the Bible containing 66 books, I had planned to combine I John, II John, III John as one book, saving two so the book number would be 0..63 fitting in 6 bits. Nah, that's probably silly, one byte is proper to fit the book number. But I never got that far on the Commodore.</p><p>With my first mbed based eBible iteration, I focused on being able to navigate book to book, chapter to chapter, and verse to verse. So I built an index that was stored on the SD card, FAT filesystem.</p><p>The second eBible iteration had a different screen and used simpler block flash memory device (no filesystem whatsoever), with text, indexes, and bookmarks stored at different offsets.</p><p>Just prior to the third iteration, I restored the indexing code, porting from its original state working with mbed and linux, now to Microsoft Visual C++ on Windows. With indexing working, I was playing around and output the Bible text to a <a href="https://github.com/davervw/bible-json">flat JSON format</a> now shared on github.</p><p>Then I created a few JavaScript routines to navigate the text and perform basic operations required for navigation. I hosted the <a href="https://stackblitz.com/edit/js-bible">solution on StackBlitz</a> to begin with as it is a good solution for shared web development with no local tools needed. I just wrote some JavaScript that output very simple HTML, and it was doing something useful very quickly. With some additional polish, it switched from outputting fixed results to populating drop down controls for the books, chapter numbers, and verse numbers, resulting in rudimentary navigation. This solution was shared back to a <a href="https://github.com/davervw/js-bible">GitHub repository</a> as well, and has since been revised to work more standalone from a local file system folder in addition to being hosted on the web.</p><p>All along the way I had planned to revive my Bible on Commodore project, and the idea was to leverage my existing cbmish-script solution, which provides a Commodore look while programming in modern TypeScript.</p><p>So I set out on that journey, and saw results right away. Almost all the bitmapped text on the screen is a link. First the navigation was limited to book/chapter/verse, allowing selection of book, book by book selection of chapter numbers, chapter by chapter selection of verse numbers, and navigation of the text verse by verse, with back links to book, chapter, and verse selections.</p><p>Added on was an about page, stats page, link to cbmish samples, and search for words.</p><h3 style="text-align: left;">Links are almost everywhere</h3><p>Virtually every word and number on the screen is a link. Clicking on text will perform a search of that word showing other references to it. One of the latest features added is being able to replace the word (or phrase) searched for, to truly make this solution interactive.</p><h3 style="text-align: left;">How information is accessed, efficiency</h3><p>How is the latest incarnation indexed? It is not. Each entry has book name, chapter number, verse number, and verse text. It is one long array of verses with this context in order.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhN09FYoat47VnRJnAefm8LRQcmu-G9LrAdmDhv9OMmlGYhjdadSSFBeNTz7L8C6nDgoBr2yJwKTEibewpwYjw7Uzriv2dQ4SmzyzWEpCm0jnFLlQsKmOYx-Ravq6HOdxXJ9baE4dOtxjgp_EKEKCX81zQ1nRMbP4aS1uoVMU4jtLk4YmgI7-gMQmudg/s1363/bible_json.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="997" data-original-width="1363" height="293" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhN09FYoat47VnRJnAefm8LRQcmu-G9LrAdmDhv9OMmlGYhjdadSSFBeNTz7L8C6nDgoBr2yJwKTEibewpwYjw7Uzriv2dQ4SmzyzWEpCm0jnFLlQsKmOYx-Ravq6HOdxXJ9baE4dOtxjgp_EKEKCX81zQ1nRMbP4aS1uoVMU4jtLk4YmgI7-gMQmudg/w400-h293/bible_json.png" width="400" /></a></div><p>To retrieve a specific verse, code scans the entire array for that data, returning a match.</p><p>How much data? About 4 megabytes. Or 6 megabytes with references per entry. Almost 32,000 records/verses in this flat file format.</p><p>The operations involved include retrieving the book names, counting the chapters in a book, counting the verses in a specific book/chapter, retrieving the text of a verse, retrieving all the verse records for a chapter, and finding the verse records containing a specific word or word portion.</p><p>Is it slow? No. It just works. Scanning the 6 megabytes of data is fine on a modern desktop computer or mobile device. Even retrieving a list of all verses containing an "e" or "the" seems instantaneous.</p><p>I was not used to this kind of performance or memory or storage capability when originally coding Commodore or embedded development platforms. But fast processors with lots of resources handle these tasks with ease. It's almost like they were designed to handle big 3D virtual games and a few megabytes of text is no big deal.</p><p>Is it a waste? Is it inefficient? Sure, but today megabytes are measly, and cycles are cheap too. When should we optimize for speed and energy? Of course the answer is that it depends. As this is an interactive application used by a single user occasionally, and performance is absolutely fine, no optimizations are necessary. We are done!</p><p>If you are developing a multi-user system in a VM process in a server farm where you are paying for resources, you may need to prioritize your optimizations for cost, energy use (be a good steward!), and performance.</p><p>It would be easy enough to adapt the flat file into a hierarchical structure, and add indexing for words and text. Handling this complexity is a useful skill even if the performance/processing optimizations are not at all necessary. For now it's just useful enough to consider what effort would be necessary rather than actually performing the extra work.</p><h3 style="text-align: left;">Comparison with Commodore</h3><p>It looks like a Commodore 64 because the resolution, fonts, colors, and behaviors are the same or similar. </p><p>Though a port to a Commodore would require some special work including the indexing.</p><p>Storage - original Commodores didn't have megabytes of storage. Using an SDIEC or similar may be possible, or another hard disk solution. Another choice would be to offload to an add-on board such as ESP32 and optionally a web service.</p><p>Most Commodores didn't have a mouse back in the day, and mouse handling would require extra work too. Additional software and hardware is required, or use of emulation.</p><p>All in all, developing the cbmish-script environment alleviates much of the resource limitations of the original Commodore microcomputer and while it may not be a technically accurate representation, it provides much of the look and feel of the original system.</p><h3 style="text-align: left;">Cbimsh-script technical details</h3><p>cbmish-script uses multiple canvases to provide the border, background, foreground, and sprite layers which are drawn independently, and combined by the browser software. Commodore fonts are drawn pixel by pixel with both character sets available to be displayed simultaneously. Transparent pixels allow a lower level behind to show through (like background).</p><p>Mouse support is provided with click, mousemove, mouseleave window event handlers for the sprite (highest visible) layer. Clickable regions and buttons are drawn highlighted (or unhighlighted) when hovered to demonstrate they may be interacted with the mouse. Similarly they animate when clicked on a touchscreen device. The cbmish-script system keeps track of a list of active buttons and is able to compute which ones are being interacted with.</p><p>This Bible software leverages these regions to also act as a text input field. When the region is clicked on, it activates a bounding box for the region to limit screen updates and cursor movement to that region, exited when Enter or Escape keys are pressed, or the mouse clicks outside the region. An onexit handler regains control and is able to grab the modified text from the screen.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiW6oOTgYj08wzPucxP5QlMdJoNwRIxz-lJqNvkqcO5RUqZg20uZDow5aolOybyXL9m_2VRDTEa3A13AtwnxrKW5mBBt72KNO_URFiSCl_F4W-LVuYvZdTD3TL0quXKgFNpUJISkeQpsmcGVz5oK3bc5U3IKTlb5PvGb_TfX2xUhz5WwR-mOyQlcVkLg/s1200/edit_search.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="863" data-original-width="1200" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiW6oOTgYj08wzPucxP5QlMdJoNwRIxz-lJqNvkqcO5RUqZg20uZDow5aolOybyXL9m_2VRDTEa3A13AtwnxrKW5mBBt72KNO_URFiSCl_F4W-LVuYvZdTD3TL0quXKgFNpUJISkeQpsmcGVz5oK3bc5U3IKTlb5PvGb_TfX2xUhz5WwR-mOyQlcVkLg/w400-h288/edit_search.gif" width="400" /></a></div><p>Before these changes, cbmish-script had limited input capabilities. It had operated in a display only and echo only capacity, displaying what is typed, not intelligently responding to input.</p><h3 style="text-align: left;">What could be added next? </h3><p>Next I should add more input and graphical capabilities to cbmish-script. And/or a responsive mode that changes resolution and orientation with the mobile device or browser window. Maybe add a Bible reading plan/tracker, bookmarks, multiple search terms, and a master word list. Add another Commodore emulator to my repos? Just ideas for now.</p><p>Links</p><p></p><ul style="text-align: left;"><li>Open source: <a href="https://github.com/davervw/cbmish-bible">cbmish-bible</a>, <a href="https://github.com/davervw/cbmish-script">cbmish-script</a>, <a href="https://os.mbed.com/users/davervw/notebook/ebible-abstract/">eBible(M3)</a>, eBible(M0), <a href="https://github.com/davervw/bible-json">bible-json</a>, <a href="https://github.com/davervw/js-bible">js-bible</a></li><li><a href="https://davervw.github.io/cbmish-bible/?scale=3">Hosted solution: cbmish-bible</a></li></ul><p></p><p>
</p><p></p><div id="hc_extension_bkgnd" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255); display: none; inset: 0px; position: fixed; z-index: -1999999999;"></div><span hidden="" id="hc_extension_svg_filters"><svg version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><filter height="99999" id="hc_extension_off" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr tablevalues="0 1" type="table"></fefuncr><fefuncg tablevalues="0 1" type="table"></fefuncg><fefuncb tablevalues="0 1" type="table"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_highcontrast" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr exponent="3.0" type="gamma"></fefuncr><fefuncg exponent="3.0" type="gamma"></fefuncg><fefuncb exponent="3.0" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_highcontrast_back" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr exponent="0.33" type="gamma"></fefuncr><fefuncg exponent="0.33" type="gamma"></fefuncg><fefuncb exponent="0.33" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_grayscale" width="99999" x="0" y="0"><fecolormatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"></fecolormatrix><fecomponenttransfer><fefuncr exponent="3" type="gamma"></fefuncr><fefuncg exponent="3" type="gamma"></fefuncg><fefuncb exponent="3" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_grayscale_back" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr exponent="0.33" type="gamma"></fefuncr><fefuncg exponent="0.33" type="gamma"></fefuncg><fefuncb exponent="0.33" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_invert" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncr><fefuncg amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncg><fefuncb amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_invert_back" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr tablevalues="1 0" type="table"></fefuncr><fefuncg tablevalues="1 0" type="table"></fefuncg><fefuncb tablevalues="1 0" type="table"></fefuncb></fecomponenttransfer><fecomponenttransfer><fefuncr exponent="1.7" type="gamma"></fefuncr><fefuncg exponent="1.7" type="gamma"></fefuncg><fefuncb exponent="1.7" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_invert_grayscale" width="99999" x="0" y="0"><fecolormatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"></fecolormatrix><fecomponenttransfer><fefuncr amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncr><fefuncg amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncg><fefuncb amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncb></fecomponenttransfer></filter><filter height="99999" id="hc_extension_yellow_on_black" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncr><fefuncg amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncg><fefuncb amplitude="-1" exponent="3" offset="1" type="gamma"></fefuncb></fecomponenttransfer><fecolormatrix type="matrix" values="0.3 0.5 0.2 0 0 0.3 0.5 0.2 0 0 0 0 0 0 0 0 0 0 1 0"></fecolormatrix></filter><filter height="99999" id="hc_extension_yellow_on_black_back" width="99999" x="0" y="0"><fecomponenttransfer><fefuncr tablevalues="1 0" type="table"></fefuncr><fefuncg tablevalues="1 0" type="table"></fefuncg><fefuncb tablevalues="1 0" type="table"></fefuncb></fecomponenttransfer><fecomponenttransfer><fefuncr exponent="0.33" type="gamma"></fefuncr><fefuncg exponent="0.33" type="gamma"></fefuncg><fefuncb exponent="0.33" type="gamma"></fefuncb></fecomponenttransfer></filter></defs></svg></span>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-9997127775346031172023-01-05T23:14:00.001-08:002023-01-05T23:14:30.704-08:00What is Cbmish?<p> </p><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisrZk6GVbhgfP6EiEuDU404u8eBL2DxvhipkI_8NViOQAMrZd6CVOE6-Rv0emlyJtT-uu3RC1szAMRApkpoTre6I6H6S7XVGdHHOPqGA0PE-4iyN_25vOY5L90pdlSyPThm6t10VD3Px2BpP45NoyfR7PgE5dI8bc9WfWawvASz_QAIZVvDP0rr3rFig/s582/sample.png" imageanchor="1"><img border="0" data-original-height="494" data-original-width="582" height="272" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisrZk6GVbhgfP6EiEuDU404u8eBL2DxvhipkI_8NViOQAMrZd6CVOE6-Rv0emlyJtT-uu3RC1szAMRApkpoTre6I6H6S7XVGdHHOPqGA0PE-4iyN_25vOY5L90pdlSyPThm6t10VD3Px2BpP45NoyfR7PgE5dI8bc9WfWawvASz_QAIZVvDP0rr3rFig/s320/sample.png" width="320" /></a></div><br /><p></p><h3 style="text-align: left;">Is this Commodore?</h3><p>If it looks like a Commodore, acts like a Commodore, and feels like a Commodore, is it a Commodore? Not always. This <a href="https://davervw.github.io/cbmish-script/">cbmish</a> is not a Commodore, and not made by Commodore Business Machines (CBM). But it is like a Commodore, thus the "-ish" (means like). </p><p>Cbmish is like a Commodore. This web software solution provides the feel of a Commodore in a web browser. There's a retro look and feel. But with a more modern programming language.</p><h3 style="text-align: left;">READY.</h3><p>But it says "READY." Is that BASIC? No, it is lying to you. It is not ready for commands. It won't PRINT or GOTO. It is only ready for typing at this point. You can navigate the screen with cursor keys and typing letters, numbers, punctuation, and other symbols. You can change colors, type PETSCII, change to upper/lowercase, switch to reverse characters. It does <u>feel</u> like a Commodore.</p><h3 style="text-align: left;">Mouse</h3><p>It also responds to mouse motion and clicks. That's not a Commodore I ever owned. Those rounded corners and text are buttons, and there are links too. Clicking on a rounded button will present the user with a relevant sample screen, or navigate to another web page. Colors may change, graphics may be drawn, text will display, and sprites may move. </p><h3 style="text-align: left;">Why?</h3><p>So why do this? The about screen goes into some detail. I'm ready to move on from BASIC (gasp!) and 6502 Assembly (gasp!) and I don't really want to program on my Commodore (gasp!), but I do want to continue the look and feel of Commodore. My current efforts are web based and I have been using TypeScript from some years now. My skill is mostly is C languages (C, C++, C#) and while I had shunned web development for sometime, my professional and hobby efforts have collided with doing full-stack development including C# and also TypeScript.</p><p>While interpreted languages aren't usually my thing (though I love me some AWK) I have seen features of JavaScirpt and functional programming influencing C#, and of course there are underpinnings of C in TypeScript too, and similar functional programming in JavaScript/TypeScript too. While they are all quite distinct languages, there is enough familiarity between them, also also gotchas that keep them interesting when they are different. It's fun to know multiple languages!</p><p>This is stuff you could do with your real Commodore, but it's done here using TypeScript written code. TypeScript that is transpiled to JavaScript so it runs in the user's web browser. A combination of HTML, CSS, and TypeScript results in code to provide the cbmish interfaces to present things like one of the favorite 80s retro systems.</p><p>You can code interactively using the browser developer tools, or you can launch Visual Code (or similar) with typescript compiler dependency to have code transpiled as soon as you save. Instructions for both are on github in the README (see link below). </p><h3 style="text-align: left;"><span style="font-family: courier;">10 PRINT "Hello ";: GOTO 10</span></h3><p>So do you really want the equivalent of PRINT/GOTO? Well this will have to do, see immediate mode JavaScript entered into the console of the development tools of Google Chrome web browser.</p><p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjm2amv7ZbMJ4s9WyO7J2Vlvb1sHFr36iJTy2y8VULFkxodvpjc63i1Kx5lLkZeRyOI3nqqxwy2UVX--dpdcMmqEPZqvhORL1Z-epntXDc8iVhVyStrXMjah5M1QlTFpfkBH4GHkQZ8GlJKE0CZu_on1RcwTHighAbyqwk7evGS7YeJvVCapgV0LQJgZg" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="1191" data-original-width="1232" height="310" src="https://blogger.googleusercontent.com/img/a/AVvXsEjm2amv7ZbMJ4s9WyO7J2Vlvb1sHFr36iJTy2y8VULFkxodvpjc63i1Kx5lLkZeRyOI3nqqxwy2UVX--dpdcMmqEPZqvhORL1Z-epntXDc8iVhVyStrXMjah5M1QlTFpfkBH4GHkQZ8GlJKE0CZu_on1RcwTHighAbyqwk7evGS7YeJvVCapgV0LQJgZg=w320-h310" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">PRINT/GOTO equivalent</td></tr></tbody></table><br /></p><h3 style="text-align: left;">Conclusion</h3><p>So long story short, it's a fine time to do Commodore like programming on the web, in a modern language. Take the best of modern languages and pair that with the look and feel of a great retro computer. Are you keeping up with the Commodore? Because cbmish is keeping up with the web.</p><h3 style="text-align: left;">Links</h3><div> <a href="https://github.com/davervw/cbmish-script" target="_blank">open source</a> (MIT License) at github.com</div><div> <a href="https://davervw.github.io/cbmish-script/" target="_blank">live demo</a> (try it now!)</div><div><br /></div><h3 style="text-align: left;">Samples</h3><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhMwyeiWDWgwCtSM7Ns4LP3ipOqKJRO9G5UqptpSpr2T67pEnegU9NmEymxYWOqarkG8VWQW6dyocd6hNCy-QBkpNXS1z-FsaA3YTEtmBbna5kAwnsAwE1crqeUuJdgzsV4NxUIhdamncvmIvxfR6fOU4KkfKsoqmDQAgckDqtmhfPs0_Es32MJe4wTUQ" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="372" data-original-width="562" height="212" src="https://blogger.googleusercontent.com/img/a/AVvXsEhMwyeiWDWgwCtSM7Ns4LP3ipOqKJRO9G5UqptpSpr2T67pEnegU9NmEymxYWOqarkG8VWQW6dyocd6hNCy-QBkpNXS1z-FsaA3YTEtmBbna5kAwnsAwE1crqeUuJdgzsV4NxUIhdamncvmIvxfR6fOU4KkfKsoqmDQAgckDqtmhfPs0_Es32MJe4wTUQ" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">mouse over button</td></tr></tbody></table><br /></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCVspBTNt5wxVTbZY5rhURFbIrOze4mY5iil56aqQIs7gw4SwIrrNrQ8ujlHFH1IwHSE0K_jeq7a5mH_qkpygWHrQalt3vsGWLFX-vReUzP8iy_kcpMU1cTl5_5gUWJOWcbklG-wTrvuBlHaS0211soIOL887wKs9w9hxCEidHRbeGvpbrk6t8UybBKg/s570/colors.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="373" data-original-width="570" height="209" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCVspBTNt5wxVTbZY5rhURFbIrOze4mY5iil56aqQIs7gw4SwIrrNrQ8ujlHFH1IwHSE0K_jeq7a5mH_qkpygWHrQalt3vsGWLFX-vReUzP8iy_kcpMU1cTl5_5gUWJOWcbklG-wTrvuBlHaS0211soIOL887wKs9w9hxCEidHRbeGvpbrk6t8UybBKg/s320/colors.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Colors</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfPJeJgA4M5o3RIAXEepsOUDq8-7gxWkAy_ydzK18frmpe8MOKbQxQznfNr4F7USghy3p4N98l-Ri0eTQR3xGVsZXw9aFCNyRQuh_J3wjULOSD_Uw_RMC74qu1bBA19fpUxJisN_cJq67JEkEhosDnPwk_GrZOz_9GIA9HZGOk41n3BY8FQgLkcbVBPQ/s567/petscii.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="374" data-original-width="567" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfPJeJgA4M5o3RIAXEepsOUDq8-7gxWkAy_ydzK18frmpe8MOKbQxQznfNr4F7USghy3p4N98l-Ri0eTQR3xGVsZXw9aFCNyRQuh_J3wjULOSD_Uw_RMC74qu1bBA19fpUxJisN_cJq67JEkEhosDnPwk_GrZOz_9GIA9HZGOk41n3BY8FQgLkcbVBPQ/s320/petscii.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">petscii</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5ZgD4hEMTAF6ms95WDTK61oJqAM_ak-Zx0gp-xoluJS_j-JvLfiepU94wkBWa53hffk4GJD21ZRtDS_FK67roxRUBTkVS8g8DBi96mAVQCbol9olYEQoyK8sMYIMI-Ze5-k9X-x-n2kd8ZjgGObde08jKTvJo62DgkbtddsNryOKXYQzQ-d8HKtGitQ/s565/chr$.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="372" data-original-width="565" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5ZgD4hEMTAF6ms95WDTK61oJqAM_ak-Zx0gp-xoluJS_j-JvLfiepU94wkBWa53hffk4GJD21ZRtDS_FK67roxRUBTkVS8g8DBi96mAVQCbol9olYEQoyK8sMYIMI-Ze5-k9X-x-n2kd8ZjgGObde08jKTvJo62DgkbtddsNryOKXYQzQ-d8HKtGitQ/s320/chr$.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">chr$()s</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0h39zeF2Geg38kOi_q1iIv-PqRsDmPtkuJSrzegWKoXIP7o3SjsHuFS2efEVREVgr1O7y8nV6hMWhXB4surgvK0jkFsg-whfetcCWMd8SS0tXaq7VZguCpMpZt9GW0vZpyJUHA7P-MY8jfy4BOBSIthyB-huo1q8oNHtmQxXRMjJFzK0VzLeLqk7jUQ/s568/maze.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="376" data-original-width="568" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0h39zeF2Geg38kOi_q1iIv-PqRsDmPtkuJSrzegWKoXIP7o3SjsHuFS2efEVREVgr1O7y8nV6hMWhXB4surgvK0jkFsg-whfetcCWMd8SS0tXaq7VZguCpMpZt9GW0vZpyJUHA7P-MY8jfy4BOBSIthyB-huo1q8oNHtmQxXRMjJFzK0VzLeLqk7jUQ/s320/maze.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Maze</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqJK5uxhb7KCH2Gj8duq58Rgghg4FCYi95JUA_1Gtfgh37fSOu-RYYRTMv6IZPKz7yT2er9uv8PTUCIDyxmd7rDZDel9dNG5OA0ydOUoA0TXU5lWlEZQUWKgqs1wwzE3lEm5a-ERJN5Eku7ef1ohoeGM7BuaXCc47VBFVG-N1dKkMxihXwG2lRNjp5fA/s567/keyboard.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="372" data-original-width="567" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqJK5uxhb7KCH2Gj8duq58Rgghg4FCYi95JUA_1Gtfgh37fSOu-RYYRTMv6IZPKz7yT2er9uv8PTUCIDyxmd7rDZDel9dNG5OA0ydOUoA0TXU5lWlEZQUWKgqs1wwzE3lEm5a-ERJN5Eku7ef1ohoeGM7BuaXCc47VBFVG-N1dKkMxihXwG2lRNjp5fA/s320/keyboard.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Keyboard</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ0lcpMdjOi2VIFcTebVbEC_xw5HUXWPvmmKnslp89zVkBLrsSPijRx7WCl0zSwmIIywBz_wqPFYckQU_WMf32BUE67NgeAemJPZD62kQZBloIpx6983kLsD0nShhMMYN9A4zCDVfL84VhI7YGEu-snZ4mHT_rWOKMuvYgWnq4nGezWjSN4jN-XrtemA/s565/lores.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="372" data-original-width="565" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ0lcpMdjOi2VIFcTebVbEC_xw5HUXWPvmmKnslp89zVkBLrsSPijRx7WCl0zSwmIIywBz_wqPFYckQU_WMf32BUE67NgeAemJPZD62kQZBloIpx6983kLsD0nShhMMYN9A4zCDVfL84VhI7YGEu-snZ4mHT_rWOKMuvYgWnq4nGezWjSN4jN-XrtemA/s320/lores.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">lores</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuVKfXHhrzjoUbeZMj3D8sEqUAB8YM5ul2J78xuKXtMWW5amCEMku9OEbTETyArSV2i91Ye2yqjZBExtSJD8AOkCkEJUFfckJrlypwBuvxjjFZUTXBN4nbQzMjNl2ohrlItDBLjM8O6z9vaw9rwM1ZZDIhLR74PLqajOPE9DZm5Un9TxajqDvRnodeBw/s566/sinewave.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="374" data-original-width="566" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuVKfXHhrzjoUbeZMj3D8sEqUAB8YM5ul2J78xuKXtMWW5amCEMku9OEbTETyArSV2i91Ye2yqjZBExtSJD8AOkCkEJUFfckJrlypwBuvxjjFZUTXBN4nbQzMjNl2ohrlItDBLjM8O6z9vaw9rwM1ZZDIhLR74PLqajOPE9DZm5Un9TxajqDvRnodeBw/s320/sinewave.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">sine wave</td></tr></tbody></table><br /><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEijsOw_-bIIRggoIzN8fkBIcfpPp5uxrb1i_whrkXnDV4RcHgquJ2Kd6ud7-tW_XeXwiOXHMOtNY2tfg8yCh2n5cbzYMRxQBtSDXbtOjIb21886WlijNRdJMz18nZMk_sZ1jBdbV3JzVi1LvW6BnIWndQzqBkBsPtOBHCbmbgECHrowEA8cqk1lPlw9KA" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="370" data-original-width="568" height="208" src="https://blogger.googleusercontent.com/img/a/AVvXsEijsOw_-bIIRggoIzN8fkBIcfpPp5uxrb1i_whrkXnDV4RcHgquJ2Kd6ud7-tW_XeXwiOXHMOtNY2tfg8yCh2n5cbzYMRxQBtSDXbtOjIb21886WlijNRdJMz18nZMk_sZ1jBdbV3JzVi1LvW6BnIWndQzqBkBsPtOBHCbmbgECHrowEA8cqk1lPlw9KA" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">dissolve</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjjfl0Twa5XiujwhpfMiKf6hsiJM_gkt1WGV8MHV0Oxthx80vBAXH2n6CtCjz0NyqSdk8X04lfvoFkpqFTh27dCXizPeKL56z_J_1DRw5vti8xHFOg9mMQ4EPleqcACcYrTI9lvIqU5e7t0ou3kdFMn0z7S3V2J7xBKf-kab8sHRuM1c1HUOWXYkIFfvw" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="373" data-original-width="567" height="211" src="https://blogger.googleusercontent.com/img/a/AVvXsEjjfl0Twa5XiujwhpfMiKf6hsiJM_gkt1WGV8MHV0Oxthx80vBAXH2n6CtCjz0NyqSdk8X04lfvoFkpqFTh27dCXizPeKL56z_J_1DRw5vti8xHFOg9mMQ4EPleqcACcYrTI9lvIqU5e7t0ou3kdFMn0z7S3V2J7xBKf-kab8sHRuM1c1HUOWXYkIFfvw" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">knight vs. dragon<br />sprite animation</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEizDmhK1d808R1lRUyCBW3GlZrwn8oHZYMcPiHwOjzcMIJ0o__T0OXQxS_4ydsuIeWPN_-h9ri1NbSYZipZlnQ6n86PvcO2bJmq5HrUY1tM2Z17cKRASEVya0Ymetm6bccjz2eYLvO80b8KygBdoQJFjiI06jKj1lvyRCASMggPL4mz0z_24F81nwpQ9Q" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="371" data-original-width="566" height="210" src="https://blogger.googleusercontent.com/img/a/AVvXsEizDmhK1d808R1lRUyCBW3GlZrwn8oHZYMcPiHwOjzcMIJ0o__T0OXQxS_4ydsuIeWPN_-h9ri1NbSYZipZlnQ6n86PvcO2bJmq5HrUY1tM2Z17cKRASEVya0Ymetm6bccjz2eYLvO80b8KygBdoQJFjiI06jKj1lvyRCASMggPL4mz0z_24F81nwpQ9Q" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">about</td></tr></tbody></table><br /><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-87748834756616325662022-09-19T22:29:00.004-07:002022-09-19T22:29:42.142-07:00HIRES for Vic-20 (BASIC 2.0 extension) is READY.<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv6g8TJWawqy4UeDcpoHLAV3C2GiOnOVdG9V0QrNgn6o6-il8L-txvbZg9ynFBOLFPi2TOzreZ4m7CaVgqYiA8Un2l4AxsfdOY1kmes_pfzLL0Qix8vfApzmurx3XW029oDOA3hz1X4P81IJWJhlydjQVlXo2VM-u21QPKb0QdqiaZa7oqNZB7kCsVYQ/s360/demo_ship_animation.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="222" data-original-width="360" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv6g8TJWawqy4UeDcpoHLAV3C2GiOnOVdG9V0QrNgn6o6-il8L-txvbZg9ynFBOLFPi2TOzreZ4m7CaVgqYiA8Un2l4AxsfdOY1kmes_pfzLL0Qix8vfApzmurx3XW029oDOA3hz1X4P81IJWJhlydjQVlXo2VM-u21QPKb0QdqiaZa7oqNZB7kCsVYQ/w400-h246/demo_ship_animation.gif" width="400" /></a></div><br /><p></p><p>The BASIC commands are implemented, small font created, and demonstrations implemented. Please enjoy this Space War and Omega Race inspired flying ship.</p><p>Source, disk image, and more details are on <a href="https://github.com/davervw/hires-vic-20" target="_blank">github</a> for Commodore Vic-20 with memory expansion.</p><p>BASIC extension command syntax is:</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p><span style="font-family: courier;"><b>COLOR [foreground[+8][,[background][,[border][,auxillary[,inverse]]]]]</b></span></p><p><span style="font-family: courier;"><b>COLOR [foreground[+8]] @ x1,y1 [TO x2,y2]</b></span></p><p><span style="font-family: courier;"><b>TEXT</b></span></p><p><span style="font-family: courier;"><b>HIRES xresolution, yresolution [,fillbyte]</b></span></p><p><span style="font-family: courier;"><b>DELAY jiffies</b></span></p><p><span style="font-family: courier;"><b>PLOT COLOR ON|OFF</b></span></p><p><span style="font-family: courier;"><b>PLOT [NOT|CLR] (@ x1,y1)|(TO x2,y2)... **</b></span></p><p><span style="font-family: courier;"><b>PLOT 0|1|2|3 (@ x1,y1)|(TO x2,y2)...</b></span></p><p><span style="font-family: courier;"><b>PLOT "ABC" @ x,y [,addr [,width,height [,bytes]]]</b></span></p><p><span style="font-family: courier;"><b>RECT [NOT|CLR] [@] x1,y1 TO x2,y2</b></span></p><p><span style="font-family: courier;"><b>RECT 0|1|2|3 @ x1,y1 TO x2,y2</b></span></p><p><span style="font-family: courier;"><b>SHAPE GET|PUT|OR|XOR|AND|NOT|CLR addr @ x1, y1 TO x2, y2</b></span></p><p><span style="font-family: courier;"><br /></span></p><p><span style="font-family: courier;">** only first @ optional, when not multi-color</span></p></blockquote>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-18276145293754054322022-08-29T14:53:00.002-07:002022-08-29T20:11:15.977-07:00Vic-20 Hi-Res BASIC extension progress<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQ1YaRFZA3R6t59pLrQG0OHjp-_PEMbnOA081a8_EbMLMCWmlZzQ07prnJ7vKiVoz89Ei53m4tt3GXErUbc6KF6FLumdLSibBGa0-ZFve-Gb43rTPnug_gI8FyUCpFLKPoikcVHYdUsbpqS-mK0NmetBkEZYugwhgTsfx70EDMgaI6KncfHPa1cQKTA/s358/video2.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="198" data-original-width="358" height="221" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQ1YaRFZA3R6t59pLrQG0OHjp-_PEMbnOA081a8_EbMLMCWmlZzQ07prnJ7vKiVoz89Ei53m4tt3GXErUbc6KF6FLumdLSibBGa0-ZFve-Gb43rTPnug_gI8FyUCpFLKPoikcVHYdUsbpqS-mK0NmetBkEZYugwhgTsfx70EDMgaI6KncfHPa1cQKTA/w400-h221/video2.gif" width="400" /></a></div><br /><p></p><p>Shape operations are functional, and work has begun on leveraging BASIC keyword extensions (borrowing from my own <a href="https://techwithdave.davevw.com/2020/03/new-hi-res-graphics-for-commodore-64.html">HIRES for C64</a>).</p><p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjkhLuRVWtwT6RwUWUQQmlohgu-Mg1NAmdfh6gXcr3l-ShFL-4zAmMTq6GAUoyrWEOMMr3qFqm2ps5vhuRf73YVDGuaSRpwwoN2biGgjb5nMlywmx_0xJfUixZiv2TCTRRJ6XjQzPt8UFW48MbUPP10ptgbvwBKaAKRshSBnxQAPPV1r9Q-ohQl_b8X3Q" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="1080" data-original-width="1920" height="180" src="https://blogger.googleusercontent.com/img/a/AVvXsEjkhLuRVWtwT6RwUWUQQmlohgu-Mg1NAmdfh6gXcr3l-ShFL-4zAmMTq6GAUoyrWEOMMr3qFqm2ps5vhuRf73YVDGuaSRpwwoN2biGgjb5nMlywmx_0xJfUixZiv2TCTRRJ6XjQzPt8UFW48MbUPP10ptgbvwBKaAKRshSBnxQAPPV1r9Q-ohQl_b8X3Q" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">4UPART program listing</td></tr></tbody></table><br /><br /><p></p><p>While the SYS syntax is implemented, the BASIC keyword work has just begun.</p><p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEicqJwc7WSXo4Sc0mQ64PJHhh2d5Ule7K9rNgi93_KhYLmBmu8OAGMvbwzmVaMiV6TXqI8YkETuMfRXquGK-R4fNj-aunNIX70V5o4W8ZSzAjqqEXMJtMik1jBXKojT-006O6mgFfLEZINGDX72iWcCpy9Itbc1MH7ebIP3wT0a3kKiPqn4RNLt2EARJg" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="642" data-original-width="652" height="393" src="https://blogger.googleusercontent.com/img/a/AVvXsEicqJwc7WSXo4Sc0mQ64PJHhh2d5Ule7K9rNgi93_KhYLmBmu8OAGMvbwzmVaMiV6TXqI8YkETuMfRXquGK-R4fNj-aunNIX70V5o4W8ZSzAjqqEXMJtMik1jBXKojT-006O6mgFfLEZINGDX72iWcCpy9Itbc1MH7ebIP3wT0a3kKiPqn4RNLt2EARJg=w400-h393" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Current vs. Proposed Syntaxes</td></tr></tbody></table><br />Source and disk image are on <a href="https://github.com/davervw/hires-vic-20">github</a><br /><br /><br /><br /><p></p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-25007434462447435942022-08-08T00:59:00.005-07:002022-08-08T17:23:22.252-07:00Knight vs. Dragon prototype on Commodore 128<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYA3n4VT6SddgMD4gZcLFhGu4mpVcUDjdMNOjZjrIn7dFbhnBgo8A47zn7E4GpcUqRgtZcF8yZKqu44PWy5MPC1osmVEQSgABbyQ0e0co9u1MRzuKybVAACGJYlrxTw5dntFAvDTLX0wWloEp0VXkHc3m9Ab1DALt1RBq7ec-XiD4gOWeW2f1cDL24Cw/s1200/ezgif-4-698526c974.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="382" data-original-width="1200" height="127" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYA3n4VT6SddgMD4gZcLFhGu4mpVcUDjdMNOjZjrIn7dFbhnBgo8A47zn7E4GpcUqRgtZcF8yZKqu44PWy5MPC1osmVEQSgABbyQ0e0co9u1MRzuKybVAACGJYlrxTw5dntFAvDTLX0wWloEp0VXkHc3m9Ab1DALt1RBq7ec-XiD4gOWeW2f1cDL24Cw/w400-h127/ezgif-4-698526c974.gif" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div>My son Ben (age 9) designed all the graphics, background and colors. He edited the background screen strictly with inverse spaces. Sprites were edited on the Commodore 128 with <a href="https://archive.org/details/C128_Programmers_Reference_Guide_1986_Bamtam_Books/page/66/mode/2up" target="_blank">SPRDEF</a>. The <a href="https://archive.org/details/C128_Programmers_Reference_Guide_1986_Bamtam_Books/page/30/mode/2up" target="_blank">programming manual</a> has instructions on saving the sprite memory to disk. And I was able to save both the text screen and colors to disk also using the dual screen capability of the Commodore 128 to enter the commands via the 80 column screen (<a href="https://archive.org/details/C128_Programmers_Reference_Guide_1986_Bamtam_Books/page/668/mode/2up" target="_blank">ESC+X</a>). My memory is that I used MONITOR to save using hex addresses, whereas I'm showing <a href="https://archive.org/details/C128_Programmers_Reference_Guide_1986_Bamtam_Books/page/30/mode/2up" target="_blank">BSAVE</a> commands here for more symmetry with the program listing.<p></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p><span style="font-family: courier;">BSAVE "SPRITES",B0,P3584 TO P4096</span></p><p><span style="font-family: courier;">BSAVE "BACKGROUND",B0,P1024 TO P2048</span></p><p><span style="font-family: courier;">BSAVE "COLORS",B15,P55296 TO P56320</span></p></blockquote><p>I wrote the BASIC demo to randomly move the characters, and flash the border red when the sprites collide.</p><p>My son and I made a great team on this project. Thanks to his art and I am very pleased to have introduced him to the Commodore 128 and have him involved in computer animation.</p><p>Links: </p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><a href="https://drive.google.com/file/d/18m32WgnPKTcDilFjlGdVekjbEjaMHQJt/view?usp=sharing">dragon.d64</a> disk image</p></blockquote><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><a href="https://archive.org/details/C128_Programmers_Reference_Guide_1986_Bamtam_Books/mode/2up" target="_blank">Commodore 128 Programmer's Reference Guide </a></p></blockquote>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-77569704600482586842022-08-07T11:49:00.003-07:002022-08-07T11:49:52.339-07:00Left hand keyboard template and AutoHotKey<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjBfq6AhS2_ibslFa1hAtDUmcExmAj3HPqTa1utngT9gqqRm-X1vGPAxXOS4EbpyF8Tzarw9ut7HpMF9ZERZnR6rhW5C9KZnNshGSCVNuQqS4ktVSlLKR4rJxAcAt3kxacLd_sWIiOd9QdMPwZ3mtpL4Ple-RJqK7T5ETHehxmZxQWSkWL7D3pMHz6Klg" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="538" data-original-width="680" height="317" src="https://blogger.googleusercontent.com/img/a/AVvXsEjBfq6AhS2_ibslFa1hAtDUmcExmAj3HPqTa1utngT9gqqRm-X1vGPAxXOS4EbpyF8Tzarw9ut7HpMF9ZERZnR6rhW5C9KZnNshGSCVNuQqS4ktVSlLKR4rJxAcAt3kxacLd_sWIiOd9QdMPwZ3mtpL4Ple-RJqK7T5ETHehxmZxQWSkWL7D3pMHz6Klg=w400-h317" width="400" /></a></div><br /><p></p><p>Back in the day (decades ago), I purchased a <a href="http://www.halfkeyboard.com" target="_blank">Matias Half Keyboard</a> (USB) at a computer show because it was so cool. My plan was to mouse with my right and type with my left. There was a bit of a learning curve, and the keyboard was so tiny. Every key was overloaded so much, I found that using function keys, hotkeys, numbers, cursor keys, etc. was too tricky. So I ended up putting it in a drawer. Years later I resold it on Amazon for the same price I paid.</p><p>Then years later I missed the half keyboard, want to use it occasionally. So I looked for an alternative, and while there are other hardware half keyboard solutions out there, often they are expensive. Even the Matias one is now listed at $595. I paid a sixth of that long ago, but it's a niche product that only a few will need, so that figures.</p><p>A few more searches and I found that someone had created an <a href="https://www.autohotkey.com/board/topic/1257-half-qwerty-one-handed-typing/">AutoHotKey script</a> to do the basic trick in software to make the spacebar a key modifier. The script is straightforward and well written!</p><p>In case you don't know <a href="https://www.autohotkey.com/">AutoHotKey</a>, it is software for Windows that allows you to remap keyboard and mouse events (and other similar things) for macros, and other automation operations. It has its own scripting language for capturing key events and performing key sends, etc. Like you could use it to disable the Caps Lock, launch, close, and reposition your Windows on the screen, copy and paste text on the screen, and all sorts of things.</p><p>To help me learn to use this simple one-handed keyboard script, I've drawn a keyboard with Microsoft Paint, printed it out, and taped to my monitor for easy reference. While the script supports left or right hand operation, I only drew the left hand.</p><p>Skimming the script thread, it appears others have discussed displaying a reference on the screen, so that exercise is left to the reader.</p><p>Hope this is also useful to someone else.</p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-7751206566520646392022-07-17T18:36:00.003-07:002022-07-19T20:16:14.139-07:00Vic-20 HI-RES in progress - Memory Layout<p></p><h3 style="clear: both; text-align: left;">Vic-20 Graphics Memory Layout</h3><div class="separator" style="clear: both; text-align: left;">The Vic-20 doesn't have a native graphics mode. But it can use a character set from onboard RAM, and double the size of character cells from 8x8 to 8x16 pixels.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_BzW6y5jvmZTFU5JBVk33fdCScK1KBF1SYsKZFssLKTUz-gWvWDNS7cCxLDFwXdT7xUJ9ocxr-AUquqkNlasVQ6k1-K0HuoNu59cp_yPlPpZLYZxDqa8iburWnbQ2JLzwWa5mrA9hO5yM54R-QiAptEFiF529Q83hL10YbU9NQVhvB6v_5kLO8-Soog/s352/cells2.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="220" data-original-width="352" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_BzW6y5jvmZTFU5JBVk33fdCScK1KBF1SYsKZFssLKTUz-gWvWDNS7cCxLDFwXdT7xUJ9ocxr-AUquqkNlasVQ6k1-K0HuoNu59cp_yPlPpZLYZxDqa8iburWnbQ2JLzwWa5mrA9hO5yM54R-QiAptEFiF529Q83hL10YbU9NQVhvB6v_5kLO8-Soog/w400-h250/cells2.gif" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div>A solution puts video memory at address 4096 ($1000), and character RAM at ($1000). Notice they are the same? Yes, there's only 5K onboard RAM in addition to color RAM. The first 1K starts at address 0 ($0000), and the other 4K starts at address 4096 ($1000). Regardless of any other RAM present in the system (can add 35K), only that latter 4K is accessible as video/character RAM to the video chip. (Even if the earlier 1K is available, there's too many conflicts with BASIC and KERNAL use).</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">So bitmapped characters (graphics) and video RAM (characters on the screen) have to share the same section of memory. The way bytes work, at most 256 characters could be displayed on the screen, but that would require a full 4K of RAM for their bitmaps (16*256), so something has to give. By using only 240 characters on the screen, that reserves 16*16 = 256 bytes for video memory, and the remaining memory can be used for graphics. For the bitmap to skip over screen memory and avoiding any overlap, the characters used on the screen are indexed starting at 16 ($10).</div><div class="separator" style="clear: both; text-align: left;"><br /></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div class="separator" style="clear: both; text-align: left;">$1000-$10EF screen (240 bytes), values $10-$FF (16 to 255)</div><div class="separator" style="clear: both; text-align: left;">$10F0-$10FF unused (16 bytes)</div><div class="separator" style="clear: both; text-align: left;">$1100-$1FFF bitmap (3840 bytes)</div></blockquote><p>BASIC RAM can be moved to either 3K expansion RAM ($400-$FFF) or 8K or greater expansion RAM ($2000 and later).</p><div class="separator" style="clear: both; text-align: left;">One layout that is possible is 20 characters wide by 12 characters tall = 240 characters = 160x192 resolution.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">The easiest layout of characters is to store them consecutively in memory as shown above. Character layout for the screen is left to right, then wraps to the next row. This scheme matches color memory layout as well. An additional advantage is that time sensitive updates to graphics can be more aligned with the raster line.</div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Another layout of characters is to line them up vertically as shown below. This has the advantage that memory is contiguous vertically until advancing to the next column of 8 pixels. This allows for optimizations in managing graphics memory at the disadvantage of working vertically instead of horizontally, thus fighting the raster line. But color memory is still horizontally oriented, so the address calculation is different, the same as the earlier layout.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh5Nn0QCAP10QOrecGdG6uJiLJX2d3oSgSJUMJ-nHVWnHms89_YTidXQiFMKsZJTjRg1SMAWDEPG-uMGh704bczOQfuTQDQagCfJLSpxSPgRasHcZWem8d1JFxkCh8T0kmfydPqKSOWLt9lbBJGw0rbthFYDlqnnphwDLX_Ebu-DovFqU10RHnIOSVhA/s352/cells1.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="220" data-original-width="352" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh5Nn0QCAP10QOrecGdG6uJiLJX2d3oSgSJUMJ-nHVWnHms89_YTidXQiFMKsZJTjRg1SMAWDEPG-uMGh704bczOQfuTQDQagCfJLSpxSPgRasHcZWem8d1JFxkCh8T0kmfydPqKSOWLt9lbBJGw0rbthFYDlqnnphwDLX_Ebu-DovFqU10RHnIOSVhA/w400-h250/cells1.gif" width="400" /></a></div> <br />As the Vic-20 allows for configuring the number of character columns, character rows, and adjusting top and left margins, a variety of resolutions are possible.<p></p><div>Some notable resolutions include</div><div><br /></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><div style="text-align: left;">160x192, 192x160, 200x144, 144x208, 160x160</div></blockquote><p>The last is mentioned as it is the resolution used by the Super Expander cartridge. But note it only requires 200 bytes of screen memory, so using that resolution leaves 696 bytes of onboard memory unused for graphics/screen that could be available for another use, maybe 506 bytes is still text screen memory. </p><h3 style="text-align: left;">Links</h3><div><a href="https://github.com/davervw/hires-vic-20">Vic-20 open source hi-res support (github)</a></div><div><a href="https://github.com/davervw/hires-vic-20/raw/master/build/hires20.d64">Built D64 disk image for Vic-20 is here</a> and see Usage in <a href="https://github.com/davervw/hires-vic-20#readme">README.md</a></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwYUk_kySKzfUyFmRfVuvplm3eakGf_GbOHTKuBKA_tBForbmh1RTD-3FQ0MNRsR6zhfw9CVUA3zmWUHyXCvmSeAJDbCpFxC85q4AYvCcehrb4WD_m0d7CW5fX7lhc4Jzxswa-lX_6z269mxfSuQ5jgGXZbqCLMInebDOuO_pWcCheDUpPTzdFxczCng/s434/video.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="224" data-original-width="434" height="206" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwYUk_kySKzfUyFmRfVuvplm3eakGf_GbOHTKuBKA_tBForbmh1RTD-3FQ0MNRsR6zhfw9CVUA3zmWUHyXCvmSeAJDbCpFxC85q4AYvCcehrb4WD_m0d7CW5fX7lhc4Jzxswa-lX_6z269mxfSuQ5jgGXZbqCLMInebDOuO_pWcCheDUpPTzdFxczCng/w400-h206/video.gif" width="400" /></a></div><br /><div><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com3tag:blogger.com,1999:blog-4108198519808197057.post-2644871882305649022022-07-16T20:04:00.005-07:002022-07-16T20:17:16.109-07:00Extending C64 BASIC Part Three - Poke multiple bytes<div>This example accepts one address value, followed by multiple byte values appended to the SYS command on Commodore 64. </div><div><br /></div><div>This could be useful for POKEing to screen memory, sprite data, programmable character data, consecutive I/O registers, etc. efficiently in a single statement.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR4Va9YiviUzHUokg-vCh72f9BLFVjAZ3T5yyz-UDBEqTvGd8kWyVCSq7LRYzfdWnXa8nn5loTVWrT-jJyTSuo646coDL4h2ZXSwGPr45GtjW4bKcx7PkB-BtgLkmcw08pZWXv2OWAfhtpIQVTj1gRbTrgWZDllW1wKOAkmd9sX_n-EcSGjxXvJrqcIQ/s1920/pokebytes.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR4Va9YiviUzHUokg-vCh72f9BLFVjAZ3T5yyz-UDBEqTvGd8kWyVCSq7LRYzfdWnXa8nn5loTVWrT-jJyTSuo646coDL4h2ZXSwGPr45GtjW4bKcx7PkB-BtgLkmcw08pZWXv2OWAfhtpIQVTj1gRbTrgWZDllW1wKOAkmd9sX_n-EcSGjxXvJrqcIQ/w400-h225/pokebytes.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKrJsV5bVTsTr_KJZcL5VcXleaBTACQaLdypHM4VPAX34c9YWdNC2Pzev4josYbc6tdPXtBzXGeAhjOk6JM-3FtYTLt8on-p032EdLrto7-Bqj2qTW6iii05MtIihQPrlkl2JJmFHQntryixy4vb36kWYtll7KXKovUjaFKRqWOvDVR4LifXhtCTzJOQ/s1218/poke_bytes_listing.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1218" data-original-width="968" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKrJsV5bVTsTr_KJZcL5VcXleaBTACQaLdypHM4VPAX34c9YWdNC2Pzev4josYbc6tdPXtBzXGeAhjOk6JM-3FtYTLt8on-p032EdLrto7-Bqj2qTW6iii05MtIihQPrlkl2JJmFHQntryixy4vb36kWYtll7KXKovUjaFKRqWOvDVR4LifXhtCTzJOQ/w318-h400/poke_bytes_listing.png" width="318" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9x1TgxOiXBVExbWKpKvxQ7JnHY-_T_5Y6Xc2p0lcA0opHbW9omLyB3aPNzlcDWfKKU61Wg79GC4V9_RrNZQoFptoH8yDhDhagMjmwqYBSc6wxloVsKEed28szDU6To9QcebQvqvFq6xyS0eQdGB_QECy8Zx0hgL-xX3mV3ZhaVZmaIFtDwA3wnRkn0w/s656/poke_bytes_disassembly.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="351" data-original-width="656" height="214" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9x1TgxOiXBVExbWKpKvxQ7JnHY-_T_5Y6Xc2p0lcA0opHbW9omLyB3aPNzlcDWfKKU61Wg79GC4V9_RrNZQoFptoH8yDhDhagMjmwqYBSc6wxloVsKEed28szDU6To9QcebQvqvFq6xyS0eQdGB_QECy8Zx0hgL-xX3mV3ZhaVZmaIFtDwA3wnRkn0w/w400-h214/poke_bytes_disassembly.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both;">Links:</div><div class="separator" style="clear: both;"><a href="https://sourceforge.net/projects/acme-crossass/">ACME cross assembler</a> (optional)</div><div class="separator" style="clear: both;"><a href="https://github.com/davervw/extend-c64-BASIC/raw/master/part-three-poke-multiple-bytes/build/poke_bytes.d64">poke_bytes.d64</a></div><div class="separator" style="clear: both;"><a href="https://github.com/davervw/extend-c64-BASIC/tree/master/part-three-poke-multiple-bytes">open source (github)</a></div></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-31926101566750884222022-07-14T22:09:00.001-07:002022-07-15T20:51:52.994-07:00Extending C64 BASIC Part Two - Parse 16-bit unsigned integer<p>This example parses a 16-bit unsigned integer appended to the SYS command on Commodore 64. </p><p>The number is added to the jiffy clock as the alarm time, and a busy loop is entered waiting for the jiffy clock to advance to the alarm time.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifEnAfBDw_LaLrUDjqJzpuV50NP76kPxm5RdxYvMpAL2Gkdh5N_M4IM3qFdQ_qWIVc1PBsbfjHxhK04-oAU2xt96v_zXzSi6qdq3HEFeEjKeHdPAbolXLK3NrNCFJBkaYpmPuWyKohJUljfeQv-C7QdznC4iIjmsLjBntrZOhCpc-Thg5mstbG2wHg2Q/s1920/delay.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifEnAfBDw_LaLrUDjqJzpuV50NP76kPxm5RdxYvMpAL2Gkdh5N_M4IM3qFdQ_qWIVc1PBsbfjHxhK04-oAU2xt96v_zXzSi6qdq3HEFeEjKeHdPAbolXLK3NrNCFJBkaYpmPuWyKohJUljfeQv-C7QdznC4iIjmsLjBntrZOhCpc-Thg5mstbG2wHg2Q/w400-h225/delay.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZzJyqqBZP-hYtCrJjVV_O1iDWu0_-KTisuweIySVoLD8Wfn8LpAgJsGtNaWhLf_PKz-DPe7n51sOOOyegj6ToGnEGF5-MZLZmrItqU8hx-43XZ-DohHXLsGiI8siwGc4jmSNikrVDiLey5Ook4Mkr9Gz-CtNKZe0alIKEn2Mw2YjZL0c5lNP8nh6QQ/s656/Delay%20listing.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="656" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZzJyqqBZP-hYtCrJjVV_O1iDWu0_-KTisuweIySVoLD8Wfn8LpAgJsGtNaWhLf_PKz-DPe7n51sOOOyegj6ToGnEGF5-MZLZmrItqU8hx-43XZ-DohHXLsGiI8siwGc4jmSNikrVDiLey5Ook4Mkr9Gz-CtNKZe0alIKEn2Mw2YjZL0c5lNP8nh6QQ/w400-h306/Delay%20listing.png" width="400" /></a></div><br /><p>Links: <br /><a href="https://sourceforge.net/projects/acme-crossass/">ACME cross assembler</a> (optional)<br /><a href="https://github.com/davervw/extend-c64-BASIC/raw/master/part-two-delay-jiffies/build/delay_jiffies.d64">delay_jiffies.d64</a><br /><a href="https://github.com/davervw/extend-c64-BASIC/tree/master/part-two-delay-jiffies">open source</a> (github)</p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-51396163944763436262022-06-11T19:38:00.002-07:002022-06-11T19:39:27.391-07:00Slides for C64<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg94NfUshEkZpwmK8kb5XmfrV-MHXX3toQfLMoAotVfC71bihM0TJBvn8pgKjA3fgTudkkYd2_7XQsbPPaf2Tz9gt7698wC1kI9CJbBQTpWN6U4PSoeMi7yd9eoGaMmv5_ByBpLxno8T7tC46pYLpZn4lr1cr0DDyXOLvOcv2dOgZHveqilbf_feQqWjg/s768/slides.gif" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="768" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg94NfUshEkZpwmK8kb5XmfrV-MHXX3toQfLMoAotVfC71bihM0TJBvn8pgKjA3fgTudkkYd2_7XQsbPPaf2Tz9gt7698wC1kI9CJbBQTpWN6U4PSoeMi7yd9eoGaMmv5_ByBpLxno8T7tC46pYLpZn4lr1cr0DDyXOLvOcv2dOgZHveqilbf_feQqWjg/w400-h250/slides.gif" width="400" /></a></div><br />Forget PowerPoint or Google Slides or Apple Keynote. Here is a newer solution for the Commodore 64. Simply use DATA statements in BASIC to define the layout of your slides. What could be easier than that?<p></p><p>Links:</p><p></p><ul style="text-align: left;"><li><a href="https://github.com/davervw/slides-c64">Source</a> on github</li><li><a href="https://github.com/davervw/slides-c64#readme">README.md</a> including instructions, references, and more details</li><li><a href="https://github.com/davervw/slides-c64/raw/master/build/slides.d64">Slides.D64</a> disk image for Commodore 64</li></ul><p></p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-49490833000268355452022-06-04T23:07:00.002-07:002022-06-07T23:15:16.443-07:00easymenu64 - directory and program launcher utility for C64<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhn1Mz0NFYmj0ZekbcSe0qMi71AxePuYTgt94xrbo34tazQ1Y7UvDxLdo7h_ZiG5amVHo1wZnOsVeDksvfjJJ-l205ogfhsl1HVAD22AkfDFm-NBWz9_jamwhHjlQ9yIlczYeTQXvcLLbx7hyRjw4jS9VMpiv_lZEtERAeOrvbw1GyeTT8koQ7eQ4BRqA" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="768" data-original-width="1366" height="225" src="https://blogger.googleusercontent.com/img/a/AVvXsEhn1Mz0NFYmj0ZekbcSe0qMi71AxePuYTgt94xrbo34tazQ1Y7UvDxLdo7h_ZiG5amVHo1wZnOsVeDksvfjJJ-l205ogfhsl1HVAD22AkfDFm-NBWz9_jamwhHjlQ9yIlczYeTQXvcLLbx7hyRjw4jS9VMpiv_lZEtERAeOrvbw1GyeTT8koQ7eQ4BRqA=w400-h225" width="400" /></a></div><p></p><p>I originally wrote this somewhere between 1985 and 1987. I submitted the program and an article to Compute! publications but was rejected, probably not unique or attractive enough of a submission. Well, here it is for the public to see approximately 35 years later. Not sure if I wrote this originally in assembler, or just machine code. I suspect I used machine code for this one. I have done a fair job now disassembling and crafting into assembler (using <a href="https://sourceforge.net/projects/acme-crossass/">ACME cross assembler</a>) for a more modern experience.</p><p>My typical use was to either see what was on the disk, or as a game launcher. Imagine the possibility of many games packed on a 1581 disk. It even supports launching cartridge images.</p><p>I have used it with 1541/1571/1581 but not sure if it works with fully populated large drives. Seems to have trouble with some non-standard drives. I plan to review that in the future. (Update: some fixes have been applied to the original code starting with tagged version 1.1)</p><p>Keyboard and joystick(#2) controls are documented with the source README.</p><p>Links:<br /> <a href="https://github.com/davervw/easymenu64/">open source</a><br /> <a href="https://github.com/davervw/easymenu64/raw/master/build/easymenu.d64">easymenu.d64</a> (disk image)</p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-58636151691982218042022-05-25T20:47:00.005-07:002022-07-14T21:28:23.453-07:00Extending C64 BASIC Part One - Parse String<p>This example parses a string appended to the SYS command on Commodore 64</p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiv9cAqKBuNvgQjhw-KfscV8g1cLEh7wIKCYesElXKPr1jlpmoQnKeUmTqY5Pnh3YClZsgb4tFbsun3t58Kaii0Lsyf0Hz-iBHYKgX4hBX02s6P4sk9BXhXagrkJIPAlSAPzNs3Z3ZktvJI-0t0VQdMjHJfrtmaK3lK_DQVMKDacMoqkwGdmCFZZCVv_g" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="1080" data-original-width="1260" height="343" src="https://blogger.googleusercontent.com/img/a/AVvXsEiv9cAqKBuNvgQjhw-KfscV8g1cLEh7wIKCYesElXKPr1jlpmoQnKeUmTqY5Pnh3YClZsgb4tFbsun3t58Kaii0Lsyf0Hz-iBHYKgX4hBX02s6P4sk9BXhXagrkJIPAlSAPzNs3Z3ZktvJI-0t0VQdMjHJfrtmaK3lK_DQVMKDacMoqkwGdmCFZZCVv_g=w400-h343" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgHofQ3ryxhoMTt4i4PHWQ9VQAY6HOL6SRKnU6oxmjF5v-fgtubtW232z0krlEQVjkAN2UVui9xAWAS6H907E7hS4Jqm10C8vk6zdznL_EzZIAj3A9NSv8I-73VpJHkD37GY7Y_a14cC2VCcHMDd_jUyOb6jxJWQU4_Gs6txXzdlTbXzJ5ZiyDD0r14vw" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="705" data-original-width="1023" height="276" src="https://blogger.googleusercontent.com/img/a/AVvXsEgHofQ3ryxhoMTt4i4PHWQ9VQAY6HOL6SRKnU6oxmjF5v-fgtubtW232z0krlEQVjkAN2UVui9xAWAS6H907E7hS4Jqm10C8vk6zdznL_EzZIAj3A9NSv8I-73VpJHkD37GY7Y_a14cC2VCcHMDd_jUyOb6jxJWQU4_Gs6txXzdlTbXzJ5ZiyDD0r14vw=w400-h276" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigiCco4Y8lIQ-osofwKFsmAKHsd3x5e6t7RgBKc1AYm5RMVdnlqsraZdDU7tuRAzBq0hTVO_OML7KbZy8ie34f7foQ8xjm9OrbBHteufVslhSMsECu4-vqzdd5GiNktp4Dy78sexfeyIEfSqLG-uawiy0Z7ROc9Qk43e8cX1-fdetqTna9jVxx2NCVAw/s656/Reverse%20listing.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="394" data-original-width="656" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigiCco4Y8lIQ-osofwKFsmAKHsd3x5e6t7RgBKc1AYm5RMVdnlqsraZdDU7tuRAzBq0hTVO_OML7KbZy8ie34f7foQ8xjm9OrbBHteufVslhSMsECu4-vqzdd5GiNktp4Dy78sexfeyIEfSqLG-uawiy0Z7ROc9Qk43e8cX1-fdetqTna9jVxx2NCVAw/w400-h240/Reverse%20listing.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div style="text-align: left;">Links: </div><div style="text-align: left;"><a href="https://sourceforge.net/projects/acme-crossass/">ACME cross assembler</a> (optional)</div><div style="text-align: left;"><a href="https://drive.google.com/file/d/1eIHUSrqraum3HbMSjWDwwHZr2tDhRwAy/view?usp=sharing">reverse.d64</a> (updated 2022-05-29 to include source and example startup)</div><div style="text-align: left;"><a href="https://github.com/davervw/extend-c64-BASIC/tree/master/part-one-reverse-string">open source</a> (github)</div></div></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-65896996123386831132022-05-14T13:25:00.007-07:002022-06-17T20:04:00.220-07:00GO 128 enhancement for Commodore<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnOJez-fPjGbc6SM0t_LKewbTi_VdISG61HZ8TDk7pFkSLfv1tL9DeFMin_XrhYg2flcxNSCqM3kVO_WCqZkSSZG5isLzfOlmGFwvT_W0sS0muRWJQRZqjaqgM5rm57XILohBt88CBfmyjb2SZ_15BaGCpHZLE4vEy5S_JpsE_OSDFSeBk_W27KfzJYw/s3840/GO%20vs.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1580" data-original-width="3840" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnOJez-fPjGbc6SM0t_LKewbTi_VdISG61HZ8TDk7pFkSLfv1tL9DeFMin_XrhYg2flcxNSCqM3kVO_WCqZkSSZG5isLzfOlmGFwvT_W0sS0muRWJQRZqjaqgM5rm57XILohBt88CBfmyjb2SZ_15BaGCpHZLE4vEy5S_JpsE_OSDFSeBk_W27KfzJYw/w400-h165/GO%20vs.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><p>One wonderful feature of the Commodore 128 was its compatibility with the Commodore 64. It was an evolution of the Commodore 64 and still supported all the software and hardware from before. For me it was a no-brainer to buy. 80 columns, plus new features, plus CP/M. Adding a mouse, GEOS 128, REU 512K, and 3.5" floppy, and I thought it was the best place to be this side of heaven.</p><p>There were multiple ways to go into Commodore 64 mode.</p><p></p><ol style="text-align: left;"><li>Start with a Commodore 64 cartridge</li><li>Boot/reset with the Commodore key held</li><li>Commodore 128 boot disk that switched to Commodore 64 mode</li><li>Switch MMU to Commodore 64 mode</li><li>GO 64 command</li></ol><div>But the only way to get back into Commodore 128 BASIC 7.0 was to reset the system.</div><div><br /></div><iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/kYUPLnlQbv0" title="YouTube video player" width="560"></iframe><br /><div><br /></div><div>Fast forward a few decades or so, and now we can add GO commands to the other BASIC systems to switch between them. Links: <a href="https://github.com/davervw/simple-emu-c64">cross-platform source</a>, <a href="https://github.com/davervw/simple-emu-c64/releases/tag/v1.8.10">Windows binary release</a>.</div><div><br /></div><div>How does it work? This is emulation. Sorry purists. The Commodore 128 MMU was built so there is no going back out of C64 mode. This was by design to keep 64 mode on the 128 very close to 100% compatibility. But emulation? Anything goes. The GO command is hooked, the argument is checked for a number, and if the number is right, it goes to that Commodore model by restarting the emulation for that system. And thus, when running the BASIC for one system, can quickly switch to another other system (or even reset the system) using the GO command. It even prompts for amount of RAM to allocate (except 128 is fixed at 128).</div><div><br /></div><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><div style="text-align: left;">PET 2001 2K to 64K supported </div></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">Vic-20 5K to 40K supported in hardware supported increments, not all available to BASIC<div style="text-align: left;">64 RAM 3K to 64K supported not all available to BASIC</div></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">Commodore 16 and Plus/4 support 16K, 32K, or 64K<br /><div style="text-align: left;">Commodore 128 fixed at 128K (KERNAL does not do RAM test) </div></blockquote><p>Limitations? Oh, sorry. This emulator is text only. No full screen editor. Doh! No screen pokes either (well not displayed). [Update 6/2021:] PETSCII and commodore graphics characters supported with third party font. Does support console history editor on Windows. Linux and MAC builds (you can build from my open source project) provide only simple line editing capability. Does provide accurate 6502/6510/8502 emulation, RAM banking, etc. according to the platform. So pop into the MONITOR on C128 or C16, Plus/4, or SUPERMON on other platforms to write and edit machine code. And because using console window, the text display size is not as limited, 88 columns for Vic-20 and 160 columns for C128.</p><div><br /></div><div>Save and Load from .PRG is supported as well (except PET at this time, some other limitations). Disk device is ignored, so defaults to local file system. Even use absolute and relative paths.</div><div><br /></div><div>So for simple programs, and just playing around in BASIC, it's not too bad. Text background and foreground color for Vic-20 is enabled because that color palate is more compatible with the Windows console default colors. Reverse text should work on all systems. Home, clear, cursor positioning may work in programs only, not for editing.</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjHX1OudNgELefhfIIHFl0gm0qnv727R5oPSytkmJ76nqjbA3pyzt3vu9NAxEGaxQWYf0HuwJtMsvjxxaQLoMbfRxBzsR6ItFcU-SmyBMdMJgqZZCkbJMz0b6H73Gy6Kj7oIuaToxsBRk5YUcIBu4v6faCMcVo9syfsJZsu9YqlNlSqCwbm9ajIy_svSg" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEjHX1OudNgELefhfIIHFl0gm0qnv727R5oPSytkmJ76nqjbA3pyzt3vu9NAxEGaxQWYf0HuwJtMsvjxxaQLoMbfRxBzsR6ItFcU-SmyBMdMJgqZZCkbJMz0b6H73Gy6Kj7oIuaToxsBRk5YUcIBu4v6faCMcVo9syfsJZsu9YqlNlSqCwbm9ajIy_svSg=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Now prompts for RAM size going to 64</td></tr></tbody></table><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiRKklmg1XmJKf1j1XSwD7XAK13m7GO4vALuL1TkntZb0-50xjC4SP1H05RmFqg5HnQWhkRT_hq6t8fa-RSJAvLtpldg2dDQdQyjzRSxlq7fp8QBgNFB_3H_iyXNMWYQphQpSTzG6P4VcjgIb3qsB69N0M-606oOOLVwLY9yttZcDflhQ_fcULj2hTgzQ" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEiRKklmg1XmJKf1j1XSwD7XAK13m7GO4vALuL1TkntZb0-50xjC4SP1H05RmFqg5HnQWhkRT_hq6t8fa-RSJAvLtpldg2dDQdQyjzRSxlq7fp8QBgNFB_3H_iyXNMWYQphQpSTzG6P4VcjgIb3qsB69N0M-606oOOLVwLY9yttZcDflhQ_fcULj2hTgzQ=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Going to Vic-20 from 64</td></tr></tbody></table></div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgZooAEnh5Jx1n1xIvgAPZATyWcYUnjLbNTinlF1QHFEwAI17GJaTXIFVl43_xikldPGhWJBYaZFIm9pJmHciKVfkrCX9iYzwI69x3gZYcNT36hQWsP9tWFhQyDOcvSA6lKJ8qlGh0uJho2jwJPCPJ_0nGZTuz3wvmbiPc0UiUADTw0D7ZDfvHvgBGAGA" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEgZooAEnh5Jx1n1xIvgAPZATyWcYUnjLbNTinlF1QHFEwAI17GJaTXIFVl43_xikldPGhWJBYaZFIm9pJmHciKVfkrCX9iYzwI69x3gZYcNT36hQWsP9tWFhQyDOcvSA6lKJ8qlGh0uJho2jwJPCPJ_0nGZTuz3wvmbiPc0UiUADTw0D7ZDfvHvgBGAGA=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Going to PET 2001 from Vic-20</td></tr></tbody></table><br /></div><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEj2O0XVwesx4d2T3MocK2W_jb-U1nEZCb5l3moH0sd2u5I3yUlnUGmZxuZLabyQeUy_42WQeyf7TFfVjjIc86Kj0f-3WR2WxqKt_u6QdML1a_VvJIuQlr79w6yIeSR5EAZl0ZRXkZqwPwBdZVZlLhJzbl7fv0amzds54fCpQjFPjT0NmXuh4XbXvUazIw" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEj2O0XVwesx4d2T3MocK2W_jb-U1nEZCb5l3moH0sd2u5I3yUlnUGmZxuZLabyQeUy_42WQeyf7TFfVjjIc86Kj0f-3WR2WxqKt_u6QdML1a_VvJIuQlr79w6yIeSR5EAZl0ZRXkZqwPwBdZVZlLhJzbl7fv0amzds54fCpQjFPjT0NmXuh4XbXvUazIw=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Going to Plus/4 from Vic-20</td></tr></tbody></table></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjUGAdR2mSk_OsKZo5RLo10umTUDZLWf9lS6Hg1YYOViXxzLHp5ZoH8xXLB5pR3D7qfIlmm5QUs1GUyxA82BTBq3a5A922QvRmc-uSsDKSpk38CyIEamXmJgbTqOaIFjJkBEVkS0qbNmG2rhzaRtNwwYdJccU_dcTNgAdOeS0aPtGsE0yRkgn3QOos9Mg" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEjUGAdR2mSk_OsKZo5RLo10umTUDZLWf9lS6Hg1YYOViXxzLHp5ZoH8xXLB5pR3D7qfIlmm5QUs1GUyxA82BTBq3a5A922QvRmc-uSsDKSpk38CyIEamXmJgbTqOaIFjJkBEVkS0qbNmG2rhzaRtNwwYdJccU_dcTNgAdOeS0aPtGsE0yRkgn3QOos9Mg=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Going to Commodore 16 from Plus/4</td></tr></tbody></table><br /><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiywwBgQrpljQocN1Q4Hg_ptZGEIsgxU__KPiYArTrJFMhocOc_LL2djF-Fe32BfBDceccjFTexxnkwElJwVNDHzQQLhO659LJ7ByKZoD1PayAa1OuW53-6DMCHK1i7-OHT6PTvh34IiNtxSo8XW5XcMnz-javIxVrfiIFdC8CjgG0J8c8BTwoiivjwmQ" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="432" data-original-width="322" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEiywwBgQrpljQocN1Q4Hg_ptZGEIsgxU__KPiYArTrJFMhocOc_LL2djF-Fe32BfBDceccjFTexxnkwElJwVNDHzQQLhO659LJ7ByKZoD1PayAa1OuW53-6DMCHK1i7-OHT6PTvh34IiNtxSo8XW5XcMnz-javIxVrfiIFdC8CjgG0J8c8BTwoiivjwmQ=w298-h400" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Going to 128 from Commodore 16</td></tr></tbody></table></div><div><br /></div><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgoS4E0PkoowgANALkSYtJf_8VMpO3RKqeHOYsFjPbzkTWA3CBBpiP5rdCPa5lxTifplqpNluYnX7HIgy0KuNcg6R1eSHkzG-owSIjMxGJlKic6Zue4ULPoatGoNJH6uoyjlbv-xMl5x63stW-bzoAUzEr3ZV8gpL2BUo1-b0dysSkRW4ZH_i92PHJlCw" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="732" data-original-width="1058" height="276" src="https://blogger.googleusercontent.com/img/a/AVvXsEgoS4E0PkoowgANALkSYtJf_8VMpO3RKqeHOYsFjPbzkTWA3CBBpiP5rdCPa5lxTifplqpNluYnX7HIgy0KuNcg6R1eSHkzG-owSIjMxGJlKic6Zue4ULPoatGoNJH6uoyjlbv-xMl5x63stW-bzoAUzEr3ZV8gpL2BUo1-b0dysSkRW4ZH_i92PHJlCw=w400-h276" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Resizable text console - 132x50 text screen on Commodore 128</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU_edywI5OvrzDH28OR_Jx5BNnpZMdL1-ied7zAntkvt_DGDO37yusyv-ozAWKl5FWqgHRfdeAm-QU4i7tdARffjquh7oyHPIfjt8uNaZVmrqiY3xi28WB0DgHbtVVCGEp7bue7yy7IIXkDHO-5kDC9eixKCs7h-S8ClNwjMAm2YgoXa-uFSJ0uXuvrQ/s725/Bil%20and%20Dave.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="561" data-original-width="725" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU_edywI5OvrzDH28OR_Jx5BNnpZMdL1-ied7zAntkvt_DGDO37yusyv-ozAWKl5FWqgHRfdeAm-QU4i7tdARffjquh7oyHPIfjt8uNaZVmrqiY3xi28WB0DgHbtVVCGEp7bue7yy7IIXkDHO-5kDC9eixKCs7h-S8ClNwjMAm2YgoXa-uFSJ0uXuvrQ/s320/Bil%20and%20Dave.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Bil Herd, Ted/C128 hardware design project lead (left) and Dave Van Wagner, geek (right)</td></tr></tbody></table><br /><div class="separator" style="clear: both; text-align: center;"><br /></div>Links: </div><div><ul style="text-align: left;"><li><a href="https://github.com/davervw/simple-emu-c64">cross-platform source</a> </li><li><a href="https://github.com/davervw/simple-emu-c64/releases/tag/v1.8.10">Windows binary release</a></li></ul></div><div><br /></div><p></p>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-60701925691598891382022-05-04T23:50:00.003-07:002022-06-06T21:54:37.971-07:00C128 model support added to simple 6502 Commodore emulator<p>The <a href="https://en.wikipedia.org/wiki/Commodore_128">Commodore 128</a> is a favorite system of mine. I've owned a DCR model (cost reduced with embedded disk drive, the metal case) since around 1987. And it still works fine!</p><p>But this article is about emulation. I <a href="https://techwithdave.davevw.com/2020/03/simple-emu-c64.html">already</a> wrote a C#/.NET based emulator that supports PET/Vic-20/64/16/Plus/4, and just recently have added 128 support. I thought it would be difficult with the C128 custom MMU and VDC. There was a learning curve. And I faked enough of it to boot and work (even with no Z80).</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjS4dxVh2xzA8obif12e3BlVMPm_6bnfxlF21n0eoK0WoixFyBzHGeLGu-KdgPVperUivwocjhwWsDHLC_xTOwv9B3Ersxu3k5ushdd2HCvLEoXjH8R1LAqQt0AT20lbg7LuIw7BZ0h0GtxhQt9BHcnt3I-f-Fxs7BW5oyQpPrIi3EOTwepZCXwuXbxnw" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="382" data-original-width="322" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEjS4dxVh2xzA8obif12e3BlVMPm_6bnfxlF21n0eoK0WoixFyBzHGeLGu-KdgPVperUivwocjhwWsDHLC_xTOwv9B3Ersxu3k5ushdd2HCvLEoXjH8R1LAqQt0AT20lbg7LuIw7BZ0h0GtxhQt9BHcnt3I-f-Fxs7BW5oyQpPrIi3EOTwepZCXwuXbxnw" width="202" /></a></div><br />This simple emulator is a text based emulator run from a console window. It provides only text input and output, in addition to LOAD/SAVE support to the local disk as .PRG files (just a common extension for Commodore program files, unformatted binary data). <p></p><p>Feed the emulator some Commodore ROMs (not included, recommend grab these from <a href="https://sourceforge.net/projects/vice-emu/">Vice</a>) and it can map ROM/RAM into the 6502 memory space and execute 6502 instructions. There are some common KERNAL entry points for character in, character out, check for stop, and load/verify/save operations. These calls are hooked to redirect console input/output to the emulated 6502. Effectively the Commodore computers are running in software.</p><p>These emulated systems don't do the fancy video games. There is a long list of things they don't do, including no PETSCII graphics either. No graphics. No sound. No timers. No color. They don't even do full screen editing. They are stuck using the console editing features. Not great, but it works -- cursor up to recall a previous command in the current screen line editor. And the Windows console editor even survives restarting the program or restarting the Commodore. Please note it is best to use Caps Lock as the Commodore expects uppercase commands most of the time.</p><p>What this does function as is a good text BASIC interpreter, and 6502 machine language environment. Some of the Commodore systems such as the C128 and Plus/4 include their own machine language monitor (MONITOR command). On the PET, Vic-20, and C64, you can load the appropriate SUPERMON for that system.</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgsw9IHnymAFeMpPdkc48s1fsThMdAfTaBWP3cpJsaaqXsql_L4S63Gf5lKIY5E8fqJGxbOHkakEWhKIDnufRkZh7h6vS6hb2ish45fihsrKVAJ1W7UEWn0EkA8Er9MFqYD86oHjukI-tRL0ew_CcsbgE98J1WCWH7lPI7IAsk558oFImVPfJRvKSgVbg" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="1040" data-original-width="1920" height="173" src="https://blogger.googleusercontent.com/img/a/AVvXsEgsw9IHnymAFeMpPdkc48s1fsThMdAfTaBWP3cpJsaaqXsql_L4S63Gf5lKIY5E8fqJGxbOHkakEWhKIDnufRkZh7h6vS6hb2ish45fihsrKVAJ1W7UEWn0EkA8Er9MFqYD86oHjukI-tRL0ew_CcsbgE98J1WCWH7lPI7IAsk558oFImVPfJRvKSgVbg" width="320" /></a></div><br />Since we're using a Windows console in this case (or Linux or MAC... .NET supports them too!), it can be sized to screens larger than 40x25 as well. Imagine the capability of full screen text written in BASIC! Or a long disassembly listing in the monitor. Wow!<p></p><p>Here's how to get started.</p><p>1. Grab the sources from <a href="https://github.com/davervw/simple-emu-c64/tree/c128" target="_blank">github</a></p><p>2. Grab the roms from <a href="https://sourceforge.net/projects/vice-emu/" target="_blank">vice</a>, (a much larger more complete and more accurate emulator, but why would you want that much fun?). Put these in a c128 directory from which you will run the simple emulator. While you're at it, create subdirectories and copy roms for the other systems too.</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>c128: kernal, basiclo, basichi, chargen</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>c64: kernal, basic, chargen</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>vic20: kernal, basic, chargen</p><p>ted: kernal, basic</p><p>pet: basic1, edit1g, kernal1</p></blockquote><p>3. Compile using Visual Studio or dotnet.</p><p>4. Run with the command line argument: c128</p><p><br /></p><p>Why do this? To me this was a challenge to first emulate the 6502, and a challenge to minimally support Commodore BASIC. I thought what is the least amount of support that is needed to have a useful Commodore computer? I knew about the Kernal jump table definition by Commodore. I had seen others do it successfully. And I wanted to do it my way. It was just a mountain to climb, and since I love 6502 and Commodore computers, it is an enjoyable part of my hobby.</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgZzohswl2Y0gvjEPXby2DQyAtsXEuRuoxMGhDYtE7d7LsNSzdjKLLVPwVGFCrg5B_gsrtCP5WtJq8AKfSfDgXVHyPBaC-YfC6d7EpclEykgfS3s5jesJTC6si3pbeeVnk856MNNmvapmWdnLibd8Ujpnqa258dXigwd7N1I4ivdvmMqRrmIHBlSLolPg" style="margin-left: 1em; margin-right: 1em;"></a><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgZzohswl2Y0gvjEPXby2DQyAtsXEuRuoxMGhDYtE7d7LsNSzdjKLLVPwVGFCrg5B_gsrtCP5WtJq8AKfSfDgXVHyPBaC-YfC6d7EpclEykgfS3s5jesJTC6si3pbeeVnk856MNNmvapmWdnLibd8Ujpnqa258dXigwd7N1I4ivdvmMqRrmIHBlSLolPg" style="margin-left: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhiSvr2PF5PxwD02JDQZ-mHGayJxpcgXxnffz91yuHIV1w-4RpbAgN5fZqvEroL7IT73OeLfYddUDQ8AxxYbSpzDQEEBCC3GKfp-qESFhznlH4GeRQgIYfGCgsx6mL1-bdLjcTTIz5DJ_pfw1e0JxqB6lZ1uyVBf3VDZVp3l91o0vT11GKVoJIn7A2_OQ" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="380" data-original-width="443" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEhiSvr2PF5PxwD02JDQZ-mHGayJxpcgXxnffz91yuHIV1w-4RpbAgN5fZqvEroL7IT73OeLfYddUDQ8AxxYbSpzDQEEBCC3GKfp-qESFhznlH4GeRQgIYfGCgsx6mL1-bdLjcTTIz5DJ_pfw1e0JxqB6lZ1uyVBf3VDZVp3l91o0vT11GKVoJIn7A2_OQ" width="280" /></a></div><br /></div>What's next? Probably more blogs and videos documenting and demonstrating this stuff. My goal is to help others learn and in this case specifically enjoy Commodore systems. The source code is open so you're free to inspect and modify it (giving credit where credit is due of course).<br /><br /><p></p><div><div>Links: </div><div><ul><li><a href="https://github.com/davervw/simple-emu-c64">cross-platform source</a> </li><li><a href="https://github.com/davervw/simple-emu-c64/releases/tag/v1.8.10">Windows binary release</a></li></ul><div><br /></div></div></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com0tag:blogger.com,1999:blog-4108198519808197057.post-58868524611732618832021-12-23T10:05:00.006-08:002022-02-20T11:01:03.405-08:00Trace C64 I/O Kernal Jump Table Calls<p>See what your C64 programs are up to! Debug, or help transition from BASIC to assembly language I/O programming.</p><p>c64-io_monitor is a program that allows monitoring or tracing input/output calls on the Commodore 64. It can show counts or a trace log of what calls have occurred. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiqVGwjNrgMgL7SrOVG09nIg3tMznwDthemXEP3Ld5_9edKm-5hdwxxNxN24BV3RW7eSLVCV620NFrcfBtjIyg5NpXzYaKTHbb0DZXgmjR-18VjE4hqYqGJGoZtSe5RO1v1-B92d0awSHmv4PdJwX7UBoOPzakewbcz8KvqcBHMxz6v-wkiDfB53MqDeA=s2600" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="2600" height="266" src="https://blogger.googleusercontent.com/img/a/AVvXsEiqVGwjNrgMgL7SrOVG09nIg3tMznwDthemXEP3Ld5_9edKm-5hdwxxNxN24BV3RW7eSLVCV620NFrcfBtjIyg5NpXzYaKTHbb0DZXgmjR-18VjE4hqYqGJGoZtSe5RO1v1-B92d0awSHmv4PdJwX7UBoOPzakewbcz8KvqcBHMxz6v-wkiDfB53MqDeA=w640-h266" width="640" /></a></div><p>The screenshots show the initial copyright screen, with usage hints, and status (includes trace log bytes available), followed by an example program, and the counts and trace log from running this program.</p><p>Basic usage includes loading io_monitor program from disk at absolute address $C000. It is recommended to lower BASIC by poking to memory address 56 (e.g. POKE 56, 128). Then NEW to both clear variables and reset BASIC program pointers. And use SYS 49152 to initialize the trace/monitor.<br /></p><p><span style="font-family: courier; font-size: x-small;"><b><span> </span>LOAD "io?monitor",8,1<br /><span> </span>POKE 56,128<br /><span> </span>NEW<br /><span> </span>SYS 49152 : REM START MONITOR</b></span></p><p>The monitor copies BASIC/KERNAL ROMs to RAM, patches them to hook the I/O entry points in the Commodore 64 kernal jump table at the end of ROM within the $FF00-$FFFF range. The hooks take care of counting calls, and logging trace information in available RAM. While each call is made, the border color is incremented to show it is working.</p><p>At this point, you may make any I/O calls including keyboard input (plus RETURN), screen output, disk/tape I/O, etc. The I/O calls will be counted/logged.</p><p>When you are finished with the monitoring session, it is recommended to press STOP+RESTORE to reset back to the KERNAL ROMs, then the counts and tracing is turned off.</p><p>Counts can be displayed with SYS 49155, and the trace log can be displayed with SYS 49158.</p><p>The trace log can be sent to a file with statements like the following:</p><p><span style="font-family: courier; font-size: x-small;"><span> </span><b>OPEN 1,8,3,"@0:TESTLOG,S,W"<br /><span> </span>CMD 1<br /><span> </span>SYS 49155: REM COUNTS<br /><span> </span>SYS 49158: REM VIEW LOG<br /><span> </span>PRINT#1<br /><span> </span>CLOSE 1</b></span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhC8wDZcmMTqABxyTuEM6yVx0AagNsalScntewLe8PD4y2jvIOkJY6Td7avtRt2W0pF21N9x6QDp-rnbGqi3M1TLk8p0lpTuDyWNsG7RLYbs6yl6ty1-RPFGEgvKVWZnz7b4pAIWG9SRzdZnHTBEwxRac_lI-IztY1WdiSLWUBzj-1DxwM3OjmtuZTbmA=s1260" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1260" height="343" src="https://blogger.googleusercontent.com/img/a/AVvXsEhC8wDZcmMTqABxyTuEM6yVx0AagNsalScntewLe8PD4y2jvIOkJY6Td7avtRt2W0pF21N9x6QDp-rnbGqi3M1TLk8p0lpTuDyWNsG7RLYbs6yl6ty1-RPFGEgvKVWZnz7b4pAIWG9SRzdZnHTBEwxRac_lI-IztY1WdiSLWUBzj-1DxwM3OjmtuZTbmA=w400-h343" width="400" /></a></div><br /><p>Why did I create this? I have been developing some simple (text only) 6502 Commodore emulators (<a href="https://techwithdave.davevw.com/2021/02/c64-emulator-for-teensy-41-lcdusbsd.html">one</a>, <a href="https://techwithdave.davevw.com/2020/07/commodore-64-running-in-web-browser.html">two</a>, <a href="https://techwithdave.davevw.com/2020/04/commodore-64-for-stm32f429-discovery.html">three</a>, <a href="https://techwithdave.davevw.com/2020/03/simple-emu-c64.html">four</a>, <a href="https://github.com/davervw/c-simple-emu6502-cbm">five</a>) for multiple targets (web, Windows console/terminal, Linux terminal, Mac terminal, Arduino UART, ESP32 UART, Teensy LCD, STM32F4 LCD, and more embedded targets) and am looking at supporting file I/O emulation (open, input, get, print, close, etc.) above and beyond my D64 emulation. One step along the way is understanding Commodore I/O some more from the machine language level. Seeing a trace log provides a closer in-action view of the kernal I/O routines.</p><p><br /></p><h2 style="text-align: left;">Links</h2><p>The <a href="https://github.com/davervw/c64-io_monitor/raw/main/build/io_monitor.d64">D64 disk image</a> contains the machine code for io_monitor (also available as <a href="https://github.com/davervw/c64-io_monitor/raw/main/build/io_monitor.prg">PRG</a>), and some sample programs that can be used to demonstrate the functionality, including viewlog which opens and displays a sequential file (e.g. testlog saved to disk like above). The <a href="https://github.com/davervw/c64-io_monitor">source code</a> posted to github is open source (<a href="https://github.com/davervw/c64-io_monitor/blob/main/LICENSE">MIT Licensed</a> meaning free to use/alter/distribute, giving credit where credit is due, with no warranties).</p><p>Hackaday <a href="https://hackaday.com/2022/02/18/commodore-64-monitor-traces-i-o-calls-eases-debugging/" target="_blank">linked</a> to this article</p><div><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com1tag:blogger.com,1999:blog-4108198519808197057.post-60957532751209063802021-04-25T08:02:00.006-07:002022-05-13T22:42:16.746-07:00Low Resolution Graphics for Commodore<p>Commodore systems come with a graphical character set that can be used for low resolution graphics.</p><p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-4l6OrQIkC3I/YIV5kHr7EZI/AAAAAAAAefQ/mRNqRspjug0wIvDLofUegoeDY7CNBRZAwCLcBGAsYHQ/s1506/PET%2Blores%2Bgraph.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="879" data-original-width="1506" src="https://1.bp.blogspot.com/-4l6OrQIkC3I/YIV5kHr7EZI/AAAAAAAAefQ/mRNqRspjug0wIvDLofUegoeDY7CNBRZAwCLcBGAsYHQ/s320/PET%2Blores%2Bgraph.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">PETSCII low resolution 80x50 example</td></tr></tbody></table><br />All the Commodores include block patterned graphics that can be used to display 2x2 pattern blocks, to double both the horizontal and vertical text resolution, for example from 40x25 to 80x50. Like 4K for the day! <p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-WAlo1kWksus/YIWEGXyBoFI/AAAAAAAAegI/1m0q9MoswIIO6i020ZeHuFC0o_wZXghYgCLcBGAsYHQ/s800/PETSCII%2Bblock%2Bcharacters.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="800" data-original-width="800" height="320" src="https://1.bp.blogspot.com/-WAlo1kWksus/YIWEGXyBoFI/AAAAAAAAegI/1m0q9MoswIIO6i020ZeHuFC0o_wZXghYgCLcBGAsYHQ/s320/PETSCII%2Bblock%2Bcharacters.png" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">PETSCII block characters including inverted</td></tr></tbody></table><p>In the back of our high school math classroom was an original <a href="https://en.wikipedia.org/wiki/Commodore_PET">PET 2001</a>. This system had a chicklet keyboard, built-in cassette drive, and 40 column white on black monochrome screen. This system has no graphics modes beyond the <a href="https://en.wikipedia.org/wiki/PETSCII">PETSCII</a> capabilities.</p><p>One of the exercises in my Algebra 2 class was to graph mathematically functions. I successfully challenged myself back then to plot the graph on the PET using this block graphics method.</p><p>Using 8 PETSCII characters, and the inverse of those characters, all 16 combinations of the patterns can be achieved by setting (POKE) the correct value onto the screen (see the A array in the source). Also achieved is reading (PEEK) the current PETSCII value, converting that into pixel data, and combining existing plotted pixels with a new pixel (see the B array in the source).</p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-IOUhrQbozXM/YIV3dVHsd7I/AAAAAAAAefI/Oyhr_sjxcDUmaXOjtjiC0kQ_a7IFrgrfACLcBGAsYHQ/s1473/PET%2Blores.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="923" data-original-width="1473" src="https://1.bp.blogspot.com/-IOUhrQbozXM/YIV3dVHsd7I/AAAAAAAAefI/Oyhr_sjxcDUmaXOjtjiC0kQ_a7IFrgrfACLcBGAsYHQ/s320/PET%2Blores.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">LORES PET 40COL listing</td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><br /></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-T8-vdQaku5w/YIWMhuV99TI/AAAAAAAAehE/sCRuOUcoSpULHsyZro8VNwceeRgq9Tt2gCPcBGAYYCw/s1861/20210425_082326%2B%25281%2529.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1315" data-original-width="1861" src="https://1.bp.blogspot.com/-T8-vdQaku5w/YIWMhuV99TI/AAAAAAAAehE/sCRuOUcoSpULHsyZro8VNwceeRgq9Tt2gCPcBGAYYCw/s320/20210425_082326%2B%25281%2529.jpg" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">My handwritten PET listing from 1982</td></tr></tbody></table><p>I found my handwritten program listing that dates back to 1982. It's beautiful to see that graphics could be achieved with PETSCII with only a few lines of code. From my positive experiences with the PET, I purchased a Commodore Vic-20, and the Super Expander later in 1983 and switched to high resolution graphics at that point.</p><p>A <a href="https://drive.google.com/file/d/19XpgnLql1B1vbZEbejv22eJ3WlUp5UZr/view?usp=sharing">disk image (D64) of samples</a> for PET/Vic-20/C64 is available. Screen memory locations for PEEK/POKE are different for all the systems, and sizes are adjusted with variables for the 80 column PET, and 22 column Vic-20. The Vic-20 and C64 also have color memory, so an additional POKE is included to match the current text foreground color (PEEK(646)). </p><p>Update [5/13/2022] there are ports for both Commodore 128 40 column screen, Commodore 128 80 column screen (including SYS calls to read/write VDC 8563), and a port to the TED (C16, Plus/4) series systems showing a color gradient possible with those systems.</p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxKN5nHcFJcjsI79NzKpeKblXkbumlDK4lfCLQOmG1mO04hJ4u51OtYLT7J-jRx5nqM8N-ELr0kt_YrxMfHMkydWT3FTLr6kZWfVzpklnFGiZhu8CciYnwKd-lsmcwTtq-QQreNwe45BBWnUTwQfAAU2lWs6HBnQcb3YLfX-qwaBrTS-1Mtcf5sSJ30g/s1259/lores%20disk%20listing2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1080" data-original-width="1259" height="275" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxKN5nHcFJcjsI79NzKpeKblXkbumlDK4lfCLQOmG1mO04hJ4u51OtYLT7J-jRx5nqM8N-ELr0kt_YrxMfHMkydWT3FTLr6kZWfVzpklnFGiZhu8CciYnwKd-lsmcwTtq-QQreNwe45BBWnUTwQfAAU2lWs6HBnQcb3YLfX-qwaBrTS-1Mtcf5sSJ30g/s320/lores%20disk%20listing2.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Disk Listing for different Commodore Models</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-lAg7lK9qBpE/YIV-qvX70RI/AAAAAAAAefg/RgYXp8L57RkAdovd9F-LGoBJ2ZH2Ao0ggCLcBGAsYHQ/s1387/VIC-20%2Blores%2Bgraph.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1078" data-original-width="1387" src="https://1.bp.blogspot.com/-lAg7lK9qBpE/YIV-qvX70RI/AAAAAAAAefg/RgYXp8L57RkAdovd9F-LGoBJ2ZH2Ao0ggCLcBGAsYHQ/s320/VIC-20%2Blores%2Bgraph.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Vic-20 low resolution 44x46 plot</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-ELo810-VxbM/YIV_9mwRkdI/AAAAAAAAefs/BnjifyUYY58ZdGG7uvYM_qP_0iMHVDxiQCLcBGAsYHQ/s1047/C64%2Bhires%2Bgraph.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="871" data-original-width="1047" src="https://1.bp.blogspot.com/-ELo810-VxbM/YIV_9mwRkdI/AAAAAAAAefs/BnjifyUYY58ZdGG7uvYM_qP_0iMHVDxiQCLcBGAsYHQ/s320/C64%2Bhires%2Bgraph.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Contrast with 320x200 high resolution from C64</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-Bq2bhWl4zvs/YIWA9jBGC9I/AAAAAAAAef4/APL639loMUoJG_JtIZ5GHFJQEHS-3_y8gCLcBGAsYHQ/s1469/PET%2Blores%2B80%2Bcolumn%2Bgraph.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="943" data-original-width="1469" src="https://1.bp.blogspot.com/-Bq2bhWl4zvs/YIWA9jBGC9I/AAAAAAAAef4/APL639loMUoJG_JtIZ5GHFJQEHS-3_y8gCLcBGAsYHQ/s320/PET%2Blores%2B80%2Bcolumn%2Bgraph.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">PET 80 column screen 160x50 sample</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-z8YwHgRqqh0/YIWB_3xYIlI/AAAAAAAAegA/1-hu8r4l8vAKS78OY2DpBl1hbakkvVBHwCLcBGAsYHQ/s1515/PET%2Bclover.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1007" data-original-width="1515" src="https://1.bp.blogspot.com/-z8YwHgRqqh0/YIWB_3xYIlI/AAAAAAAAegA/1-hu8r4l8vAKS78OY2DpBl1hbakkvVBHwCLcBGAsYHQ/s320/PET%2Bclover.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">[Change:] 80 P=COS(I)*SIN(I)*2</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-eUW_d_oo2WIH1gXqTXvZvtsadwuwz8-5L39s0XUpyWj8z_mEeT8lBJ7peC9obk9KnK_vJCjNFyP0uwSeI7ZXt3HZDkdTdECnMF47I32yXS9ncQs0H0KC1Db74B6c8W1W1Aa7bycH2GGxfxoyXW70erA0dhy8_mCyE-iNMsLX8bbMuW8dK42g1cFbBg/s1253/ted%20hires%20graph.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="920" data-original-width="1253" height="235" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-eUW_d_oo2WIH1gXqTXvZvtsadwuwz8-5L39s0XUpyWj8z_mEeT8lBJ7peC9obk9KnK_vJCjNFyP0uwSeI7ZXt3HZDkdTdECnMF47I32yXS9ncQs0H0KC1Db74B6c8W1W1Aa7bycH2GGxfxoyXW70erA0dhy8_mCyE-iNMsLX8bbMuW8dK42g1cFbBg/s320/ted%20hires%20graph.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Commodore 16, Plus/4 screen 80x50 sample (TED)</td></tr></tbody></table><br />Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com3tag:blogger.com,1999:blog-4108198519808197057.post-50256046068013172542021-02-22T23:19:00.007-08:002022-02-26T16:14:31.587-08:00C64 Emulator for Teensy 4.1 LCD/USB/SD(D64)<div class="separator" style="clear: both;"><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-jQ4Bnem-Flc/YDZwczJNU2I/AAAAAAAAdY0/WaRndqdyonQ1iLGx8RRfsGrZpFalHSFZwCPcBGAsYHg/s4032/20210224_072454.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1960" data-original-width="4032" height="312" src="https://1.bp.blogspot.com/-jQ4Bnem-Flc/YDZwczJNU2I/AAAAAAAAdY0/WaRndqdyonQ1iLGx8RRfsGrZpFalHSFZwCPcBGAsYHg/w640-h312/20210224_072454.jpg" width="640" /></a></div><br /><div style="text-align: center;"><br /></div>Here is my <a href="https://www.pjrc.com/store/teensy41.html">Teensy 4.1</a> on a breadboard pretending to be a Commodore 64. USB keyboard, color text, background, border, and D64 (1541 image) support for LOAD/$/SAVE. 6502 emulation supports machine language, and Commodore 2.0 BASIC programs. Sorry text only, no games, no graphics, no sound, no joysticks, just simple stuff for now. But that simple stuff works! (mileage may vary, lightly tested, please try this at home under controlled conditions).</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">My Open source: <a href="https://github.com/davervw/c-simple-emu6502-cbm/tree/teensy_lcd">https://github.com/davervw/c-simple-emu6502-cbm/tree/teensy_lcd</a></div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-F-LKtvrxFp0/YDVOHjbBjjI/AAAAAAAAdYA/u59Lft4R81QWk0POTrqMbAu5eSv0Q9TgQCPcBGAsYHg/s2911/20210223_104500.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1960" data-original-width="2911" height="430" src="https://1.bp.blogspot.com/-F-LKtvrxFp0/YDVOHjbBjjI/AAAAAAAAdYA/u59Lft4R81QWk0POTrqMbAu5eSv0Q9TgQCPcBGAsYHg/w640-h430/20210223_104500.jpg" width="640" /></a></div><br /><div class="separator" style="clear: both;">Also see <a href="https://blog.adafruit.com/2021/03/23/a-commodore-64-emulator-for-the-teensy-4-1-board-with-lcd-usb-and-sd-teensy-commodore-vintagecomputing-emulation/" target="_blank">link from Adafruit's blog</a>!</div><div class="separator" style="clear: both;"><br /></div>Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com2tag:blogger.com,1999:blog-4108198519808197057.post-84682177078789789662021-01-17T22:42:00.007-08:002021-02-24T21:28:56.967-08:00How to Build Vice 3.5 (x64sc, etc.) on Raspberry Pi 400<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-KriGVu7fqs4/YAUsbJhnC-I/AAAAAAAAcvY/3eLRsTgayFo2OA78YoekM5KNsW7iqomzACPcBGAsYHg/s3665/20210117_222846.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1912" data-original-width="3665" src="https://1.bp.blogspot.com/-KriGVu7fqs4/YAUsbJhnC-I/AAAAAAAAcvY/3eLRsTgayFo2OA78YoekM5KNsW7iqomzACPcBGAsYHg/s320/20210117_222846.jpg" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Raspberry Pi 400</td></tr></tbody></table><p><br />The Raspberry Pi 400 invokes a sense of nostalgia back to the all-in-one systems of the past, such as those commonly available in the 80's (about 40 years ago!) of having the keyboard and computer all in one, with connections at the back of the enclosure, and expansion at the back of the enclosure.</p><p>My favorite system released January 1982 was the Commodore 64.</p><p>So why not have both? With emulation, let the Raspberry Pi 400 become a Commodore 64 as well.</p><p></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-nuR2npJCBQw/YAW2OehVV6I/AAAAAAAAcwU/zi3gvFtkd947DGWVyRg7cmW5hpmJFdUFQCLcBGAsYHQ/s1920/2021-01-17-223940_1920x1080_scrot.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1080" data-original-width="1920" src="https://1.bp.blogspot.com/-nuR2npJCBQw/YAW2OehVV6I/AAAAAAAAcwU/zi3gvFtkd947DGWVyRg7cmW5hpmJFdUFQCLcBGAsYHQ/s320/2021-01-17-223940_1920x1080_scrot.png" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Vice 3.5 built, running on Raspian</td></tr></tbody></table><br />One way to do this, is using Vice (the Versatile Commodore emulator). Of course you can use a prepackaged solution like <a href="https://retropie.org.uk/">Retropie</a> and <a href="https://emulationstation.org/">Emulation Station</a>. But since it is open source, you can also just download and build the source yourself.<p></p><p>As vice 3.5 was just released Christmas Eve, 2020, it makes a lot of sense to build yourself, so you can have the latest build relatively easily. Just think of all those new features!!!</p><p>I've attempted this myself on my Raspberry Pi 400 (and expect should work on others fine too) with Raspian. I've tested with both the latest 32-bit ARM, and beta 64-bit ARM builds.</p><p>Following are the steps I took to accomplish building the default configuration. I followed the basic instructions, and when configuration or build failed due to a dependency, researched the dependencies necessary (thanks Google and all those who have built before me and posted their solutions). </p><p>Grab yourself your favorite beverage, power up your Pi, and get building! And once you're done, feel free to test my <a href="https://github.com/davervw/hires-c64/blob/master/build/hires.d64">hires.d64</a> image. Maybe even pick up some <a href="https://www.4keyboard.com/commodore-keyboard-stickers/585-2817-commodore-commodore-64-non-transparent-keyboard-stickers.html#/21-key_size-11x13/33-background_color-white" target="_blank">keyboard stickers</a>. And also can run Pet, Vic-20, Commodore 128, etc.</p><p>Summary</p><p></p><ol style="text-align: left;"><li><span style="font-family: arial;">Install dependency packages</span></li><li><span style="font-family: arial;">Download three archives from web: vice 3.5, SDL2, SDL2_image</span></li><li><span style="font-family: arial;">extract the archives to their respective directories</span></li><li><span style="font-family: arial;">configure, build, and install each iteratively in the order: SDL2, SDL2_image, vice 3.5</span></li></ol><div>Full Steps (note versions may change, these were the ones available January 2021):</div><p></p><ul style="text-align: left;"><li><span style="font-family: arial;">sudo apt-get install flex bison xa65 libgtk2.0-dev texinfo libxxf86vm-dev dos2unix libpulse-dev libasound2-dev</span></li><li><span style="font-family: Arial;">sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra </span></li></ul><ul style="text-align: left;"><li><span style="font-family: arial;"><a href="http://libsdl.org/download-2.0.php">http://libsdl.org/download-2.0.php</a> Download </span>SDL2-2.0.14.tar.gz - GPG signed</li><li><span><span style="font-family: arial; white-space: pre-wrap;">cd ~</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">tar xvfz ~/Downloads/SDL2-2.0.14.tar.gz</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">cd SDL2-2.0.14 </span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">./configure</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">make</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">sudo make install</span></span></li></ul><ul style="text-align: left;"><li><span><span style="font-family: arial; white-space: pre-wrap;"><a href="https://www.libsdl.org/projects/SDL_image/">https://www.libsdl.org/projects/SDL_image/</a> Download </span></span>SDL2_image-2.0.5.tar.gz</li><li><span><span style="font-family: arial; white-space: pre-wrap;">cd ~</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">tar xvfz ~/Downloads/SDL2_image-2.0.5.tar.gz</span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">cd SDL2_image-2.0.5 </span></span></li><li><span><span style="font-family: arial; white-space: pre-wrap;">./configure</span></span></li><li><span style="font-family: arial;">make</span></li><li><span style="font-family: arial;">sudo make install</span></li></ul><ul style="text-align: left;"><li><span style="font-family: arial;"><a href="https://vice-emu.sourceforge.io/">https://vice-emu.sourceforge.io/</a> Download tarball: vice-3.5.tar.gz</span></li><li><span style="font-family: arial;">cd ~</span></li><li><span style="font-family: arial;">tar xvfz ~/Downloads/vice-3.5.tar.gz</span></li><li><span style="font-family: arial;">cd vice-3.5</span></li><li><span style="font-family: arial;">./configure</span></li><li><span style="font-family: arial;">make</span></li><li><span style="font-family: arial;">sudo make install</span></li></ul><p></p><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br />Dave VWhttp://www.blogger.com/profile/15279700646705387039noreply@blogger.com17