diff -Naur sz81-2.1.7-orig/common.c sz81-2.1.7/common.c --- sz81-2.1.7-orig/common.c 2011-02-11 18:44:41.000000000 +0100 +++ sz81-2.1.7/common.c 2012-06-15 19:39:20.000000000 +0200 @@ -20,7 +20,7 @@ * common.c - various routines/vars common to z81/xz81/sz81. */ -#define Z81_VER "2.1" +#define Z81_VER "2.2" #include @@ -67,6 +67,7 @@ int interrupted=0; int nmigen=0,hsyncgen=0,vsync=0; int scrn_freq=2; +int scrn_scale=SCALE; int unexpanded=0; int taguladisp=0; int fakedispx=0,fakedispy=0; /* set by main.c/xmain.c */ @@ -137,7 +138,6 @@ { static char buf[1024]; -#define LIBDIR "" if(strlen(LIBDIR)+strlen(file)+2>sizeof(buf)) strcpy(buf,file); /* we know file is a short constant */ else @@ -1058,9 +1058,9 @@ void usage_help(char *cmd) { printf("z81 " Z81_VER - " - copyright (C) 1994-2004 Ian Collier and Russell Marks.\n\n"); + " - copyright (C) 1994-2012 Ian Collier and Russell Marks.\n\n"); printf("usage: %s [-hilLosSTuV] [-a sound_addon_type] [-p printout.pbm]\n" - "\t\t[-r refresh_rate] [filename.p]\n", + "\t\t[-r refresh_rate] [-R screen_scale] [filename.p]\n", cmd); puts("\n" " -a emulate AY-chip-based sound addon chip, with\n" @@ -1080,6 +1080,7 @@ " -p emulate ZX Printer, with PBM output in specified file.\n" " (Most picture viewers/converters can handle PBM files.)\n" " -r set how often the screen is redrawn in 1/50ths of a second.\n" +" -R set screen scaling factor (1-4, 2 by default).\n" " -s emulate VSYNC-based sound support (the usual kind).\n" " -S disable SAVE hook. Useful if you want to hear what SAVE\n" " does when sound is enabled. :-) Use `-V' to see it too.\n" @@ -1107,7 +1108,7 @@ opterr=0; do - switch(getopt(argc,argv,"a:hilLop:r:sSTuV")) + switch(getopt(argc,argv,"a:hilLop:r:R:sSTuV")) { #ifdef OSS_SOUND_SUPPORT /* Thunor: this was missing */ case 'a': @@ -1152,6 +1153,11 @@ if(scrn_freq<1) scrn_freq=1; if(scrn_freq>50) scrn_freq=50; break; + case 'R': /* rescale */ + scrn_scale=atoi(optarg); + if(scrn_scale<1) scrn_scale=SCALE; + if(scrn_scale>MAX_SCALE) scrn_scale=MAX_SCALE; + break; #ifdef OSS_SOUND_SUPPORT /* Thunor: this was missing */ case 's': /* sound (!) - specifically, VSYNC-based sound */ sound=1; @@ -1186,6 +1192,10 @@ fprintf(stderr,"z81: " "the -r option needs a refresh rate as argument.\n"); break; + case 'R': + fprintf(stderr,"z81: " + "the -R option needs a screnn scale as argument.\n"); + break; default: fprintf(stderr,"z81: option `%c' not recognised.\n",optopt); } diff -Naur sz81-2.1.7-orig/common.h sz81-2.1.7/common.h --- sz81-2.1.7-orig/common.h 2011-01-14 17:07:49.000000000 +0100 +++ sz81-2.1.7/common.h 2012-06-07 17:56:47.000000000 +0200 @@ -77,6 +77,7 @@ extern int taguladisp; extern int autoload; extern int scrn_freq; +extern int scrn_scale; extern int fakedispx,fakedispy; extern int refresh_screen; diff -Naur sz81-2.1.7-orig/Makefile sz81-2.1.7/Makefile --- sz81-2.1.7-orig/Makefile 2011-02-12 23:28:52.000000000 +0100 +++ sz81-2.1.7/Makefile 2012-06-01 17:28:52.000000000 +0200 @@ -1,9 +1,9 @@ # Comment/uncomment these to choose an installation destination # System wide installation -#PREFIX?=/usr/local -#BINDIR?=$(PREFIX)/bin -#DOCDIR?=$(PREFIX)/share/doc/$(TARGET) -#PACKAGE_DATA_DIR?=$(PREFIX)/share/$(TARGET) +PREFIX?=/usr/local +BINDIR?=$(PREFIX)/bin +DOCDIR?=$(PREFIX)/share/doc/$(TARGET) +PACKAGE_DATA_DIR?=$(PREFIX)/share/$(TARGET) # Local installation within your home folder #PREFIX?=$(HOME)/Games/$(TARGET) @@ -12,10 +12,10 @@ #PACKAGE_DATA_DIR?=$(PREFIX)/data # Run from current folder i.e. no installation -PREFIX?=. -BINDIR?=$(PREFIX) -DOCDIR?=$(PREFIX) -PACKAGE_DATA_DIR?=$(PREFIX)/data +#PREFIX?=. +#BINDIR?=$(PREFIX) +#DOCDIR?=$(PREFIX) +#PACKAGE_DATA_DIR?=$(PREFIX)/data # For sz81 OSS_SOUND_SUPPORT is now synonymous with SDL_SOUND_SUPPORT. # Comment this out if you don't want sound support. diff -Naur sz81-2.1.7-orig/Makefile.z81 sz81-2.1.7/Makefile.z81 --- sz81-2.1.7-orig/Makefile.z81 2010-03-09 14:40:26.000000000 +0100 +++ sz81-2.1.7/Makefile.z81 2012-06-15 19:27:20.000000000 +0200 @@ -9,10 +9,11 @@ # to use SCALE=1 on older machines, but most things these days should # cope with SCALE=2 pretty reasonably. However, SCALE>1 doesn't work # on 1-bit or 4-bit displays at the moment. +# -DMAX_SCALE=n sets maximum acceptable value for SCALE. # -DMITSHM should always be enabled unless you have problems compiling # with it on (xz81's rather slow without it). # -XDEF=-DSCALE=2 -DMITSHM +XDEF=-DSCALE=2 -DMAX_SCALE=4 -DMITSHM # sound support, which if compiled in can be enabled with `-s' and/or # `-a '. Yes, don't worry, it's off by default. :-) @@ -26,7 +27,8 @@ # it is, try `/usr/X11', that's a common culprit.) On Linux it's # generally here: # -XROOT=/usr/X11R6 +#XROOT=/usr/X11R6 +XROOT=/usr # xz81 has a rather complicated routine to draw a pixel (scaling makes # it a bit non-trivial), which should be inlined by the compiler if @@ -46,7 +48,7 @@ # if you want the X version to be installed in the usual X executables # directory, uncomment this: # -#XBINDIR=$(XROOT)/bin +#XBINDIR=$(XROOT)/bin/X11 # you shouldn't need to edit the rest #----------------------------------------------------------------- @@ -55,7 +57,7 @@ Z81_OBJS=main.o common.o sound.o z80.o XZ81_OBJS=xmain.o common.o sound.o z80.o -CFLAGS=-I$(XROOT)/include -O -Wall $(SOUNDDEF) \ +CFLAGS=-I$(XROOT)/include/X11 -O -Wall $(SOUNDDEF) \ $(XDEF) $(INLINEDEF) -DLIBDIR=\"$(LIBDIR)\" all: z81 xz81 @@ -66,7 +68,7 @@ $(CC) $(CFLAGS) -o z81 $(Z81_OBJS) -lvga xz81: $(XZ81_OBJS) - $(CC) $(CFLAGS) -o xz81 $(XZ81_OBJS) -L$(XROOT)/lib -lXext -lX11 + $(CC) $(CFLAGS) -o xz81 $(XZ81_OBJS) -L$(XROOT)/lib/X11 -lXext -lX11 zx81get: zx81get.o $(CC) $(CFLAGS) -o zx81get zx81get.o @@ -99,7 +101,7 @@ # stuff to make distribution tgz -VERS=2.1 +VERS=2.2 tgz: ../z81-$(VERS).tar.gz diff -Naur sz81-2.1.7-orig/TODO.z81 sz81-2.1.7/TODO.z81 --- sz81-2.1.7-orig/TODO.z81 2010-03-09 14:40:26.000000000 +0100 +++ sz81-2.1.7/TODO.z81 2012-06-07 18:04:58.000000000 +0200 @@ -11,9 +11,6 @@ and if I can't avoid it I should at least document it in the man page. -Make SCALE a command-line option rather than a compile-time one. - - Add support for further AY-based sound addons, if any. The QS and Zon were easily the most important ones, so this isn't that important really. diff -Naur sz81-2.1.7-orig/xmain.c sz81-2.1.7/xmain.c --- sz81-2.1.7-orig/xmain.c 2010-03-08 13:36:38.000000000 +0100 +++ sz81-2.1.7/xmain.c 2012-06-07 18:00:55.000000000 +0200 @@ -59,7 +59,7 @@ int mitshm=1; -int hsize=ZX_VID_X_WIDTH*SCALE,vsize=ZX_VID_X_HEIGHT*SCALE; +int hsize,vsize; /* remember, this table is ignoring shifts... */ static struct {unsigned char port,mask;} keytable[]={ @@ -234,6 +234,8 @@ static int image_init() { + hsize=ZX_VID_X_WIDTH*scrn_scale,vsize=ZX_VID_X_HEIGHT*scrn_scale; + #ifdef MITSHM if(mitshm){ ximage=XShmCreateImage(display,DefaultVisual(display,screen), @@ -275,7 +277,7 @@ return 1; } } - linelen=ximage->bytes_per_line/SCALE; + linelen=ximage->bytes_per_line/scrn_scale; if(linelen!=ZX_VID_X_WIDTH/8 && /* 1-bit */ linelen!=ZX_VID_X_WIDTH/4 && /* 4-bit */ linelen!=ZX_VID_X_WIDTH && /* 8-bit */ @@ -310,11 +312,10 @@ white_bits16to23=((white>>16)&255); white_bits24to31=((white>>24)&255); -#if SCALE>1 + if (scrn_scale>1) if(imagebpp==1) fprintf(stderr, - "Warning: xz81 doesn't support SCALE>1 in mono, expect oddities!\n"); -#endif + "Warning: xz81 doesn't support screen resize factor>1 in mono, expect oddities!\n"); return 0; } @@ -408,22 +409,18 @@ { unsigned char *tmp; int mask=256; -#if SCALE>1 int j,k,m; -#endif /* is just me, or was this approach not worth the effort in the end? :-/ */ switch(imagebpp) { case 32: - tmp=image+(y*hsize+x*8)*4*SCALE; + tmp=image+(y*hsize+x*8)*4*scrn_scale; while((mask>>=1)) { -#if SCALE>1 - for(j=0;j1 /* we want to move one scaled-up pixel up, then one right */ - tmp-=(hsize*SCALE-SCALE)*4; -#endif + tmp-=(hsize*scrn_scale-scrn_scale)*4; } break; case 24: - tmp=image+(y*hsize+x*8)*3*SCALE; + tmp=image+(y*hsize+x*8)*3*scrn_scale; while((mask>>=1)) { -#if SCALE>1 - for(j=0;j1 /* we want to move one scaled-up pixel up, then one right */ - tmp-=(hsize*SCALE-SCALE)*3; -#endif + tmp-=(hsize*scrn_scale-scrn_scale)*3; } break; case 15: case 16: - tmp=image+(y*hsize+x*8)*2*SCALE; + tmp=image+(y*hsize+x*8)*2*scrn_scale; while((mask>>=1)) { -#if SCALE>1 - for(j=0;j1 /* we want to move one scaled-up pixel up, then one right */ - tmp-=(hsize*SCALE-SCALE)*2; -#endif + tmp-=(hsize*scrn_scale-scrn_scale)*2; } break; case 8: - tmp=image+(y*hsize+x*8)*SCALE; + tmp=image+(y*hsize+x*8)*scrn_scale; while((mask>>=1)) -#if SCALE<2 + if (scrn_scale<2) + { /* i.e. actual size */ *tmp++=(d&mask)?black:white; -#else + } + else { m=((d&mask)?black:white); - for(j=0;j1. @@ -804,13 +792,13 @@ #ifdef MITSHM if(mitshm) XShmPutImage(display,mainwin,maingc,ximage, - xmin*SCALE,ymin*SCALE,xmin*SCALE,ymin*SCALE, - (xmax-xmin+1)*SCALE,(ymax-ymin+1)*SCALE,0); + xmin*scrn_scale,ymin*scrn_scale,xmin*scrn_scale,ymin*scrn_scale, + (xmax-xmin+1)*scrn_scale,(ymax-ymin+1)*scrn_scale,0); else #endif XPutImage(display,mainwin,maingc,ximage, - xmin*SCALE,ymin*SCALE,xmin*SCALE,ymin*SCALE, - (xmax-xmin+1)*SCALE,(ymax-ymin+1)*SCALE); + xmin*scrn_scale,ymin*scrn_scale,xmin*scrn_scale,ymin*scrn_scale, + (xmax-xmin+1)*scrn_scale,(ymax-ymin+1)*scrn_scale); } XFlush(display); diff -Naur sz81-2.1.7-orig/z81.1 sz81-2.1.7/z81.1 --- sz81-2.1.7-orig/z81.1 2010-03-08 13:36:38.000000000 +0100 +++ sz81-2.1.7/z81.1 2012-06-07 18:01:58.000000000 +0200 @@ -21,7 +21,7 @@ .\" .\" z81.1 (and xz81.1) - man page .\" -.TH z81 1 "1st October, 2004" "Version 2.1" "Emulators" +.TH z81 1 "29th May, 2012" "Version 2.2" "Emulators" .\" .\"------------------------------------------------------------------ .\" @@ -40,6 +40,8 @@ .IR printout.pbm ] .RB [ -r .IR refresh_rate ] +.RB [ -R +.IR screen_scale ] .RI [ filename.p ] .P .PD 1 @@ -120,6 +122,10 @@ incrementally, so the default setting should be reasonable on just about any machine, for most programs. .TP +.B -R +specifies non-negative scaling factor for emulator screen. +Maximal accepted value is 4. Default is 2. +.TP .B -s enable VSYNC-based sound support. This is essentially a less-noisy version of what you'd hear through the TV. You probably don't want to