Commodore 64 Assembly Workshop
A series of workshops were held in LAG to practice assembly programming on the good old Commodore 64. Below you find brief instructions for installing an emulator and crossdevelopment environment, as well as some reference material.
Preparation
Setting up the tools you need, assuming debian.
Vice
Emulator
- apt-get install vice
- cat /usr/share/doc/vice/README.ROMs
- wget -O - ftp://ftp.zimmers.net/pub/cbm/crossplatform/emulators/VICE/old/vice-1.5-roms.tar.gz | tar xz -C /tmp
- sudo rsync -a /tmp/vice-1.5-roms/data/* /usr/lib/vice/
- mkdir \~/.vice
- x64 <programname.prg>
ACME
Assembler
- git clone https://github.com/meonwax/acme
- cd acme/src
- make all
- sudo make install
- acme <source.asm>
Basic program
https://groente.puscii.nl/begin.asm
!to "begin.prg", cbm ; #name of output, type of assembly
!cpu 6510 ; type of cpu
* = $0326 ; set assembler context, where to operate.
!word codeStartAddress
!word $f6ed
; prepare magic.
jmp $800
* = $800
codeStartAddress
sei
lda #$1b
ldx #$09
sta $d011 ; clear the high bit of $d012 and set text mode
stx $d016 ; single color
lda #$7f
ldx #$01
sta $dc0d ; turn off cia 1 interrupts
sta $dd0d ; turn off cia 2 interrupts
stx $d01a ; turn on raster interrupts
lda #<int
ldx #>int
ldy #$c0
sta $fffe ; set our interrupt handler to int
stx $ffff
sty $d012 ; and the rasterline to #240
lda #$35
sta $01
lda $dc0d ; acknowledge cia 1 interrupts
lda $dd0d ; acknowledge cia 2 interrupts
asl $d019 ; enable interrupts
cli
; actual code block.
begin ; label
inc $400 ; increment whatever is at address 400 (hexadecimal) (first character on screen)
inc $401 ; same for the second character on the screen.
jmp begin ; jump to begin.
; more magic.
int
pha
txa
pha
tya
pha
asl $d019
pla
tay
pla
tax
pla
rti
Links
- https://pad.laglab.org/p/c64asm
- http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_5/page_232.html
- http://www.unusedino.de/ec64/technical/aay/c64/bmain.htm
- http://www.classic-games.com/commodore64/64doc.html
- http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_5/page_232.html
- OpCodes: http://6502.org/tutorials/6502opcodes.html
- Mempages: http://sta.c64.org/cbm64mem.html
- characters/petscii: http://sta.c64.org/cbm64pet.html
Tutorials
- http://codebrane.com/blog/2013/10/25/hello-world-in-commodore-64-assembly/
- http://www.c64.ch/programming/
- http://c64.ch/programming/index.php
Examples
- http://www.aartbik.com/MISC/c64.html
- https://www.reddit.com/r/c64/comments/3qleij/programming_assembler_on_the_c64/