aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--ABOUT.txt24
-rw-r--r--BUILD.txt12
-rw-r--r--Makefile24
-rw-r--r--about.datbin0 -> 960 bytes
-rw-r--r--autorun.s121
-rw-r--r--autorun.sysbin0 -> 1172 bytes
-rw-r--r--dla.atrbin92176 -> 92176 bytes
-rw-r--r--dla.atr.inbin92176 -> 92176 bytes
-rw-r--r--dla2csv.xexbin11322 -> 11322 bytes
-rw-r--r--text2screen.pl42
11 files changed, 216 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 96955b8..b3057d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,7 @@ bar.*
2
3
4
+?.pl
+?.c
+?.xex
+dla2csv.map
diff --git a/ABOUT.txt b/ABOUT.txt
new file mode 100644
index 0000000..0dd9ff0
--- /dev/null
+++ b/ABOUT.txt
@@ -0,0 +1,24 @@
+Diffusion Limited Aggregation v%V
+
+Diffusion-limited aggregation (DLA)
+is the process whereby particles
+undergoing a random walk due to
+Brownian motion cluster together to
+form aggregates of such particles.
+
+This is a DLA implementation for the
+Atari 8-bit computers. It will run on
+any Atari with at least 48K of RAM.
+
+DLA.XEX generates DLA images. It's
+written in hand-optimized assembly.
+It takes about 3 minutes to generate
+an image with 1000 particles.
+
+DLA2CSV.XEX converts DLA images to
+comma-separated-value files, for
+statistical analysis purposes.
+
+Author: B. Watson, aka Urchlay.
+
+\1:DLA.XEX \2:DLA2CSV.XEX \3:DOS? \
diff --git a/BUILD.txt b/BUILD.txt
index e5d373e..25780c4 100644
--- a/BUILD.txt
+++ b/BUILD.txt
@@ -9,10 +9,11 @@ even be modern Windows), with the following software installed:
recent version should do; I used 2.19.
- Optional: "perl", the Perl 5 interpreter. Only used to generate the
- files dlatbl.s, dlaver.inc, and dlaver.h. These files are part
- of the source distribution, so you only need Perl if you're going
- to modify the data tables (the mkdlatbl.pl script), or change the
- version number (mkver.pl).
+ files dlatbl.s, dlaver.inc, dlaver.h, and (for "make disk"),
+ about.dat. These files are part of the source distribution, so
+ you only need Perl if you're going to modify the data tables (the
+ mkdlatbl.pl script), or change the version number (mkver.pl),
+ or the intro screen in dla.atr (ABOUT.txt).
- Optional: "cc", a host C compiler (e.g. gcc or clang). Only used for
compiling dla2csv for the host.
@@ -25,7 +26,8 @@ You should be able to build everything from a terminal by typing
and (if possible) dla2csv for the host.
If you want a disk image, you can try "make disk", which will create
-dla.atr (if you have axe on your $PATH).
+dla.atr (if you have axe on your $PATH). The disk is MyDOS formatted,
+single density.
Ideally, all the software should be found in your $PATH. If not,
you can set the full paths by defining them on the make command line.
diff --git a/Makefile b/Makefile
index deed51a..427a3b7 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ PERL=perl
CC=cc
CFLAGS=-O2 -Wall
+.PHONY: all disk test disktest realtest tnfs clean distclean
+
all: dla.xex dla2csv dla2csv.xex dla2img.sh
dla.xex: dla.s io.s dlatbl.s xex.inc printint.s render.s drunkwalk.s dlaver.h
@@ -32,17 +34,27 @@ dla2csv: dla2csv.c dlaver.h
# turn off unused parameter warnings because cc65 insists on complaining
# that argc and argv are unused.
+# note that using 0x2d00 for the start address makes the atari crash
+# when exiting dla2csv.xex in MyDOS 4.50, but 0x2800 is fine. 0x2000
+# also works, but not all DOSes have MEMLO set that low...
dla2csv.xex: dla2csv.c dlaver.h
- $(CL65) $(CL65FLAGS) -t atari -W -unused-param -m dla2csv.map -o $@ dla2csv.c
+ $(CL65) $(CL65FLAGS) -t atari -W -unused-param -m dla2csv.map --start-addr 0x2800 -o $@ dla2csv.c
-disk: dla.atr
+autorun.sys: autorun.s about.dat
+ $(CL65) $(CL65FLAGS) -l about.list -t none -o autorun.sys autorun.s
+
+about.dat: text2screen.pl ABOUT.txt
+ perl text2screen.pl < ABOUT.txt > about.dat
# dla.atr.in is just a DOS 2.0s disk image.
-dla.atr: all
+dla.atr: dla.xex dla2csv.xex autorun.sys dla.atr.in
cp dla.atr.in dla.atr
+ axe -w autorun.sys dla.atr
axe -w dla.xex dla.atr
axe -w dla2csv.xex dla.atr
+disk: dla.atr
+
test: all
atari800 dla.xex
@@ -57,13 +69,13 @@ tnfs: all
sh tnfs.sh dla.xex dla2csv.xex dla.atr
clean:
- rm -f dla.xex dla2csv dla2csv.xex dla.list dla.labels *.o dla.atr
+ rm -f dla.xex dla2csv dla2csv.xex autorun.sys dla.list dla.labels *.o dla.atr
distclean: clean
- rm -f dlatbl.s dlaver.inc dlaver.h
+ rm -f dlatbl.s dlaver.inc dlaver.h about.dat
# this rule isn't actually used by the other targets, it's just
# handy for writing little "test.c" programs and being able to
# say "make test.xex".
%.xex: %.c
- $(CL65) $(CL65FLAGS) -t atari -W -unused-param -o $@ $<
+ $(CL65) $(CL65FLAGS) --start-addr 0x2800 -t atari -W -unused-param -o $@ $<
diff --git a/about.dat b/about.dat
new file mode 100644
index 0000000..cc82904
--- /dev/null
+++ b/about.dat
Binary files differ
diff --git a/autorun.s b/autorun.s
new file mode 100644
index 0000000..c7bbac0
--- /dev/null
+++ b/autorun.s
@@ -0,0 +1,121 @@
+ .include "atari.inc"
+ .include "xex.inc"
+
+ .bss
+ .org $80
+
+old_sdlstl: .res 1
+old_sdlsth: .res 1
+old_color2: .res 1
+old_color1: .res 1
+
+ .code
+
+loadaddr = $3000
+
+ xex_org loadaddr
+screendata:
+ .incbin "about.dat"
+
+ .if ((* - screendata) <> 960)
+ .error .sprintf("%c*** about.dat is %d bytes (should be 960)", 10, * - screendata)
+ .endif
+
+dlist:
+ .byte DL_BLK8, DL_BLK8, DL_BLK8
+ .byte DL_CHR40x8x1 | DL_LMS
+ .word screendata
+ .repeat 23
+ .byte DL_CHR40x8x1
+ .endrep
+ .byte DL_JVB
+ .word dlist
+
+main:
+ ; fix things so the Reset key doesn't do a coldstart, see
+ ; BOOT? and COLDST in Mapping.
+ lda #0
+ sta COLDST
+ lda #1
+ sta BOOTQ
+
+ lda SDLSTL
+ sta old_sdlstl
+ lda SDLSTH
+ sta old_sdlsth
+ lda COLOR1
+ sta old_color1
+ lda COLOR2
+ sta old_color2
+
+ lda #$90
+ sta COLOR2
+ lda #$0e
+ sta COLOR1
+ lda #<dlist
+ sta SDLSTL
+ lda #>dlist
+ sta SDLSTH
+
+loop:
+ ldx CH
+ cpx #$ff
+ beq loop
+
+ lda #$ff
+ sta CH
+
+ lda old_sdlstl
+ sta SDLSTL
+ lda old_sdlsth
+ sta SDLSTH
+ lda old_color1
+ sta COLOR1
+ lda old_color2
+ sta COLOR2
+
+ cpx #KEY_1
+ bne not_1
+ ldy #0
+ beq setup_iocb
+
+not_1:
+ cpx #KEY_2
+ bne not_2
+ ldy #1
+ bne setup_iocb
+
+not_2:
+ ; 3, or actually any other key
+ rts
+
+setup_iocb:
+ ldx #$10
+ lda #$28 ; MyDOS XIO 40
+ sta ICCOM,x
+ lda fntab_l,y
+ sta ICBAL,x
+ lda fntab_h,y
+ sta ICBAH,x
+ lda fnlentab,y
+ sta ICBLL,x
+ lda #0
+ sta ICBLH,x
+ jsr CIOV
+
+ ; CIOV should never return on success, so if we get here, give up.
+ lda #0
+ sta COLOR2
+hang: jmp hang
+ rts
+
+dla_filename: .byte "D:DLA.XEX"
+dla_fn_len = * - dla_filename
+csv_filename: .byte "D:DLA2CSV.XEX"
+csv_fn_len = * - csv_filename
+
+fntab_l: .byte <dla_filename, <csv_filename
+fntab_h: .byte >dla_filename, >csv_filename
+fnlentab: .byte dla_fn_len, csv_fn_len
+
+xex_run main
diff --git a/autorun.sys b/autorun.sys
new file mode 100644
index 0000000..b3a58f9
--- /dev/null
+++ b/autorun.sys
Binary files differ
diff --git a/dla.atr b/dla.atr
index ca03087..8eddf3a 100644
--- a/dla.atr
+++ b/dla.atr
Binary files differ
diff --git a/dla.atr.in b/dla.atr.in
index 8016b73..059f95b 100644
--- a/dla.atr.in
+++ b/dla.atr.in
Binary files differ
diff --git a/dla2csv.xex b/dla2csv.xex
index dd5a06f..0d03935 100644
--- a/dla2csv.xex
+++ b/dla2csv.xex
Binary files differ
diff --git a/text2screen.pl b/text2screen.pl
new file mode 100644
index 0000000..7dc2e52
--- /dev/null
+++ b/text2screen.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl -w
+
+# Turn each line of stdin into one 40-byte line of Atari screen codes,
+# truncating or padding with nulls as needed.
+
+# Input format is plain text, except any character can be preceded
+# by a \ to inverse it. No way to get a non-inverse \ in there, sorry.
+# %V will be replaced by the contents of the VERSION file.
+
+use bytes;
+
+$linelen = $1 || 40; # 40 for normal playfield.
+
+chomp($ver = `cat VERSION`);
+
+while(<>) {
+ chomp;
+
+ s/%V/$ver/;
+ s/\\(.)/chr(ord($1)|0x80)/ge;
+
+ if(length > $linelen) {
+ warn "$0: line $. truncated to $linelen characters!\n";
+ substr($_, $linelen) = "";
+ }
+
+ my $blanks = $linelen;
+ for(map { ord } split "", $_) {
+ my $byte = $_ & 0x7f;
+ my $inv = $_ & 0x80;
+#warn sprintf("\$_ %02x, \$byte %02x, \$inv %02x", $_, $byte, $inv);
+ if($byte < 32) {
+ $byte += 64;
+ } elsif($byte >= 32 && $byte <= 96) {
+ $byte -= 32;
+ }
+#warn sprintf("result: %02x", ($byte | $inv));
+ print chr($byte | $inv);
+ $blanks--;
+ }
+ print chr(0) x $blanks;
+}