Thursday, January 5, 2023

What is Cbmish?

 


Is this Commodore?

If it looks like a Commodore, acts like a Commodore, and feels like a Commodore, is it a Commodore?  Not always.  This cbmish is not a Commodore, and not made by Commodore Business Machines (CBM).  But it is like a Commodore, thus the "-ish" (means like).  

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.

READY.

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 feel like a Commodore.

Mouse

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.  

Why?

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.

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!

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.

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). 

10 PRINT "Hello ";: GOTO 10

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.

PRINT/GOTO equivalent

Conclusion

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.

Links

    open source (MIT License) at github.com
    live demo (try it now!)

Samples

mouse over button

Colors

petscii

chr$()s

Maze

Keyboard

lores

sine wave

dissolve

knight vs. dragon
sprite animation

about