Working With PLASMA – Bringing along friends

While playing around with PLASMA and working a some timing routines (more on that later), I found I needed to expand my build chain to be able to include multiple PLASMA modules in to one disk when booting.

I also didn’t like having to specify an environmental variable to set the source file for simple builds. For building a single .pla file and running it, I wanted something easier. This new makefile satisfies both of those requirements.

I did end up moving away from generating the # style files that I think CiderPress wants. Mainly because I’m using AppleCommander to build my disk images. I decided to use .mod (PLASMA “module” was the inspiration) as the intermediary file extension.

makefile

TYPE?=FE
DSKTYPE?=rel
ADDR?=1000
EXTRA?=

.PRECIOUS: %.dsk

clean:
	-rm -f *.a *.mod

%.run: %.dsk
	osascript plasma_run.scpt `pwd` $*

%.dsk: %.mod $(patsubst %,%.mod,$(EXTRA))
	cp template.dsk [email protected]
	java -jar AppleCommander.jar -d [email protected] $*
	java -jar AppleCommander.jar -p [email protected] $* $(DSKTYPE) 0x$(ADDR) < $*.mod
	-if [ ! -z "$(EXTRA)" ]; then \
		for o in "$(EXTRA)"; \
		do \
			java -jar AppleCommander.jar -d [email protected] $$o ;\
			java -jar AppleCommander.jar -p [email protected] $$o $(DSKTYPE) 0x$(ADDR) < $$o.mod ;\
		done ;\
	fi


%.mod: %.a
	acme --setpc 4094 -o [email protected] $?

%.a: %.pla
	plasm -AM < $? > [email protected]

Usage

This can be used in a few different ways. This simplest is to just run make passing in the name of your .pla file with “.pla” replaced with “.dsk” to build the disk image, or “.run” to build the disk image and boot it in Virtual ][.

You can technically even run make and use “.a” and get the .a file out of PLASMA. It’s all generic so any of the intermediaries will work. Use “.mod” to get the compiled binary file, you can then use that with whatever tool you’d want to put it on a disk.

To have it build and include additional PLASMA modules, set the EXTRA environmental variable to the list of the files to include without the .pla extension

Note: Besides the .dsk (which is marked as .PRECIOUS) all intermediaries are removed.

Examples

Make .dsk
% ls -l hello.pla
-rw-r--r--  1 mfinger  staff  65 Apr  8 21:42 hello.pla
% make hello.dsk
plasm -AM < hello.pla > hello.a
acme --setpc 4094 -o hello.mod hello.a
cp template.dsk hello.dsk
java -jar AppleCommander.jar -d hello.dsk hello
hello: No match.
java -jar AppleCommander.jar -p hello.dsk hello rel 0x1000 < hello.mod
if [ ! -z "" ]; then \
		for o in ""; \
		do \
			java -jar AppleCommander.jar -d hello.dsk $o ;\
			java -jar AppleCommander.jar -p hello.dsk $o rel 0x1000 < $o.mod ;\
		done ;\
	fi
rm hello.mod hello.a
% java -jar AppleCommander.jar -ll hello.dsk

/SYSTEM/
  PRODOS  Destroy Read Rename Write SYS  035 09/19/2007 05/06/1993 17,128 $0000 0002 0008 Sapling Changed 0 4
  CMD  Destroy Read Rename Write SYS  010 04/01/2016 04/01/2016 4,141 A=$2000 0002 0029 Sapling Changed 0 0
  HELLO  Destroy Read Rename Write REL  001 04/08/2016 04/08/2016 55 $2000 0002 0037 Seedling Changed 0 0
  PLASMA.SYSTEM  Destroy Read Rename Write SYS  007 04/01/2016 04/01/2016 2,901 A=$2000 0002 002F Sapling Changed 0 0
ProDOS format; 112,640 bytes free; 30,720 bytes used.
Make .run
% make hello.run
plasm -AM < hello.pla > hello.a
acme --setpc 4094 -o hello.mod hello.a
cp template.dsk hello.dsk
java -jar AppleCommander.jar -d hello.dsk hello
hello: No match.
java -jar AppleCommander.jar -p hello.dsk hello rel 0x1000 < hello.mod
if [ ! -z "" ]; then \
		for o in ""; \
		do \
			java -jar AppleCommander.jar -d hello.dsk $o ;\
			java -jar AppleCommander.jar -p hello.dsk $o rel 0x1000 < $o.mod ;\
		done ;\
	fi
osascript plasma_run.scpt `pwd` hello
rm hello.mod hello.a
Including EXTRA
% ls -l timer.pla test.pla
-rw-r--r--  1 mfinger  staff   598 Apr  8 21:32 test.pla
-rw-r--r--  1 mfinger  staff  3710 Apr  8 13:26 timer.pla
% EXTRA=timer make test.dsk
plasm -AM < test.pla > test.a
acme --setpc 4094 -o test.mod test.a
plasm -AM < timer.pla > timer.a
acme --setpc 4094 -o timer.mod timer.a
cp template.dsk test.dsk
java -jar AppleCommander.jar -d test.dsk test
test: No match.
java -jar AppleCommander.jar -p test.dsk test rel 0x1000 < test.mod
if [ ! -z "timer" ]; then \
		for o in "timer"; \
		do \
			java -jar AppleCommander.jar -d test.dsk $o ;\
			java -jar AppleCommander.jar -p test.dsk $o rel 0x1000 < $o.mod ;\
		done ;\
	fi
timer: No match.
rm test.mod test.a timer.mod timer.a
% java -jar AppleCommander.jar -ll test.dsk

/SYSTEM/
  PRODOS  Destroy Read Rename Write SYS  035 09/19/2007 05/06/1993 17,128 $0000 0002 0008 Sapling Changed 0 4
  CMD  Destroy Read Rename Write SYS  010 04/01/2016 04/01/2016 4,141 A=$2000 0002 0029 Sapling Changed 0 0
  TEST  Destroy Read Rename Write REL  001 04/08/2016 04/08/2016 423 $2000 0002 0037 Seedling Changed 0 0
  TIMER  Destroy Read Rename Write REL  003 04/08/2016 04/08/2016 927 $2000 0002 0039 Sapling Changed 0 0
  PLASMA.SYSTEM  Destroy Read Rename Write SYS  007 04/01/2016 04/01/2016 2,901 A=$2000 0002 002F Sapling Changed 0 0
ProDOS format; 111,104 bytes free; 32,256 bytes used.

Demo

Here is a video showing it using the “.dsk” and “.run” versions:

Leave a Reply

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