Jump to content
  • 1
Damaniel

What languages are X16 programmers using?

Question

After seeing the new site up and running (and David's 'dream computer' videos showing up in my suggested YouTube playlist again for some reason), I decided that I was finally going to grab the X16 emulator and start playing around with the environment.  I'd really like to write a tiny roguelike, but I figured I'd start small and just try to become familiar with the 6502 again, as well as experiment with VERA.  While it might help get me up to speed, BASIC may eventually be too limiting for what I'd like to do, and my 6502 assembly skills are very, very rusty - I actually wrote a 6502 emulator as part of a NES emulator I planned to develop, and I even did a little dabbling in NES development, but that was many years ago.  These days, my retro programming work is usually done with higher level languages  - predominantly Turbo Pascal on MS-DOS era PCs. 

Before I spend too much time deciding what to use to develop my project, I thought I'd throw out a simple question to the people here already creating and posting projects - what programming language(s) are you using?  I know there's the obvious ones - Commodore BASIC and 6502 assembly - but is anyone using a non-BASIC, higher level language?  Are there even any 6502 compatible language compilers (C, Pascal, etc) that can target the X16? Finally, are there any assemblers that can run directly on the X16, or are they currently all cross assemblers?

  • Like 1

Share this post


Link to post
Share on other sites

24 answers to this question

Recommended Posts

  • 0
Posted (edited)

There are a couple of people working in C. In particular, folks have been getting X16-specific updates pushed to cc65, a C-compiler and linker that specifically targets 8-bit platforms based on the 6502. cc65 is being used by a few folks for straight-up 6502 assembly programming, since it includes a fully-featured segmented assembler as well.

I believe someone is working on a version of Turbo Rascal for the X16, but I can't recall who that is. They've been on the Facebook group somewhere with a tech demo.

And then there's @SlithyMatt, who benefits from a seemingly endless well of energy, passion, and time, and has not only already completed a game for the X16, but is working on a high-level game and scripting engine called XCI (eXtremely Compact Interpreter). And is contributing to a JRPG being developed for the X16. o_O I'm not sure what his secret is. I just hope its more along the lines of being excellent and not mysterious transparent pills.

I don't know of any assemblers or compilers that run directly on the X16 yet.

Edited by StephenHorn
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

I'm using cc65 in combination with a Visual Studio Code plugin. Until now I only use C, but at some point I will have to use some assembler, too.

I briefly looked into millfork, there is a X16 adaptation for it. But I figured that the above combination of languages will suit me better.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

I'm using a combination of basic and assembly. Taking the CX16 as an opportunity to learn and write games in assembly.   

I'm using the CBM PRG Studio package - It's designed for Vic20/C64/C128 but it still works with the CM16 emulator. I can write basic and assembly in a nicely laid out IDE, and it compiles assembly, and combines it with basic to make a single PRG you can load directly on the emulator.

Although from the conversations I've had with *proper* programmers on here (I don't consider myself proper!), this isn't ideal, and I should really move onto a better compiler!

Edited by JohnGill

Share this post


Link to post
Share on other sites
  • 0

@StephenHorn I told you never to tell anybody about my special pills!

Actually, I don't really spend a lot of time, just a few hours every night after I put the kids to bed. I am missing "Peak TV", for the most part.

Share this post


Link to post
Share on other sites
  • 0

I'll very probably be using Millfork. I like how it feels, it's a middle ground between assembler and C or something. At the very least, it supports structs, functions, loop etc! Also the source module system is pretty good and support for x16 is already there. Looking forward to start programming!

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
21 minutes ago, msx said:

I'll very probably be using Millfork. I like how it feels, it's a middle ground between assembler and C or something. At the very least, it supports structs, functions, loop etc! Also the source module system is pretty good and support for x16 is already there. Looking forward to start programming!

I'm using Millfork together with VScode (it even has a add-on for Millfork & X16emu).

Still a good idea to know a little bit about 6502 assembler since some commands in Millfork (like vera_poke), is a little bit slow if you only want to poke 1 thing into the Vera (it pokes 3 values every time).

Happy coding 🙂

Share this post


Link to post
Share on other sites
  • 0
30 minutes ago, SplitSpine said:

I'm using Millfork together with VScode (it even has a add-on for Millfork & X16emu).

Still a good idea to know a little bit about 6502 assembler since some commands in Millfork (like vera_poke), is a little bit slow if you only want to poke 1 thing into the Vera (it pokes 3 values every time).

Happy coding 🙂

I have to look into that add-on. Been using notepads for coding Millfork until now 🙂

You're right about the vera_poke(), but you don't need assembler to access single fields of the vera control, there are some globallly defined alias for that in the sources. Indeed the vera_poke() is just this:

inline void vera_poke(int24 address, byte value) {
 vera_ctrl = 0
 vera_addr = address
 vera_data0 = value
}

Obviously it's still good to know some 6502 assembler 🙂

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
16 hours ago, msx said:

I'll very probably be using Millfork. I like how it feels, it's a middle ground between assembler and C or something. At the very least, it supports structs, functions, loop etc! Also the source module system is pretty good and support for x16 is already there. Looking forward to start programming!

This is the exact kind of thing I'm looking for - a little higher level than pure 6502 assembly with the ability to still inline assembly as needed.  I'm definitely going to check this out.

For those interested, the GitHub for the project is https://github.com/KarolS/millfork

EDIT: Since the native version of Millfork on Github is based on a release from April, and doesn't appear to include support for the latest VERA, I just spent the last 3 hours fighting Java/Scala, GraalVM, native-image and Windows to create a native copy of millfork.exe based on the latest commit on master in the repo.  I tested it out in VSCode with the CommanderX16 plugin and it runs a simple Hello World app just fine.  If you want to grab it, I've popped it in my Google Drive here.

Edited by Damaniel
  • Like 2

Share this post


Link to post
Share on other sites
  • 0

I am using Turbo Rascal, which is a Pascal-like something with a nice IDE. It has not too much support for CX16 - they have no time to maintain the support, and BTW they are looking for someone to do it - but it has a really effective compiler. The language is a bit pain speed is beforehand everything, has no fancy libs, and every new release breaks the code almost uninvestigateable ways.  It was developed by demosceners for demosceners.

Share this post


Link to post
Share on other sites
  • 0

I'm using C and the cc65 toolchain. 

For grins I'm a little curious about using Rust for the X16 at some point.  There is an alternate Rust compiler (https://github.com/thepowersgang/mrustc) which compiles Rust code into C which could then be compiled with cc65.  There was a proof of concept demonstrating this for the C64 (with patches against mrustc and cc65).

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

I am using Acme assembler and apparently do not possess the programming skills to run in to the problems that other people have talked about. To edit my files, I use Atom editor with 65x2 plugin to do highlighting.

Sendt fra min motorola one zoom med Tapatalk

Share this post


Link to post
Share on other sites
  • 0

I'm not a fan of C, but I have been using cc65 as that's what looks like to have the greatest support. I would like to learn and use forth, but none are available currently.

Share this post


Link to post
Share on other sites
  • 0

Maybe the best would be if there was an official or a recommended developing environment for the X16, an open source project that we all could help maintain? It should include an extension for VS Code and hopefully an integration with the emulator’s debugger to form a complete IDE. It seems like Cc65 is the best candidate for this. Or are there others?

A dilemma with developers are that we often have a project that we dream of developing all by ourselves? It’s quite natural, it’s a certain challenge to proof that you can do it on your own and you get to make all decisions yourself. But the problem is that many projects never get finished and if they are, they aren’t maintained or further developed. That’s why we have all these tools that never reach version 1.0. Cc65 was abandoned 2013 if I understand it right, but later on come to life by the help of others. ACME is also abandoned as it seems.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

cc65 is pretty close, only debugger support in VS.Code seems to be missing. At least I haven't discovered any. There is a VS.Code extension (maybe abandoned, too) which supports VICE debugging, but that doesn't help us.

But I think one of the key ideas behind the X16 is to be easily accessible. That's not exactly the case with cc65 and VS.Code. So I would assume BASIC will be the official environment. Probalby with an updated editor.

If you are looking for cross-development tools: have you looked into Turbo Rascal? Or AsmFun?

Share this post


Link to post
Share on other sites
  • 0
Maybe the best would be if there was an official or a recommended developing environment for the X16, an open source project that we all could help maintain? It should include an extension for VS Code and hopefully an integration with the emulator’s debugger to form a complete IDE. It seems like Cc65 is the best candidate for this. Or are there others?

A dilemma with developers are that we often have a project that we dream of developing all by ourselves? It’s quite natural, it’s a certain challenge to proof that you can do it on your own and you get to make all decisions yourself. But the problem is that many projects never get finished and if they are, they aren’t maintained or further developed. That’s why we have all these tools that never reach version 1.0. Cc65 was abandoned 2013 if I understand it right, but later on come to life by the help of others. ACME is also abandoned as it seems.
Acme is not abandoned. https://sourceforge.net/projects/acme-crossass/

Sendt fra min motorola one zoom med Tapatalk

Share this post


Link to post
Share on other sites
  • 0

cc65 was not abandoned either, development has continued (and is very active) under a new team. The originator is just no longer actively involved.

Share this post


Link to post
Share on other sites
  • 0

A development environment that calls the assembler of preference would be fine, but what would be lovely is a cross platform assembler development environment which has a common user interface with a hosted assembler development environment.

And that should have a common user interface to the "Super-Monitor" in ROM.

Share this post


Link to post
Share on other sites
  • 0

I've been using acme, simply because it was the easiest to get started learning 6502.  As for my development environment, I just use vim and a simple Makefile with build, clean, and run commands.  I use vim at work all day (I'm one of those guys), so this feels the most natural for me.

Shameful secret:  sometimes just for kicks, I run vim from cool-retro-term and feel super nostalgic.

image.thumb.png.403b54405049a740ac6d3ae6e840d13a.png

  • Like 4

Share this post


Link to post
Share on other sites
  • 0

There you go. I use acme and Notepad++, and since I am normally grinding through on the same project day after day, batch files <mainfilename>_make.bat and <mainfilename>_run.bat.

Share this post


Link to post
Share on other sites
  • 0

Maybe this is not the best example, but I develop the Commander X16 ROM using the ca65 assembler from the cc65 project.

Unlike assemblers like acme, the ca65 assembler requires separate assembly and link steps, but since it's designed as the backend of a C compiler, it is extremely versatile.

For debugging, my setup is probably the most uncommon: I exclusively use the -trace function of the emulator. It prints one line for every assembly instruction executed, with the label, bank, address, disassembly and register contents. In this mode, the emulator is about 10x slower than normal, so I have to script the emulator (-bas, -run, ...) to reach the interesting code as quickly as possible.

I pipe the output of -trace into the Unix less tool, so I can search for symbols ("/") – the equivalent of breakpoints. I can search for the next ("n") or previous  ("N") instance, and search for the point when code returns to the caller by searching for the bank and the first two digits of the caller address (e.g. .,02:de if the address of the caller is .,02:de24). If I missed the correct spot, I can always rewind – after all, it's all one big text file with all CPU history. Instead of less, I can also use grep, wc, uniq etc. to get statistics.

  • Like 2

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

I'll be using my own language Prog8!  :classic_smile:

I just released version 4.0 which is the first version that has some support for CommanderX16 as a compiler target.  The announcement of that is in the General Chat subforum.

 

As it is a cross-compiler, all development conveniently takes place on my Linux box and the cx16 emulator is launched to load the resulting prg.

Originally Prog8 targeted only the Commodore 64 and the Vice64 emulator, so features are better there, but I plan on improving prog8 language and compiler support for CommanderX16.  Hopefully also based on some feedback from others that decide to try it out!

Edited by desertfish
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use