Introduce 80x50 mode. Will be tricky to make optional, commit for now.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 18 Apr 2022 10:56:17 +0000 (10:56 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 18 Apr 2022 10:56:17 +0000 (10:56 +0000)
MATT/TODO.txt
hacks/analogterm-main.c
hacks/analogterm.c
hacks/analogterm.h
hacks/analogtv.c
hacks/analogtv.h

index f965294..a0676d1 100644 (file)
@@ -9,6 +9,10 @@ BUILD
 TODO
 ====
 
+- Try to play with squish_control.
+- Make 80x50 mode configurable.  This will be a bit tricky as various code
+  changes were necessary including to constants.
+- Inverse text could be clearer, especially when also bright/bold.
 - Now that upwards smooth scrolling has been implemented:
   - May be possible to do the same for downwards
   - May need to support sending XOFF/XON to control speed, if too fast it
@@ -228,8 +232,6 @@ TODO
   Ironically the result will be more portable on common unix.
   And much cleaner once consolidated.
 - Maybe add an option for HIRES/color mode.
-- It'd be nice to support 80x50, 132x50, etc...
-  It'd require analogtv code changes.
 - Would be nice for analogtv to simulate amber or green display
   optionally.  And to also support a less blurry mode simulating
   screens with higher phosphor.
@@ -366,3 +368,12 @@ hacks/analogterm -fast -geometry 1364x1024 -program /bin/sh -tv-color 0 -tv-brig
 
 Most used command by the author:
 hacks/analogterm -geometry 1364x1024 -no-threads
+
+1150x1024  seems decent when in 80x50
+hacks/analogterm -geometry 1056x1024 -no-threads
+hacks/analogterm -geometry 912x1024 -no-threads
+hacks/analogterm -no-threads -geometry 960x1000
+
+# 960x1000 is now the default since the 80x50 mode was introduced.
+# Setting the right window size for the text to be clearer is a bit tricky.
+hacks/analogterm -no-threads 
index 771c82e..ad878da 100644 (file)
@@ -47,7 +47,7 @@
 #define countof(x) (sizeof((x))/sizeof((*x)))
 
 #define SCREEN_COLS 80
-#define SCREEN_ROWS 25
+#define SCREEN_ROWS 50
 
 \f
 
index 11c4af6..09d6450 100644 (file)
@@ -241,7 +241,7 @@ at_scroll_range(analogterm_state_t *st, int offset)
                return;
        }
 
-       if (st->scroll_slow && st->cursy == 24 && offset == -1)
+       if (st->scroll_slow && st->cursy == 49 && offset == -1)
                smooth = true;
 
        /* Only one line to clear */
@@ -364,7 +364,7 @@ at_prints(analogterm_state_t *st, uint32_t *s, uint16_t m)
 void
 at_goto(analogterm_state_t *st, int r, int c)
 {
-  if (r > 24) r = 24;
+  if (r > 49) r = 49;
   if (c > 79) c = 79;
 
   st->cursy = r;
@@ -385,7 +385,7 @@ at_cls(analogterm_state_t *st)
   uint32_t *cptr, *ctptr;
   uint16_t *mptr, *mtptr;
 
-  for (y = 0; y < 25; y++) {
+  for (y = 0; y < 50; y++) {
     for (cptr = st->textlines_char[y], ctptr = &cptr[80];
         cptr < ctptr; cptr++)
            *cptr = ' ';
@@ -571,7 +571,7 @@ analogterm_start(Display *dpy, Window window, int delay,
 
   /* Default scrolling region to full screen, 0-based */
   sim->st->scroll_top = 0;
-  sim->st->scroll_bottom = 24;         /* XXX Use definition/macro */
+  sim->st->scroll_bottom = 49;         /* XXX Use definition/macro */
   sim->st->scroll_slow = false;
 
   /* Create font */
@@ -593,7 +593,7 @@ analogterm_start(Display *dpy, Window window, int delay,
       analogterm_graphics3_height);
 
   sim->stepno=0;
-  at_goto(sim->st,24,0);
+  at_goto(sim->st,49,0);
   sim->st->lastchar = (uint32_t)-1;
 
   sim->next_actiontime=0.0;
@@ -657,7 +657,7 @@ analogterm_one_frame (analogterm_sim_t *sim)
          works great except with random screen garbage in text mode, when we
          end up redrawing the whole screen every second */
       int row, col;
-      for (row=(st->gr_mode ? 20 : 0); row<25; row++) {
+      for (row=(st->gr_mode ? 20 : 0); row<50; row++) {
         for (col=0; col<80; col++) {
           uint16_t m = st->textlines_mode[row][col];
           if ((m & TMODE_BLINK) != 0) {
@@ -760,7 +760,7 @@ analogterm_one_frame (analogterm_sim_t *sim)
     analogtv_setup_sync(sim->inp, /* XXX 1 */0, 0);
     analogtv_setup_frame(sim->dec);
 
-    for (textrow = 0; textrow < 25; textrow++) {
+    for (textrow = 0; textrow < 50; textrow++) {
       int row;
       int rowmul = textrow * 8;
       int soffset = (textrow >= st->scroll_top ? smooth_scroll_offset : 0);
index 97c342b..96372bc 100644 (file)
@@ -46,8 +46,8 @@
 
 typedef struct analogterm_state {
   unsigned char hireslines[192][80];
-  uint32_t textlines_char[25][80]; /* XXX Use definition/macro */
-  uint16_t textlines_mode[25][80];
+  uint32_t textlines_char[50][80]; /* XXX Use definition/macro */
+  uint16_t textlines_mode[50][80];
   int gr_text;
   enum {
     A2_GR_FULL=1,
index aa23275..0cd5fa7 100644 (file)
@@ -68,6 +68,7 @@
  * 2022 Adapted to analogterm by Matthew Mondor.
  * Altered brightness and sharpness and added optional green, amber, gray,
  * cyan and blue monochrome modes.
+ * Added double vertical resolution support for 80x50 text.
  */
 
 #ifdef HAVE_JWXYZ
@@ -237,8 +238,8 @@ analogtv_set_defaults(analogtv *it, char *prefix)
   /* XXX Original
   it->horiz_desync=frand(10.0)-5.0;
   it->squeezebottom=frand(5.0)-1.0; */
-  it->horiz_desync=frand(6.0)-3.0;
-  it->squeezebottom=frand(3.0)-1.0;
+  it->horiz_desync=frand(4.0)-2.0;
+  it->squeezebottom=frand(2.0)-0.5;
 
 #ifdef DEBUG
   printf("analogtv: prefix=%s\n",prefix);
@@ -359,11 +360,15 @@ analogtv_configure(analogtv *it)
      If it's very close (2.5%) to a multiple of VISLINES, make it exact
      For example, it maps 1024 => 1000.
    */
-  float percent = 0.15;
-  float min_ratio =  4.0 / 3.0 * (1 - percent);
+  /* float percent = 0.15; XXX Orig */
+  /*float percent = 0.075;*/
+  float percent = 0.30;
+/*  float min_ratio =  4.0 / 3.0 * (1 - percent);  XXX Orig */
+  float min_ratio =  2.0 / 4.0 * (1 - percent);
   float max_ratio = 16.0 / 9.0 * (1 + percent);
   float ratio;
-  float height_snap=0.025;
+  /* float height_snap=0.025; XXX Orig */
+  float height_snap=0.05;
 
   hlim = it->xgwa.height;
   wlim = it->xgwa.width;
@@ -375,10 +380,10 @@ analogtv_configure(analogtv *it)
   max_ratio = 10;
 #endif
 
-  if (wlim < 266 || hlim < 200)
+  if (wlim < 266 || hlim < 400)
     {
       wlim = 266;
-      hlim = 200;
+      hlim = 400;
 # ifdef DEBUG
       fprintf (stderr,
                "size: minimal: %dx%d in %dx%d (%.3f < %.3f < %.3f)\n",
@@ -1493,7 +1498,7 @@ analogtv_blast_imagerow(const analogtv *it,
         unsigned int pix;
 
 /* XXX Make this command-line and/or sequence configurable */
-#define AMBERCRT
+#define GREENCRT
         for (rpf=rgbf; rpf!=rgbf_end; rpf+=3) {
 #ifdef AMBERCRT
           int ntscri=rpf[0]*levelmult;
@@ -2003,10 +2008,10 @@ analogtv_draw(analogtv *it, double noiselevel,
       }
 
       totsignal *= it->agclevel;
-      ncl = 0.95f * it->crtload[lineno-1] +
-        0.05f*(baseload +
+      ncl = 0.98f * it->crtload[lineno-1] +
+        0.02f*(baseload +
                (totsignal-30000)/100000.0f +
-               (slineno>184 ? (slineno-184)*(lineno-184)*0.001f * it->squeezebottom
+               (slineno>368 ? (slineno-368)*(lineno-368)*0.001f * it->squeezebottom
                 : 0.0f));
       /*diff=ncl - it->crtload[lineno];*/
       /*bigloadchange = (diff>0.01 || diff<-0.01);*/
index 99c7909..a9b6e1a 100644 (file)
@@ -24,9 +24,9 @@
  */
 enum {
   /* We don't handle interlace here */
-  ANALOGTV_V=262,
+  ANALOGTV_V=524,
   ANALOGTV_TOP=30,
-  ANALOGTV_VISLINES=200,
+  ANALOGTV_VISLINES=400,
   ANALOGTV_BOT=ANALOGTV_TOP + ANALOGTV_VISLINES,
 
   /* This really defines our sampling rate, 4x the colorburst
@@ -74,7 +74,7 @@ enum {
 
   /* MAX_LINEHEIGHT corresponds to 2400 vertical pixels, beyond which
      it interpolates extra black lines. */
-  ANALOGTV_MAX_LINEHEIGHT=12
+  ANALOGTV_MAX_LINEHEIGHT=24
 
 };
 
@@ -314,7 +314,7 @@ int analogtv_handle_events (analogtv *it);
   "*TVContrast:    " ANALOGTV_DEF_CONTRAST, \
   "*Background:      Black", \
   "*use_cmap:        0",  \
-  "*geometry:       800x600", \
+  "*geometry:       960x1000", \
   "*fpsSolid:       True", \
   THREAD_DEFAULTS \
   ANALOGTV_DEFAULTS_SHM