[HN Gopher] Colecovision BASIC compiler: CVBasic v0.1.0
       ___________________________________________________________________
        
       Colecovision BASIC compiler: CVBasic v0.1.0
        
       Author : nanochess
       Score  : 105 points
       Date   : 2024-03-01 18:04 UTC (1 days ago)
        
 (HTM) web link (forums.atariage.com)
 (TXT) w3m dump (forums.atariage.com)
        
       | pjmlp wrote:
       | Looks quite nice, and in tune with was common to use on Z80s. :)
        
       | hnthrowaway0328 wrote:
       | Getting an alpha version done in two days is a pretty mighty
       | accomplishment. Congratulationa!
       | 
       | I have been working on a learning project to produce an
       | interpreter of a sub set of Python written in Python (most
       | arithmetic ops, assignment ops, if-elif-else, while-break,
       | function calls) and it took me about 2 months to complete it in
       | my free time.
       | 
       | I wish I could be more focused and motivated.
        
         | nanochess wrote:
         | Thanks! It was coded fast because I reused parts of my
         | IntyBASIC compiler like the lexer, the expression analyzer, and
         | the decision statements core (GOTO/GOSUB/WHILE/WEND etc). The
         | first version of IntyBASIC took me almost two months to be
         | ready.
        
         | ikari_pl wrote:
         | for which platform?
        
           | hnthrowaway0328 wrote:
           | My interpreter? Oh it's just a simple frontend. My plan is to
           | first convert it to an ast tree walker, and then add a
           | backend for some vintage platform. I am also thinking about
           | generating llvm IR as it makes it trivial for the backends.
           | 
           | I knew nothing about compiler theory so it took me way too
           | much time to implement break and function call correctly.
        
         | vasvir wrote:
         | I think you are too harsh on yourself.
         | 
         | Doing a compiler from scratch is a serious task.
         | 
         | The guy had the experience of another Basic compiler and it may
         | even had previous experience from other compiler projects.
         | 
         | I once implemented an interpreter for a custom DSL that had
         | only boolean logic (and, or) and parenthesis precedence. It
         | took me one week but then again I was totally green in the
         | field.
        
         | ggambetta wrote:
         | I mean, OP is a legend; we mere mortals shouldn't really
         | compare ourselves to them :)
         | 
         | My stuff is not nearly as impressive as what Toledo, Carmack,
         | or Bellard do, but honestly, how many people can claim theirs
         | is?
        
       | jonstewart wrote:
       | Awesome! I did my first programming on my dad's ADAM, which came
       | with an introductory BASIC book.
        
         | jhbadger wrote:
         | The ADAM's SmartBasic was interesting in that it was
         | specifically designed to be as close as possible to Applesoft
         | on the Apple II given how common the Apple was in US schools in
         | the early-mid 1980s.
        
       | behringer wrote:
       | Sorry but this is not the first Colecovision BASIC compiler.
       | ugBASIC supports colecovision:
       | https://ugbasic.iwashere.eu/targets
        
         | dang wrote:
         | Ok, we've reverted the title above. Submitted title was "First
         | Colecovision BASIC compiler (Z80) now available"
        
           | nanochess wrote:
           | Thanks. I stand corrected.
        
             | behringer wrote:
             | Still pretty cool, and it's probably he first dedicate to
             | and custom tailored to the Coleco! Come hang out with us
             | BASIC folks over on discord if you use it
             | https://discord.gg/jS6Jx8yJQP
             | 
             | We have a few BASIC creators (and of course users) over
             | here including Marco who created ugBASIC.
        
       | Agingcoder wrote:
       | I love this kind of tool. I often wonder what people would have
       | done back in the days with it !
        
       | tombert wrote:
       | I've debated making a game for the Coleco just because it was
       | substantially less limited than the Atari 2600, but still old
       | enough to be interesting. The fact that I'd have to do it in
       | assembly was the big turn-off there, so playing with BASIC might
       | be more fun.
       | 
       | I'd be super interested in trying a FORTH system as well, if
       | anyone knows of something like that for the Coleco.
        
         | mech422 wrote:
         | IIRC, there was a really neat looking FORTH for the C64 focused
         | on game programming: White Lightning[0]. oh - it runs on Zx80
         | too... I always wanted to play with it as a kid, but never got
         | around to it :-/
         | 
         | 0: https://www.forth.org/lightning.html
        
           | buescher wrote:
           | There were a few things written in Forth for the Atari
           | 8-bits, most notably RAMbrandt and Omnitrend's Universe. I
           | don't recall any action games in Forth.
        
             | crq-yml wrote:
             | Forth (according to sources I have not verified) powered
             | the influential CRPG series of Stuart Smith: Fracas (1980),
             | Ali Baba and the 40 Thieves (1981), Return of Heracles
             | (1983), and Adventure Construction Set (1984). All were
             | multi-platform releases. If true, Forth was a good fit for
             | that, since it would function as the game's scripting
             | environment as well as the engine, and it would
             | additionally explain why those games feel like more
             | developed scenarios than contemporary rivals.
             | 
             | Action games needed tighter main loops for gameplay so my
             | understanding is that where Forth was used for those, it
             | was primarily as a macroassembler system.
             | 
             | I am exploring Forth for Agon Light right now. Since the
             | Agon is a modern 8-bit design swaggering around with an
             | eZ80 at 20MHz, 512kB RAM, and a programmable VDP with
             | functions resembling GPU shader programming, it can absorb
             | all the interpreter overheads easily.
        
         | buescher wrote:
         | Retro-wise, the MSX platform is extremely similar and would
         | have a bigger audience.
         | 
         | The popular home computers of the era would also fit your
         | criteria - why the Coleco?
        
           | tombert wrote:
           | I had one as a kid, hand me down from my dad. I always liked
           | it.
        
       | jhbadger wrote:
       | BTW, the author of this earlier created IntyBasic, a Basic
       | compiler for the Mattel Intellivision
       | (https://intellivisionrevolution.com/intybasic). And the famous
       | "nanochess" tiny chess engine (hence his user name of nanochess)
        
       | ubavic wrote:
       | Great job!
       | 
       | I am actually thinking these days about building a BASIC compiler
       | for another Z80 retro machine (Galaksija). But I am a little bit
       | afraid about the machine code generation part. How hard was it to
       | target Z80?
        
         | nanochess wrote:
         | Automatic generation of code for Z80 is kind of hard because
         | some operations are forced to use a few registers. For example,
         | ADD only works with A or HL (and IX or IY), and the code
         | generator requires register shuffling or using the stack for
         | saving temporary values. My current approach is building a node
         | tree for expressions, generating code by detecting common
         | patterns, and if there isn't a pattern it goes the complicated
         | but simple way. For example, for add: right expr. / push hl /
         | left expr. / pop de / add hl,de
        
       | ashleyn wrote:
       | Love these. There was a BASIC compiler for the Sega Genesis too,
       | BasiEgaXorz: https://devster.monkeeh.com/sega/basiegaxorz/
        
         | runamuck wrote:
         | The eyeball searing orange text on fluorescent teal background
         | made me chuckle like an idiot. Did the web page designer troll
         | me? I love it either way.
        
       | sixothree wrote:
       | I got a virus warning and windows deleted the entire zip. Just a
       | heads up. Maybe source or a signed file or something might go a
       | long way to fixing that.
       | 
       | Regardless. Fun stuff. Looking forward to trying. Maybe in a vm.
        
         | sixothree wrote:
         | https://www.virustotal.com/gui/file/0e7f4069ee45094375d30008...
         | 
         | So it phones home and downloads a file and uploads 3? Or am I
         | interpreting this incorrectly?
        
         | nanochess wrote:
         | It's a problem related to Visual C++ 2008 redistributables
         | triggering false warnings. I'll try to compile the next version
         | with something more recent.
        
       | lebuffon wrote:
       | Off topic but interesting: Over in the TI-99 section of
       | atariage.com the boys have ported GCC to a machine first designed
       | in 1978. :-) It's taken a while to get all the kinks out. First
       | attempts were made in 2010. Great progress has been made in the
       | last several months as it now seems to compile most people's
       | projects successfully.
       | 
       | https://forums.atariage.com/topic/164295-gcc-for-the-ti/#com...
        
       ___________________________________________________________________
       (page generated 2024-03-02 23:02 UTC)