Developing software for Commander X16

kenmgj

New Member
Jun 24, 2019
2
1
3
41
Buffalo, NY
I am most looking forward to developing software for the Commander X16 once it is released. It's not completely clear to me the best way for me to start working on things now. I have already started reading materials on 65xx assembly. I've been working through a C64 book but I know that there will be differences, especially with graphics and sound. Does anyone have strategies or materials to recommend so that I can "hit the ground running" when the Commander X16 is released? Thanks!
 
May 22, 2019
486
250
43
The best thing you can do for yourself is do some coding for the Commodore 64, probably using a combination of CBM PRG Studio and VICE (for testing/debugging.)

David is using a Commodore 64 as his template system, so just about anything you learn for Commodore will apply on the Commander.
 
Sep 9, 2019
30
9
8
It's worth looking at https://github.com/KarolS/millfork

It's a mid level language highly tuned for 8bit CPUs. I've used this for many platforms recently C64,Sega Master System,NES,MSX,and Lynx.

I was able to reproduce the tilemap demo and posted a tweet thread here
In that thread is a gist of the code and settings.
I haven't tackled sprites as yet.
Obviously I only have the emulator to test ,once I have sprites working and some art conversion tools I'll make a real git repo vs the gist.
 
Sep 9, 2019
30
9
8
It's worth looking at https://github.com/KarolS/millfork

It's a mid level language highly tuned for 8bit CPUs. I've used this for many platforms recently C64,Sega Master System,NES,MSX,and Lynx.

I was able to reproduce the tilemap demo and posted a tweet thread here
In that thread is a gist of the code and settings.
I haven't tackled sprites as yet.
Had some more time to play with the commander-x16 and got joystick support to work with Millfork language .. ( it wasn't hard I was just dumb )

I can clean this up and share with others now
 
Sep 9, 2019
30
9
8
Millfork looks cool ... I've been playing with another language that seems to do a similar thing called Prog8 :


Looks like Millfork is further along
I used Millfork as it supports other CPUs. I'm making a simple testbed game that currently runs on C64,Sega Master System,NES, Pacman arcade hardware,and MSX 1. So I have experience making new targets and libraries for it. I'm planning x16 support library and other new 8bit platforms too.
 
Sep 9, 2019
30
9
8
I used Millfork as it supports other CPUs. I'm making a simple testbed game that currently runs on C64,Sega Master System,NES, Pacman arcade hardware,and MSX 1. So I have experience making new targets and libraries for it. I'm planning x16 support library and other new 8bit platforms too.
There's not a lot of platform specific code I've written for each , so the core game just works pretty well.
 

PowerfulBadBoy

New Member
Jul 17, 2019
21
11
3
I'm currently fiddling around with cc65 to see if I can get it to work with the x16 (gonna see if I can make a config file)
I've got it to compile and the x16 crashes when LOADing the result and that's basically as far as I've got.

Ps. Impressive stuff @MonstersGoBoom
 
Last edited:
  • Like
Reactions: MonstersGoBoom

PowerfulBadBoy

New Member
Jul 17, 2019
21
11
3
After many a headscratch I finally got cc65 to properly compile code (config file laughably out of reach for now though, might make a rubbishy edit to the c64 one where I redefine the zero page space (already done but untested) and properly define the stack so a hack isn't required)

Ps.
To anyone else using cc65: Does your version automatically assemble and link the C file you feed in?
I had to manually add those steps to the makefile in the demo someone helpfully made as it doesn't include them and outputs an assembly text file that caused the emulator crashes I was getting.
 
  • Like
Reactions: MonstersGoBoom

SidSom

New Member
Sep 15, 2019
2
0
1
I am most looking forward to developing software for the Commander X16 once it is released. It's not completely clear to me the best way for me to start working on things now. I have already started reading materials on 65xx assembly. I've been working through a C64 book but I know that there will be differences, especially with graphics and sound. Does anyone have strategies or materials to recommend so that I can "hit the ground running" when the Commander X16 is released? Thanks!
BASIC is a good way to start and it is very similar; of course, you'll probably want to move on to Assembly.
 

Artur

New Member
May 20, 2019
5
3
3
I work with cc65 so maybe I can give some hints here:

The compiler itself does not assemble or link. ca65 and ld65 does that. What you're looking for is cl65 which does all three (by calling cc65, ca65, ld65).
I usually use GNU Make to keep things clear.

Successful compiling is matter of a working crt0.s and linker configuration. It is easy to support the banks of the X16 with #PRAGMA directives too.
The cc65 github issues already have a fix for crt0.s and also sooner or later (matter of days it seems) there will be headers too:

 
  • Like
Reactions: PowerfulBadBoy

Wertyloo

Member
Sep 15, 2019
72
7
8
how fast is the bank-switch in clock cycles[how many cycles needs to wait after i wrote the register]? all the 2M space are switchable with the same speed? is the switched 8k space writes all the same speedcost in cpu-cycles as the normal memory[$0000-$a000]? are the video-mem switchabe into the mem area in 8k chunks to do, like fast 8k chunk direct video-memory writes?
 
Last edited:
May 22, 2019
486
250
43
how fast is the bank-switch in clock cycles[how many cycles needs to wait after i wrote the register]? all the 2M space are switchable with the same speed? is the switched 8k space writes all the same speedcost in cpu-cycles as the normal memory[$0000-$a000]? are the video-mem switchabe into the mem area in 8k chunks to do, like fast 8k chunk direct video-memory writes?
The memory banks are selected through the 6522 VIA. So the switching happens at whatever speed the VIAs propagate a change between their input and output. I believe this is less than one clock cycle, but I don't know for sure.

If I'm reading the datasheet correctly, the maximum delay is 1 microsecond. On a 1MHz CPU, this is fine, but the CX16 is supposed to run at 8MHz, so you might need one or two other instructions in the middle before you begin accessing banked RAM.

The banked memory itself doesn't appear to have an additional latency, so you should be able to write to it as fast as the CPU can do so.

The video memory is on its own daughterboard. The way you access video memory is through a set of 8 I/O registers. The procedure is....

Set an address and increment value on the 3 address registers.
Read or write the value on the data register
This automatically moves the data address to the next location (based on the increment value.)
Continue reading or writing until your task is complete, or until you need to reset the address register. (For example, to start the next row of a graphic block.)

It's actually very easy to do, and the code is actually simpler than using Zero Page as a pointer for memory access. If you go look at my "Fun With VPOKE" example, I show how to do it in BASIC.
 

DennisJ

New Member
Sep 20, 2019
2
3
3
Thank you for the info on Millfork! Got it compiling now.

It's worth looking at https://github.com/KarolS/millfork

It's a mid level language highly tuned for 8bit CPUs. I've used this for many platforms recently C64,Sega Master System,NES,MSX,and Lynx.

I was able to reproduce the tilemap demo and posted a tweet thread here
In that thread is a gist of the code and settings.
I haven't tackled sprites as yet.
 
  • Like
Reactions: MonstersGoBoom