aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt68
-rw-r--r--dla.s10
2 files changed, 51 insertions, 27 deletions
diff --git a/README.txt b/README.txt
index e830ab2..7bae9a2 100644
--- a/README.txt
+++ b/README.txt
@@ -32,43 +32,67 @@ e.g. in an emulator or with an SIO2PC cable on real hardware.
At startup, you're asked "How many particles?". The more particles you
enter here, the longer it will take to generate the image. The default
-(if you just press Return) is 1000, which generally takes 13 to 14
+(if you just press Return) is 1000, which generally takes 7 to 9
minutes. For a quick test just to see what the result will look like,
-try 300, which should take 1 to 2 minutes. The maximum is 65535, which
-takes around 30 minutes to run... but more than about 2000 is too much
-anyway: The result starts to have a "ring" around it, which means it
-outgrew the limited size of the Atari screen.
+try 300, which should take less than a minute. The maximum is 65535,
+which takes around 18 minutes to run... but more than about 2000 is
+too much anyway: The result starts to have a "ring" around it, which
+means it outgrew the limited size of the Atari screen.
-After you enter the number of particles, the screen will clear and
-go solid black, while the image is generated. The ANTIC chip's DMA is
-disabled, to speed things up. However, you can "peek" at the progress
-of the generator by holding down the Start key. This will show the
-work in progress, but it will slow things down noticeably.
+After you enter the number of particles, you'll be asked for the "Seed
+type". The default is the standard DLA seed: a single pixel in the
+center of the screen. Other seeds generate different types of image;
+try them all.
-Notes
------
+After you enter the seed type, the screen will clear and go solid
+black, while the image is generated. The ANTIC chip's DMA is disabled,
+to speed things up. However, you can "peek" at the progress of the
+generator by holding down the Start key. This will show the work in
+progress, but it will slow things down noticeably.
+
+After the image is finished generating, the screen DMA will be turned
+back on, so you can see it. The bottom line shows a menu, from which you
+can choose to:
+
+- Save: Save the image to disk, with the (hard-coded) filename D:DLA.IMG.
+ The file will be the raw pixels, 8 per byte, 256 pixels (32 bytes) per
+ line.
+
+- Redo: Run the generation process again, with the current particle count
+ and seed type settings.
+
+- New: Start the program over, so you can enter different settings.
+
+The only way to exit the program (for now) is to press Reset or power
+cycle the Atari.
+
+Algorithm
+---------
The algorithm works like this:
-1. Each particle starts on the edge of a circle whose center is the
+1. The initial "seed" pixels are drawn.
+
+2. Each particle starts on the edge of a circle whose center is the
center of the screen. The circle's radius depends on the number of
particles that have been rendered so far: radius is 15 for particles 1
to 100, 30 for particles 101 to 300, 45 for particles 301 to 600, and
75 for particles 601 and up.
-2. Walk the particle around randomly. For each step, pick a random one
+3. Walk the particle around randomly. For each step, pick a random one
of the 4 cardinal directions (no diagonals).
-3. If the particle goes "out of bounds" (see below), respawn it and
+4. If the particle goes "out of bounds" (see below), respawn it and
try again (without incrementing the particle counter).
-4. If the particle is ever adjacent to a set pixel, it gets stuck
-there, the particle counter is incremented, and we go back to step 1.
+5. If the particle is ever adjacent to a set pixel, it gets stuck
+there, the particle counter is incremented, and we go back to step 2.
When the particle counter reaches the max (the number the user
-entered), the process is complete, and DMA is enabled so you can see
-the result. TODO: at some point, there will be a way to save the image
-and/or generate a new image. For now, all you can do is look.
+entered), the process is complete.
+
+Notes
+-----
It should be possible to optimize this a bit further, maybe shave
another 5% to 10% off the run time.
@@ -93,8 +117,8 @@ mode, so the X resolution is 256... meaning I don't need two bytes
for the X cursor position (which saves a good bit of time). The code
that plots pixels doesn't use CIO to do so (it writes directly to the
screen memory), which also saves time. There's no floating point math
-here: if there were, the asm version wouldn't be all that much faster
-than the BASIC one...
+in the generation process: if there were, the asm version wouldn't be
+all that much faster than the BASIC one...
Author
------
diff --git a/dla.s b/dla.s
index 5b069b7..7106a0a 100644
--- a/dla.s
+++ b/dla.s
@@ -22,7 +22,6 @@
DMA_ON = $21
DEFAULTPART = 1000
maxparticles = $80 ; 2 bytes
- addtmp = $82
pixptr = $82
pixmask = $84
cursor_x = $85 ; cursor x/y are args to plot/unplot/locate
@@ -245,8 +244,9 @@ menuloop:
dex
bpl menuloop
-; calculate and print elapsed time in minutes. our only use of
-; the floating point ROM routines.
+; calculate and print elapsed time in minutes.
+; uses the floating point ROM routines, because it's easier to code
+; this way and we don't need speed here.
ldx #0
stx FR0
inx
@@ -374,9 +374,9 @@ saveimage:
sta ICBAL,x
lda #>screen
sta ICBAH,x
- lda #<(maxlines * linelen)
+ lda #<screenbytes
sta ICBLL,x
- lda #>(maxlines * linelen)
+ lda #>screenbytes
sta ICBLH,x
jsr CIOV