I downloaded "CBM prg Studio" by Arthur Jordison. I'm not tough enough to bear with the Commodore 64 editor mode, it's lovely but too quirky. Also CBM prg studio being an external IDE allows me to have all the source at a glance, shows several useful tools that surely will be handy and has the features that are needed by an ASM ide: labels, macros and automatic build.
Programming with the IDE is a breeze and you can also use it to program in basic. The tutorial shows you how to run an assembler program by using a basic code loader (the IDE generates it using one of its tools), but you can also ask the IDE to provide you with a "SYS" style execution code.
; Exercise 1.1
*=$0820
LDA #$01
STA $0400
STA $D800
RTS
; 10 SYS 2080
*=$0801
BYTE $0E, $08, $0A, $00, $9E, $20, $32, $30, $38, $30, $00, $00, $00
This source code create a tiny self contained C64 program that prints a white A on the top left of the screen. It's the first exercise you find in Hayden's "Commodore 64 Assembly Language Programming". Note that I decided to locate the program in memory location $0820, just a couple of bytes after the space reserved for the basic SYS statement. Before I tried to use *=C000 as a start location for for the executable, but apparently it's a bad idea since the generated program will be so large that the emulator will waste time loading it.The following instead is still a basic exercise, and it will print a white X on each of the four screen corners.
; Exercise 1.3
*=$0820
LDA #$18
STA $0400
STA $0427
STA $07C0
STA $07E7
LDX #$01
STX $D800
STX $D827
STX $DBC0
STX $DBE7
RTS
; 10 SYS 2080
*=$0801
BYTE $0E, $08, $0A, $00, $9E, $20, $32, $30, $38, $30, $00, $00, $00
No comments:
Post a Comment