Tag Archives: machinecode

Raster line with open borders to draw a flag

A fun experiment using opening the C64 border and changing colors on certain rasterlines.

Screenshot (only a little artefact on the lefthand side)

Code (acme)

acme borderflag.asm
x64 +drive8truedrive borderflag.prg

!cpu 650rasterline
!to "borderflag.prg",cbm

* = $0801
    !byte $0d,$08,$dc,$07,$9e,$20,$34
    !byte $39,$31,$35,$32,$00,$00,$00

* = $c000
        sei                     ; turn off interrupts

        ldx #1                  ; enable raster interrupts
        stx $d01a

        lda #<irq       	; set raster interrupt vector
        ldx #>irq
        sta $0314
        stx $0315

        ldy #$f0                ; set first interrupt rasterline
        sty $d012
        lda $d011               ; reset rasterline hi bit
        and #%01111111
        sta $d011

        asl $d019               ; ack VIC interrupts

        jmp loop_until_doomsday

	asl $d019       	; ack irq

	lda #$01		; set screenframe and background
	sta $d020
	lda #$02
	sta $d021

	lda #$38        	; wait for line $38
	cmp $d012       	
	bne *-3

	lda #$02		; set screenframe and background
	sta $d020
	lda #$01
	sta $d021

	lda #$f9        	; wait for line $f9C
	cmp $d012       	; just below border in 25 row mode
	bne *-3

	lda $d011       	; switch to 24 row mode ($d011 bit 3 = 0)
	and #$f7        	; %11110111
	sta $d011

	lda #$fd        	; wait for line $fd
	cmp $d012       	; just below border in 25 row mode
	bne *-3

	lda $d011       	; switch back to 25 row mode ($d011 bit 3 = 1)
	ora #$08        	; %00001000
	sta $d011

	jmp $ea31		; exit irq

C64 Multipart Loader

Today I tested part loading for a demo.

I wanted this to be a multipart loader, instead of a trackloader.
A trackloader can load sector parts which I would like more.
But the C64Pico can’t do disk images. (Mcume)

C64Pico based on MCUME see building of this in other posts.

2nd reason: While I’ve written a track loader for 8086, I never did it for C64. As a kid I didn’t have a C64, so all knowledge I have is from later years.
I’ve written only a few C64 machinecode programs.

See below explanation of what happens
  • Showing makefile
  • Showing first part assembly (without text Hello 2nd part)
  • Showing second part (no sysheader) needs to be loaded at $2000
  • Compile using Acme
  • make disk image
  • and run using autostart x64 (Vice emulator)

You see the first text from the 1st assemby code, then it will load the second at $2000 and does a jmp to this address.
Second text will but displayed.

While i’ve been using KickAss in the past and some other 6502 compilers, I manly use acme.

Makefile I created to compile, create a C64 diskimage and run the program is as below. (No exomizer tools in this Makefile)

all: acme disk run

	acme testloader.asm
	acme 2ndpart.asm

	c1541 -format diskname,id d64 my_diskimage.d64 -attach my_diskimage.d64 -write loader.prg loader.prg -write 2nd 2nd

	x64 my_diskimage.d64 

Compilers (mainly machinecode)

A compiler is a program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer.

Below are some machinecode compilers i’ve used.


Masm – Used this in Msdos
Need linker (link), can use macro’s
Most of my old stuff was written using masm

Tasm – Used this in Msdos
Need linker (tlink)
Some of my old stuff was written using Tasm (our boot demo was)

Fasm – Used this to compile for 8086/8088 under linux
Does not need linker, Open Source, Fast!, Written in fasm

Nasm – Used this for some machinecode under linux
Cross platform, can use Macro’s, Open Source

FOR 65xx

Acme – Multi-platform cross assembler for 6502/6510/65816 CPU
Used for my DIY 6502

CC65 – cc65 – complete cross development package for 65(C)02 systems
Used for my DIY 6502

Kickassembler – Java but works okay

Other compilers are for example the Arduino IDE or PlatformIO, which comes with AVR compilers. (Mostly C based)


Seka – assembler

And a really old skool one i’ve used : PL/M-86 Compiler

I’m not sure i’ve used compilers for 8085/680x