diff options
author | B. Watson <urchlay@slackware.uk> | 2022-11-13 17:18:21 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2022-11-13 17:18:21 -0500 |
commit | 9a2f5f4c83201c193dd1029aeca04cff44574e60 (patch) | |
tree | e6b03cda03af2bf30eb5a752992308659489b024 | |
parent | e571754b3e912aec7338cbb73ca208c4595f4a24 (diff) | |
download | dla-asm-9a2f5f4c83201c193dd1029aeca04cff44574e60.tar.gz |
v0.3.0: save files are now 176x170.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.txt | 6 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | dla.s | 53 | ||||
-rw-r--r-- | dla.xex | bin | 4696 -> 4696 bytes | |||
-rw-r--r-- | dla2csv.c | 19 | ||||
-rw-r--r-- | dla2csv.xex | bin | 11297 -> 11338 bytes | |||
-rwxr-xr-x | dla2img.sh | 6 | ||||
-rw-r--r-- | dlaver.h | 2 | ||||
-rw-r--r-- | dlaver.inc | 2 |
10 files changed, 70 insertions, 22 deletions
@@ -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" @@ -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 @@ -1 +1 @@ -0.2.1 +0.3.0 @@ -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 Binary files differ@@ -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 Binary files differindex 7bf1527..4809291 100644 --- a/dla2csv.xex +++ b/dla2csv.xex @@ -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" @@ -1 +1 @@ -#define VERSION "0.2.1" +#define VERSION "0.3.0" @@ -1 +1 @@ - .define VERSION "0.2.1" + .define VERSION "0.3.0" |