Skip to content
puregorill edited this page May 21, 2023 · 67 revisions

Welcome to the MACRO-HLA-BASIC wiki!

Let's start with the usual "hello world" code. I will explain the whole process using C64Studio, because that is what I use. I will provide a step-by-step guide.

1. Quick guide

If you are an experienced user of the C64Studio in combination with the VICE emulator, then use this quick guide. Otherwise, choose the more detailed step-by-step guide.
However, even for experienced users it is worth taking a look at the detailed instructions. Some C64Studio settings may still be unfamiliar.

Quick Step 1: Download MACRO HLA BASIC

Download the folder "MACRO HLA BASIC" from github. It is best to download the entire repository.
In the future there may also be a "release", then of course you better download this one.
After downloading, I recommend keeping the folder safe and making a copy of it and renaming it to your project.

Quick Step 2: Load "Solution" with C64 Studio

Open C64Studio.
In "File -> Open -> Solution or Project" open the file "MACRO HLA BASIC.s64" from the "MACRO HLA BASIC" folder (or the folder with the name you chose when renaming in the previous step).

Quick Step 3: Code our actual "hello world" program

After loading, it should have "main.asm" open. This is the place where you will write your MACRO HLA BASIC code.
Now comes the easy part.

In the file "main.asm" write your program code between the line beginning with !byte" (this is a C64 basic stub) and the "rts".
Write the command "+PRINTABSS s_hello_world" (the "+" is obligatory and indicates that it is a macro).

We have not yet defined the string "s_hello_world" that we want to output on the screen. A print command with an immediately following string in inverted commas does not exist in MACRO HLA BASIC.

So write the following under the "rts":
s_hello_world:
!pet "hello world",0

The "0" is important, it is the 0-terminator of the string. If you forget it, the C64 may print rubbish beyond the intended string.

Quick Step 4: Start the program and enjoy

Click "Build -> Build and Run". VICE should open and your program should start.
List it, then you will see the Basic stub starting with "SYS". Have fun!

2. Detailed step-by-step guide

Step 1: Download and install the C64Studio

Download and install the C64Studio release. You may also need .NET from Microsoft.
To what extent C64Studio will work under Mono for Linux is beyond me.

Step 2: Download VICE Emulator and integrate it in C64Studio

Download VICE Emulator and unzip it.
Click on "File -> Setup Wizard" in C64Studio.
Locate a file called "x64sc.exe" in your VICE folder (it could also just be called x64.exe).
You can usually find the file in newer GTK versions of VICE in the "bin" folder (if not just search for it) and specify it as a path using the "..." button located to the right of the emulator path field.
Done, simple as that. The emulator should now be integrated in C64Studio.

Step 3: Further recommended settings in C64Studio

Since MACRO HLA BASIC uses segment overlaps for its structure macros, I strongly recommend disabling the corresponding error message in C64.
This could otherwise become very annoying.
Click "File -> Preferences" and look for the tab "Assembler". In this tab, activate the entry "W0001: Segment overlaps" in the category "Ignore Warnings" at the top right.
Make sure that "W0001" is deactivated (in opposite to above which should be activated) in the category "Treat Warnings as Errors" just below it.