Monday, September 27, 2021

Installing the Mega 65 Kick Assembler tool chain on a Mac

This is an explanation of how I implemented Shallan50k's tool chain in a Mac environment. This has only been tested on MacOS version 11.5 but I have no reason to believe it won't work on other versions.

Install xemu


Get the latest version of xemu from:




Open the installer and drag the xmega65 icon to the applications folder.


Open the xemu65 application and configure any options required. See mega65.org for detailed instructions on how to set up the emulator


Virtual disk tools


To create and write to virtual floppy disks you will need the c1541 tool which is part of the VICE C64 emulator package.


Download the latest version of vice and install into the applications folder.


Vice can be found here:



Setting up Kick 

*Please not KickAssembler is a Java application so you must install Java onto your Mac, installing Java is beyond the scope of this document but Google is your friend.


To code for the Mega 65 you will need the current version of Jesper’s Kick Assembler for which supports 45gs02 (Thanks Jesper!)


The files can be found here:





Download the Jar file and copy to: /Applications/KickAssembler and rename it to KickAss.jar


*you don’t have to use this location but I like to keep all my Apps in the Application folder. If you chose to put it elsewhere then ensure you make changes to reflect this path later on


Creating a make file


In the same folder as the main.s file (or whatever the core source file is called) create a file, the filename is not relevant but convention says use make.sh


Copy the following into the make file:


echo Assembling Code

java -cp /Applications/KickAssembler/kickass.jar kickass.KickAssembler65CE02 main.s -odir ./bin -vicesymbols -showmem 

echo making Disk

/Applications/VICE/x64sc.app/Contents/MacOS/c1541 -format "disk,0" d81 "./bin/disk.d81"

echo copying program to disk

/Applications/VICE/x64sc.app/Contents/MacOS/c1541 -attach "./bin/disk.d81" 8  -write "./bin/main.prg" main

echo launch xemu

/Applications/xmega65.app/Contents/MacOS/xmega65 -besure  -prg "./bin/main.prg" &


And save the file.


From a command shell change directory to the source code folder where the make file is located and type:


chmod +x make.sh


This will allow the make file executable.


Setting up sublime


From the Sublime Text menu select preferences, then browse packages. This opens a finder window, copy the syntax file from https://github.com/smnjameson/M65_KickAsm_Macros into this folder.


From the View->Syntax menu select KickAssember (Mega65) option.


All 45gs02 code will now be highlighted correctly, to test this create a test.s file and enter a command such as ldz #$50 and ldy #$50 they should be both highlighted the same.



Go to Tools->Build System->New build system…


Replace the default text with




            "shell_cmd": "./make.sh"



Then save it as mega65.sublime.build


From Tools->Build System now tick the mega65 build option.


Apple-key b will now build and run the project.


Finally and big shout out Shallan50k and Jesper for all the work they put in to get the mega 65 development environment working. All I did as put a few Apple twists to get it working on Mac. 

Saturday, January 30, 2021

 Shallan50K Spiral Competition.

Shallan50K recently created a competition to reproduce the image below in the least number of bytes.

A few people have asked about the zero page auto run aspect of the program so I thought I'd drop in a paragraph to explain it.

In zero page there is a small routine called CHRGET which is used by the basic interpreter, this routine is located at $73. When basic starts up it uses this routine to read either from the command line or from the basic program. Any program put here will run instead when the machine boots.

The easiest thing to do would be to place the program here and just have it run, unfortunately basic also uses $8b to initialise its random routines which means that if the program is longer that 23 bytes corruption will occur!

To solve this problem the program is loaded into lower memory with the last line of code lined up with $73 so that when basic runs the last line of the program runs instead! The last line of code needs to be a branch command to jump to the beginning of the program. The start location of the code has to move as the code changes to ensure that the branch is always located at $73.

Hope that make sense.

My solution to the problem is below:


Turtles all the way down

(c) AMK Enterprises 2021

All rights reserved 


// for PC

.const directionTableHigh = $0114 // would you believe it this memory block is $00,$00,$ff,$ff

// just what i need for the table! Winner Winner turtle dinner

// for mac

//.const directionTableHigh = $017e // would you believe it this memory block is $00,$00,$ff,$ff

// just what i need for the table! Winner Winner turtle dinner

.const theCount = $16 // HA HA HAR

* = $42


jsr $e544 // kernal cls



xaa #$03



.byte $b5, <stepz__ // lda stepz__,x 

adc theCount // HA HA HAR




move the cursor to the next point



.byte $a5, <cursor // lda cursor

.byte $75, <directionTableLow // adc directionTableLow,x

.byte $85, <cursor // sta cursor

.byte $a5, (<cursor)+1 // lda cursor+1

adc directionTableHigh,x

.byte $85, (<cursor)+1 // sta cursor+1


draw an inverse @


lda #$80 // inverse @ code

sta cursor:$3fe // dirty dirty dirty self mod code


decrease counter





bne !loop-


reduce the length of the line


.byte $c6,<theCount // dec theCount - HA HA HAR


if line length isnt zero do it all again


bne !outerLoop-


stay a while


  stay for ever


beq  *


.byte 16,0,16,0


.byte -1,-40,1,40

* = * "jump"

bne Entry

Setting up Mega65 Connect for LAN

The latest Mega65 Core (0.96) now supports remote access from the  M65Connect using Jtag and now ethernet. This guide will explain how to se...