Working With PLASMA

I decided as part of my efforts to get back into programming on my Apple ][‘s that I’d also explore other newer technologies that are available on the development side.

Thanks to a recent issue of Juiced.GS (Vol 21, Issue 1), I thought I’d try out PLASMA (Proto Language AsSeMbler for Apple) from Davis Schmenk. It (like it says) is a proto-assembly language that has a lot of features of modern language normally not available in assembly.  I’ve not dug into the language much beyond reading the article (“Programming with PLASMA: Developing a chat client”) in Juiced.GS and reading through some of the sample code, but it does look very interesting.

But, thanks to the great work on the Xcode build pipeline for C[AC]65 that I mentioned in an early post, I’m spoiled in having a quick build pipeline.  Write code, click build, watch it run.  So, I figured by “standing on the shoulders of giants” I’d put together a proof of concept way to do something similar with PLASMA.

Requirements are simple:  Write code, run a build, watch it run.

Digging into the work Quinn Dunki posted about here, I took  the Applescript code and the makefile and adapted it to work for what I needed.  I did it outside of Xcode for this case for a couple of reasons.  First is that Xcode won’t really understand PLASMA code in a way that is beneficial (no completion or highlighting) and second is that I don’t really like Xcode very much.  So, vi and make it is.  Makes me all nostalgic.

Here is my adapted Applescript code (Really only changed a – to a +):

-- Stolen/Adapted from: Blondihacks Makefile script for Virtual ][ (
-- Boots the disk image for the program and runs it inside PLASMA

on run argv
	set TARGETPATH to item 1 of argv
	set PGM to item 2 of argv

	tell application "Virtual ]["

		tell front machine
			eject device "S6D1"
			insert TARGETPATH & "/" & PGM & ".dsk" into device "S6D1"
			delay 0.5
			delay 0.5
			type line "+" & PGM
		end tell
	end tell
end run

Here is my makefile:

PGM?=$(shell basename $(SRC) .pla)



all: disk

run: disk
	osascript plasma_run.scpt `pwd` $(PGM)

disk: $(PGM).dsk

	-rm -f $(OBJ) $(PGM).a $(PGM).dsk

	-rm -f *.a *\#*

$(PGM).dsk: $(OBJ)
	cp template.dsk $(PGM).dsk
	java -jar AppleCommander.jar -d $(PGM).dsk $(PGM)
	java -jar AppleCommander.jar -p $(PGM).dsk $(PGM) $(DSKTYPE) 0x$(ADDR) < $(OBJ)

%\#$(TYPE)$(ADDR): %.a
	acme --setpc 4094 -o [email protected] $?

$(PGM).a: $(SRC)
	$(PLASM) -AM < $? > [email protected]

Again, this may be too limited at the moment as I don’t have a deep understanding of PLASMA and project structure, linking, etc.  But, for this case simply set the SRC environmental variable to point to your plasma code and run make.

Here is an example (Note: I’ve tweaked the makefile a bit since the video):

Now it’s time to start writing some of my own code and experiment with the language.

Leave a Reply

Your email address will not be published. Required fields are marked *