diff -Naur z81-2.1/ChangeLog z81-2.2/ChangeLog --- z81-2.1/ChangeLog 2004-10-01 21:38:55.000000000 +0000 +++ z81-2.2/ChangeLog 2012-05-29 18:30:05.000000000 +0000 @@ -1,3 +1,10 @@ +2012-05-20 Jerzy Kut + + * Added -R scale parameter (SCALE is leaved in Makefile, but + it is used as default value when no -R option specified in + commandline. + * SCALE_MAX defined in Makefile. + 2004-10-01 Russell Marks * Version 2.1. diff -Naur z81-2.1/Makefile z81-2.2/Makefile --- z81-2.1/Makefile 2004-10-01 21:05:44.000000000 +0000 +++ z81-2.2/Makefile 2012-05-29 18:31:39.000000000 +0000 @@ -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/share/X11 # 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 @@ -99,7 +101,7 @@ # stuff to make distribution tgz -VERS=2.1 +VERS=2.2 tgz: ../z81-$(VERS).tar.gz diff -Naur z81-2.1/NEWS z81-2.2/NEWS --- z81-2.1/NEWS 2004-10-01 21:49:19.000000000 +0000 +++ z81-2.2/NEWS 2012-05-29 18:30:54.000000000 +0000 @@ -4,6 +4,10 @@ versions of z81, with the newest changes first. +* Changes in z81 2.2 + +Added -R option in command line to set screen scale factor. + * Changes in z81 2.1 Fixed several compilation warnings with gcc, as well as something gcc diff -Naur z81-2.1/TODO z81-2.2/TODO --- z81-2.1/TODO 2001-06-24 23:14:33.000000000 +0000 +++ z81-2.2/TODO 2012-05-29 18:31:04.000000000 +0000 @@ -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 z81-2.1/common.c z81-2.2/common.c --- z81-2.1/common.c 2004-10-01 21:06:00.000000000 +0000 +++ z81-2.2/common.c 2012-05-29 18:45:32.000000000 +0000 @@ -19,7 +19,7 @@ * common.c - various routines/vars common to z81/xz81. */ -#define Z81_VER "2.1" +#define Z81_VER "2.2" #include #include @@ -54,6 +54,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 */ @@ -864,9 +865,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" @@ -886,6 +887,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" @@ -911,7 +913,7 @@ opterr=0; do - switch(getopt(argc,argv,"a:hilLop:r:sSTuV")) + switch(getopt(argc,argv,"a:hilLop:r:R:sSTuV")) { case 'a': sound=1; @@ -954,6 +956,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; case 's': /* sound (!) - specifically, VSYNC-based sound */ sound=1; sound_vsync=1; @@ -986,6 +993,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 z81-2.1/common.h z81-2.2/common.h --- z81-2.1/common.h 2001-06-26 08:50:28.000000000 +0000 +++ z81-2.2/common.h 2012-05-29 18:26:12.000000000 +0000 @@ -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 z81-2.1/xmain.c z81-2.2/xmain.c --- z81-2.1/xmain.c 2001-09-27 14:04:59.000000000 +0000 +++ z81-2.2/xmain.c 2012-05-29 18:27:23.000000000 +0000 @@ -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(imagebpp==1) - fprintf(stderr, - "Warning: xz81 doesn't support SCALE>1 in mono, expect oddities!\n"); -#endif + if (scrn_scale>1) + if(imagebpp==1) + fprintf(stderr, + "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 - /* i.e. actual size */ - *tmp++=(d&mask)?black:white; -#else + if (scrn_scale<2) { - 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 z81-2.1/z81.1 z81-2.2/z81.1 --- z81-2.1/z81.1 2004-10-01 21:38:19.000000000 +0000 +++ z81-2.2/z81.1 2012-05-29 18:35:03.000000000 +0000 @@ -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