C64Studio for building more complex projects for Commodore build targets
C64Studio is a .NET based IDE which has some nice macros and dependency linking to connect your BASIC and Assembly files together automatically. Using it with Commodore 128 BASIC and linking the Assembly in add a few extra challenges.
Starting with a template
Sample Project 14 – BASIC and Assembly has most of the settings you need to get going. The keys to this setup
The compile target for the BASIC program needs to have the Assembly file checked as “Dependant” and “Symbols” and that D64 should be the output:
Set up a “Post Build” step on the BASIC file to add the Assembly target to the D64 image
$(MediaManager) -d64 "$(BuildTargetFilename)" -import asmloop.prg -renameto "ASMLOOP.PRG". The
.asm extension of the file should be changed to
.prg for the post build command.
Right-click your main BASIC source file and make it the Active Element
Linking source itself
C64Studio will expose label references in dependencies in BASIC, so for the following Assembly,
LOBYTE are all available (I haven’t tried
.nocarry, but they are intended to be “local labels”)
;startup address * = $0c00 ;create BASIC startup ASMSTART ldx #$00 ldy #$00 lda #$00 sta $a0 sta $a1 sta $a2 sta LOBYTE sta LOBYTE lda #$60 .loop inx bne .nocarry iny bne .nocarry inc HIBYTE .nocarry cmp $a2 bcs .loop stx LOBYTE sty MIDBYTE rts HIBYTE !byte $00 MIDBYTE !byte $00 LOBYTE !byte $00
In the BASIC file these symbols can be used within curly braces:
Make sure to use curly braces and select the proper BASIC for your target Commodore. Since I’m targeting Commodore 128, I’ve selected BASIC V7.0. Basic keywords are compiled to two-byte codes, dependent on the version, so if you select the wrong one, some keywords may be treated as variables or use the wrong keyword code and you’ll get bizarre errors. (I initially got “Compile Errors” on my BASIC with no error message and then “Type Mismatch” on my “compiled” BASIC file.)
Compile and Run
You should be able to click “Compile and Run” now if you’ve set up your emulator in the IDE to point at an installed emulator (VICE GTK has been working for me).