-
Notifications
You must be signed in to change notification settings - Fork 1
Home
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.
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.
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.
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).
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 following 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 below "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.
To be on the safe side, here is the full "hello world" code in "main.asm", so that nothing can go wrong:
!source "MHLAB Internal\MHLAB Internal.asm"
*=$0801
!byte $0B,$08,$0A,$00,$9E,$32,$30,$36,$31,$00,$00,$00
+PRINTABSS s_hello_world
rts
s_hello_world:
!pet "hello world",0
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!