aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--README.txt6
-rw-r--r--VERSION2
-rw-r--r--dla.s53
-rw-r--r--dla.xexbin4696 -> 4696 bytes
-rw-r--r--dla2csv.c19
-rw-r--r--dla2csv.xexbin11297 -> 11338 bytes
-rwxr-xr-xdla2img.sh6
-rw-r--r--dlaver.h2
-rw-r--r--dlaver.inc2
10 files changed, 70 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index ef1876a..fdede2c 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ dlatbl.s: mkdlatbl.pl
dlaver.h: mkver.pl VERSION
$(PERL) mkver.pl
-dla2csv: dla2csv.c
+dla2csv: dla2csv.c dlaver.h
@echo $(CC) $(CFLAGS) -o dla2csv dla2csv.c ; \
$(CC) $(CFLAGS) -o dla2csv dla2csv.c \
|| echo "Couldn't build host dla2csv; continuing without it"
diff --git a/README.txt b/README.txt
index 75af7f1..a7a744e 100644
--- a/README.txt
+++ b/README.txt
@@ -71,8 +71,8 @@ The bottom line shows a menu, from which you can choose to:
- Save: Save the image to disk. You'll be prompted for a filename.
If you don't include a drive spec (e.g. D: or D2:), drive 1 (D:)
is assumed. Emulator users can use the H: drive here.
- The file will contain the raw pixels, 8 per byte, 256 pixels (32
- bytes) per line, 170 lines. Size will be 5440 bytes, or 44 sectors
+ The file will contain the raw pixels, 8 per byte, 176 pixels (22
+ bytes) per line, 170 lines. Size will be 3740 bytes, or 30 sectors
on a single-density disk. If an error happens while saving, you'll
get the chance to retry the save.
@@ -102,7 +102,7 @@ Next, you're asked for the output filename[*]. This file will be
overwritten if it exists (unless of course it can't be overwritten due
to permissions or the Atari locked-file bit).
-Next, the conversion process starts. This takes about one minute on
+Next, the conversion process starts. This takes about half a minute on
the Atari, and is instantaneous on a modern machine. Progress is shown
as a percentage. When it's finished, the output CSV file has been
written. On the Atari, you can press Ctrl-C during the conversion to
diff --git a/VERSION b/VERSION
index 0c62199..0d91a54 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.1
+0.3.0
diff --git a/dla.s b/dla.s
index 5126b50..f08084f 100644
--- a/dla.s
+++ b/dla.s
@@ -16,6 +16,7 @@
lowcode = $0600 ; memcheck and io.s
screen = $4000 ; must be on a x000 (4K) boundary
screen2 = screen + $1000 ; rest of screen RAM after 4K boundary
+ savebuf = screen + $6000 ; prepare_output
pixarray = screen + $20
linelen = $20 ; aka 32 bytes, antic F (GR.8) in narrow mode.
maxlines = $aa ; 170 lines of display
@@ -52,6 +53,7 @@ old_savmsc: .res 2
cloksav: .res 3 ; hold RTCLOK here while we convert to MM:SS.CC
fptmp: .res 6 ; used in mmss.s
+po_line = fptmp ; used by prepare_output
.code
@@ -312,10 +314,10 @@ saveimage:
; prepend D: to the filename, if there's no device given.
lda linebuf+1
cmp #':'
- beq open_output
+ beq prepare_output
lda linebuf+2
cmp #':'
- beq open_output
+ beq prepare_output
ldy ICBLL
dloop:
@@ -332,6 +334,45 @@ dloop:
inc ICBLL
inc ICBLL
+ ; DLA pixel size is 170x170, screen memory is 256x170. only save
+ ; the middle 22 bytes (176 pixels) of each line. Really only need
+ ; 170 pixels, but of course we can't save a partial byte...
+prepare_output:
+ lda #<screen
+ sta screenptr
+ lda #>screen
+ sta screenptr+1
+ lda #<savebuf
+ sta pixptr
+ lda #>savebuf
+ sta pixptr+1
+ lda #0
+ sta po_line
+polineloop:
+ ldy #5
+ ldx #0
+poloop:
+ lda (screenptr),y
+ sta (pixptr,x)
+ inc pixptr
+ bne ppok
+ inc pixptr+1
+ppok:
+ iny
+ cpy #$1b
+ bne poloop
+ lda screenptr
+ clc
+ adc #$20
+ sta screenptr
+ lda screenptr+1
+ adc #0
+ sta screenptr+1
+ inc po_line
+ ldx po_line
+ cpx #maxlines
+ bne polineloop
+
open_output:
; CIO is nice, but it's kind of a PITA to use...
; OPEN #1,8,0,<filename>
@@ -359,13 +400,13 @@ open_output:
ldx #$10
lda #$0b ; write binary record
sta ICCOM,x
- lda #<screen
+ lda #<savebuf
sta ICBAL,x
- lda #>screen
+ lda #>savebuf
sta ICBAH,x
- lda #<screenbytes
+ lda #<(maxlines*22)
sta ICBLL,x
- lda #>screenbytes
+ lda #>(maxlines*22)
sta ICBLH,x
jsr CIOV
cpy #1
diff --git a/dla.xex b/dla.xex
index b4bf550..d6b762b 100644
--- a/dla.xex
+++ b/dla.xex
Binary files differ
diff --git a/dla2csv.c b/dla2csv.c
index b66b0a4..5d9c083 100644
--- a/dla2csv.c
+++ b/dla2csv.c
@@ -19,12 +19,12 @@
#include "dlaver.h"
#define HEIGHT 170
-#define WIDTH 256
+#define WIDTH 176
/* cc65 doesn't fold constants, it won't let us do this:
#define INBUF_SIZE (WIDTH * HEIGHT)
...it has to be a *constant*. */
-#define INBUF_SIZE 5440
+#define INBUF_SIZE 3740
#define STRINGBUF_SIZE 256
@@ -319,15 +319,16 @@ int check_dla(int bytes) {
}
fclose(inf);
- /* a DLA file never has non-zero bytes at the beginning. */
- for(i = 0; i < 32; i++) {
- if(inbuf[i]) {
+ /* a DLA file never has non-zero pixels in the first 3 columns */
+ for(i = 0; i < INBUF_SIZE; i += (WIDTH / 8)) {
+ if(inbuf[i] & 0xe0) {
printf("Warning: File doesn't look like a DLA!\n");
ok = 0;
break;
}
}
+
return ok;
}
@@ -377,7 +378,7 @@ int convert(char *eol) {
for(y = 0; y < HEIGHT; y++) {
#ifdef __ATARI__
/* check for ^C */
- if(OS.ch == KEY_C | KEY_CTRL) {
+ if(OS.ch == (KEY_C | KEY_CTRL)) {
printf("\nUser abort!\n");
fclose(outf);
remove(stringbuf);
@@ -389,6 +390,12 @@ int convert(char *eol) {
printf("%02d%%", y * 100 / HEIGHT); /* percentage */
fflush(stdout);
for(x = 0; x < WIDTH; x++) {
+ /* slight optimization, saves ~12 sec (30% speedup) on Atari */
+ if(!*inp) {
+ inp++;
+ x += 7;
+ continue;
+ }
if(*inp & xmask) {
if(fprintf(outf, "%d,%d%s", x, y, eol) < 0) {
putchar('\n');
diff --git a/dla2csv.xex b/dla2csv.xex
index 7bf1527..4809291 100644
--- a/dla2csv.xex
+++ b/dla2csv.xex
Binary files differ
diff --git a/dla2img.sh b/dla2img.sh
index 808f688..637ee7f 100755
--- a/dla2img.sh
+++ b/dla2img.sh
@@ -16,7 +16,7 @@
SELF="`basename $0`"
# This line may get changed by the Makefile (do not hand-edit):
-VERSION=0.2.1
+VERSION=0.3.0
# allow overriding magick path via environment.
if [ "$MAGICK" = "" ]; then
@@ -24,10 +24,10 @@ if [ "$MAGICK" = "" ]; then
fi
# only change this if the save file size changes in dla.xex.
-SIZE="256x170"
+SIZE="176x170"
# ...and if you change that, change this too:
-FILESIZE="5440"
+FILESIZE="3740"
INFILE="$1"
OUTFILE="$2"
diff --git a/dlaver.h b/dlaver.h
index cb1ae9a..b3a9dfe 100644
--- a/dlaver.h
+++ b/dlaver.h
@@ -1 +1 @@
-#define VERSION "0.2.1"
+#define VERSION "0.3.0"
diff --git a/dlaver.inc b/dlaver.inc
index 7f669e7..44f0d63 100644
--- a/dlaver.inc
+++ b/dlaver.inc
@@ -1 +1 @@
- .define VERSION "0.2.1"
+ .define VERSION "0.3.0"