{"id":387,"date":"2021-08-18T17:04:03","date_gmt":"2021-08-18T15:04:03","guid":{"rendered":"https:\/\/automatico.freevar.com\/?page_id=387"},"modified":"2021-11-24T18:02:34","modified_gmt":"2021-11-24T17:02:34","slug":"c","status":"publish","type":"page","link":"https:\/\/automatico.freevar.com\/index.php\/z80-mbc2\/esp32\/c\/","title":{"rendered":"C"},"content":{"rendered":"<p><span style=\"font-size: 14pt;\">The graphic test program of the video terminal was originally written in BASIC.\u00a0I managed to translate it into C language (Hi-tech 3.09) and build a library to more simply invoke the primitive graphics functions.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The generation of a random number is regulated by the variable &#8220;t&#8221; type time_t.\u00a0The time.h library defines the time_t type which represents the amount of time units elapsed, in number of seconds, from January 1, 1970 to the current second.\u00a0<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">You will find libv.lib and libg.lib libraries in the section dedicated to the Hi-tech C compiler. The compilation directive is C -v graphic.c libv.lib libg.lib.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">Anyway here the link of graphic.com:<\/span>\u00a0<a href=\"https:\/\/automatico.freevar.com\/dump\/graphic.com\">https:\/\/automatico.freevar.com\/dump\/graphic.com<\/a><\/p>\n<pre class=\"brush: cpp; title: graphic.c; notranslate\" title=\"graphic.c\">\r\n#include &lt;stdio.h&gt;\r\n#include &lt;conio.h&gt;\r\n#include &lt;sys.h&gt;\r\n#include &lt;math.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n#include &lt;cpm.h&gt;\r\n#include &lt;time.h&gt;\r\n#include &lt;libv.h&gt;\r\n#include &lt;libg.h&gt;\r\n\r\nmain()\r\n{\r\n        int c, i;\r\n        int r,g,b;\r\n        int x,y;\r\n        int x1,x2,y1,y2;\r\n\r\n        time_t t;\r\n\r\n        char buf&#x5B;32];\r\n        char string&#x5B;129];\r\n        memset(string,0,sizeof(string));\r\n\r\n        srand(time(&amp;amp;amp;amp;t));\r\n\r\n        gcursoff();\r\n        gclear();\r\n\r\n        \/* punti *\/\r\n        i = 100;\r\n        while(i--)\r\n        {\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gpen(r,g,b);\r\n                x=1+rand()%640;\r\n                y=1+rand()%480;\r\n                gpixel(x,y);\r\n        }\r\n\r\n        i = 120;\r\n        while(i--)\r\n        {\r\n                gscroll(4,4);\r\n        }\r\n\r\n        \/* linee *\/\r\n        i = 100;\r\n        while(i--)\r\n        {\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gpen(r,g,b);\r\n                x1=1+rand()%640;\r\n                y1=1+rand()%480;\r\n                x2=1+rand()%640;\r\n                y2=1+rand()%480;\r\n                gdraw(x1,y1,x2,y2);\r\n        }\r\n\r\n        i = 120;\r\n        while(i--)\r\n        {\r\n                gscroll(-4,4);\r\n        }\r\n\r\n        \/* rettangoli *\/\r\n        i = 50;\r\n        while(i--)\r\n        {\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gbrush(r,g,b);\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gpen(r,g,b);\r\n                x1=1+rand()%640;\r\n                y1=1+rand()%480;\r\n                x2=1+rand()%640;\r\n                y2=1+rand()%480;\r\n                gfillrect(x1,y1,x2,y2);\r\n                grect(x1,y1,x2,y2);\r\n        }\r\n        i = 120;\r\n        while(i--)\r\n        {\r\n                gscroll(4,-4);\r\n        }\r\n\r\n        \/* ellissi *\/\r\n        i = 50;\r\n        while(i--)\r\n        {\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gbrush(r,g,b);\r\n\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n                gpen(r,g,b);\r\n\r\n                x1=1+rand()%640;\r\n                y1=1+rand()%480;\r\n\r\n                x2=1+rand()%640;\r\n                y2=1+rand()%480;\r\n\r\n                gfillelp(x1,y1,x2,y2);\r\n                gellipse(x1,y1,x2,y2);\r\n        }\r\n\r\n        i = 120;\r\n        while(i--)\r\n        {\r\n                gscroll(-4,-4);\r\n        }\r\n\r\n        \/* poligoni *\/\r\n        i = 50;\r\n\r\n        while(i--)\r\n        {\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n\r\n                gbrush(r,g,b);\r\n\r\n                r=1+rand()%255;\r\n                g=1+rand()%255;\r\n                b=1+rand()%255;\r\n\r\n                gpen(r,g,b);\r\n\r\n                c = 3 + rand()%4;\r\n                \/* minimo 3 massimo 6 coppie di coordinate *\/\r\n                \/* ogni coppia di coordinate occupa 8 caratteri *\/\r\n                while (c--)\r\n                {\r\n                        x=1+rand()%640;\r\n                        itoa(x,buf,10);\r\n                        strcat(string,buf);\r\n                        strcat(string,&quot;;&quot;);\r\n\r\n                        y=1+rand()%480;\r\n                        itoa(y,buf,10);\r\n\r\n                        strcat(string,buf);\r\n                        if (c&gt;0)\r\n                        { strcat(string,&quot;;&quot;); }\r\n                }\r\n                strcat(string,&quot;$&quot;);\r\n\r\n                gfillpth(string);\r\n                gpath(string);\r\n\r\n                memset(string,0,sizeof(string));\r\n        }\r\n\r\n        i = 120;\r\n        while(i--)\r\n        {\r\n                gscroll(-4,0);\r\n        }\r\n\r\n        gclear();\r\n        gclrterm();\r\n        gcurson();\r\n}\r\n<\/pre>\n<p><!--nextpage--><\/p>\n<p><span style=\"font-size: 14pt;\">Negli anni &#8217;70 un geniale matematico ide\u00f2 il &#8220;Gioco delle vita&#8221;, un universo monocellulare con regole semplici di vita o di morte. Come nella realt\u00e0 gli organismi sopravvivono se non c&#8217;\u00e8 carestia o sovraffollamento, anche in questo universo artificiale valgono le stesse regole. Inizialmente Conway propose la grafica della sua teorizzazione disegnando linee come righe e colonne su di un foglio di carta. Nei quadrati poi applicava queste regole per ogni generazione:<\/span><\/p>\n<ul>\n<li><span style=\"font-size: 14pt;\">una cellula vive se ha due o tre cellule vicine<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">in una cella vuota che ha tre vicini si genera una cellula vivente<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">una cellula muore se ha zero, uno o quattro o pi\u00f9 vicini<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: 14pt;\">Una esauriente spiegazione la trovate a questo indirizzo\u00a0<a href=\"https:\/\/areeweb.polito.it\/didattica\/polymath\/htmlS\/probegio\/GAMEMATH\/GiocoVita\/GiocoVita.htm\">https:\/\/areeweb.polito.it\/didattica\/polymath\/htmlS\/probegio\/GAMEMATH\/GiocoVita\/GiocoVita.htm<\/a><\/span><\/p>\n<p><span style=\"font-size: 14pt;\">Adesso vi mostro un mio adattamento al compilatore Hi-tech C 3.09 per terminale VT100 scritto da Kevin Boone trovato qui: <a href=\"https:\/\/github.com\/kevinboone\/cpmlife\">https:\/\/github.com\/kevinboone\/cpmlife<\/a><\/span><\/p>\n<pre class=\"brush: cpp; title: game.c; notranslate\" title=\"game.c\">\r\n\/*==========================================================================\r\ngame.c\r\nSimple implementation of Conway's &quot;Game of Life&quot; for CP\/M on the Z80 Playground. \r\nThis program uses VT100 or VT52 character codes on an 80x24 terminal.\r\nThis file is intended to be compiled using the z88dk compiled &quot;zcc&quot;.\r\nWritten by Kevin Boone, May 2021. No rights reserved -- do with this as you wish.\r\nModified for Hi-tech C 3.09 - CP\/M-80 3.0 - Z80-MBC2 by Vito BLASI\r\n==========================================================================*\/\r\n\r\n#include &lt;conio.h&gt;\r\n#include &lt;sys.h&gt;\r\n#include &lt;math.h&gt;\r\n#include &lt;cpm.h&gt;\r\n#include &lt;time.h&gt;\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n#include &lt;string.h&gt;\r\n#include &lt;libv.h&gt;\r\n\r\n\/* Size of the grid. We can't go much bigger the 16x32 on the Z80-PG. *\/\r\n#define ROWS 16\r\n#define COLS 32\r\n\r\n\/* Where to position the grid on the display. *\/\r\n#define ROW_OFFSET 2\r\n#define COL_OFFSET 24\r\n\r\n\/* The character to draw for a cell. *\/\r\n#define CELL_CHAR 'o'\r\n\r\n#define TRUE 1\r\n#define FALSE 0\r\n\r\n#define TERM_ANSI 0\r\n#define TERM_VT52 1\r\n\r\n\/* Count of seconds past from 1 January 1970 *\/ \r\ntime_t t;\r\n\r\n\/* Change this to get VT52 codes. *\/\r\nint term_type = TERM_ANSI;\r\n\r\n\/* Maintain two copies of the grid -- lastgrid is used to calculate which\r\ncharacter cells need updating; this is to minimize the amount of\r\ndata that has to be sent to the terminal. *\/\r\nchar grid &#x5B;ROWS]&#x5B;COLS];\r\nchar lastgrid &#x5B;ROWS]&#x5B;COLS];\r\n\r\n\/** *\/\r\nvoid term_putchar (char c)\r\n{\r\n   bdos (0x02, c);\r\n}\r\n\r\n\/* This is a lookup table for numbers up to 80 -- this is the largest\r\nnumber the program will output. Using a table takes up a certain\r\namount of memory, but it avoids doing number-to-ASCII conversion,\r\nwhich is slow.*\/\r\n\/* Note: 80 generate an error during compilation\r\nprobably the last one is necessary for \/0 termination *\/\r\nstatic char *nums&#x5B;81] =\r\n{\r\n   &quot;0&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;,\r\n   &quot;10&quot;, &quot;11&quot;, &quot;12&quot;, &quot;13&quot;, &quot;14&quot;, &quot;15&quot;, &quot;16&quot;, &quot;17&quot;, &quot;18&quot;, &quot;19&quot;,\r\n   &quot;20&quot;, &quot;21&quot;, &quot;22&quot;, &quot;23&quot;, &quot;24&quot;, &quot;25&quot;, &quot;26&quot;, &quot;27&quot;, &quot;28&quot;, &quot;29&quot;,\r\n   &quot;30&quot;, &quot;31&quot;, &quot;32&quot;, &quot;33&quot;, &quot;34&quot;, &quot;35&quot;, &quot;36&quot;, &quot;37&quot;, &quot;38&quot;, &quot;39&quot;,\r\n   &quot;40&quot;, &quot;41&quot;, &quot;42&quot;, &quot;43&quot;, &quot;44&quot;, &quot;45&quot;, &quot;46&quot;, &quot;47&quot;, &quot;48&quot;, &quot;49&quot;,\r\n   &quot;50&quot;, &quot;51&quot;, &quot;52&quot;, &quot;53&quot;, &quot;54&quot;, &quot;55&quot;, &quot;56&quot;, &quot;57&quot;, &quot;58&quot;, &quot;59&quot;,\r\n   &quot;60&quot;, &quot;61&quot;, &quot;62&quot;, &quot;63&quot;, &quot;64&quot;, &quot;65&quot;, &quot;66&quot;, &quot;67&quot;, &quot;68&quot;, &quot;69&quot;,\r\n   &quot;70&quot;, &quot;71&quot;, &quot;72&quot;, &quot;73&quot;, &quot;74&quot;, &quot;75&quot;, &quot;76&quot;, &quot;77&quot;, &quot;78&quot;, &quot;79&quot;,\r\n   &quot;80&quot;\r\n};\r\n\r\n\/** Output a number &lt;= 80 from the lookup table. This is complicated,\r\nbut it saves a heap of arithmetic, and it has to be done for\r\nevery cell displayed. *\/\r\nvoid putnum (int c)\r\n{\r\n   if (c &lt; 10)\r\n   {\r\n   term_putchar ('0' + c);\r\n   }\r\n   else\r\n   {\r\n   char *s = nums&#x5B;c];\r\n   term_putchar (s&#x5B;0]);\r\n   term_putchar (s&#x5B;1]);\r\n   }\r\n}\r\n\r\n\/** Show cursor *\/\r\nvoid term_show_cursor (void)\r\n{\r\n   if (term_type == TERM_VT52)\r\n      ; \/* Can't do it *\/\r\n   else\r\n      printf (&quot;\\x1B&#x5B;?25h&quot;);\r\n}\r\n\r\n\/** Hide cursor *\/\r\nvoid term_hide_cursor (void)\r\n{\r\n   if (term_type == TERM_VT52)\r\n      ; \/* Can't do it *\/\r\n   else\r\n      printf (&quot;\\x1B&#x5B;?25l&quot;);\r\n}\r\n\r\n\/** Set cursor position starting at 0,0 *\/\r\nvoid term_set_cursor (int row, int col)\r\n{\r\n   if (term_type == TERM_VT52)\r\n      printf (&quot;\\x1BY%c%c&quot;, ' ' + row, ' ' + col);\r\n   else\r\n   {\r\n      term_putchar (27);\r\n      term_putchar ('&#x5B;');\r\n      putnum (row + 1);\r\n      term_putchar (';');\r\n      putnum (col + 1);\r\n      term_putchar ('H');\r\n   }\r\n}\r\n\r\n\/** Clear screen and home *\/\r\nvoid term_clear ()\r\n{\r\n   term_set_cursor (0, 0);\r\n   if (term_type == TERM_VT52)\r\n      printf (&quot;\\x1BJ&quot;);\r\n   else\r\n      printf (&quot;\\x1B&#x5B;J&quot;);\r\n}\r\n\r\n\/** Return the last character typed, or zero if there wasn't one. *\/\r\nint term_peekchar (void)\r\n{\r\n   int a;\r\n   a = bdos (0x06, 0xFF);\r\n   return a;\r\n}\r\n\r\n\/** Draw the grid, taking into account which cells are different from\r\nthe last run. *\/\r\nvoid life_draw_grid ()\r\n{\r\n   int i, j;\r\n   char *_grid = (char *)grid;\r\n   char *_lastgrid = (char *)lastgrid;\r\n   for (i = 0; i &lt; ROWS; i++)\r\n   {\r\n      int row_offset = i * COLS;\r\n      for (j = 0; j &lt; COLS; j++)\r\n      {\r\n          int offset = row_offset + j;\r\n          if (_grid&#x5B;offset] != _lastgrid&#x5B;offset])\r\n          {\r\n             term_set_cursor (i + ROW_OFFSET, j + COL_OFFSET);\r\n             if (_grid&#x5B;offset])\r\n                term_putchar (CELL_CHAR);\r\n             else\r\n                term_putchar (' ');\r\n          }\r\n      }\r\n   }\r\n   memcpy (lastgrid, grid, sizeof (grid));\r\n}\r\n\r\n\/** life_clear_display. Clear the display and draw the menu line. *\/\r\nvoid life_clear_display (void)\r\n{\r\n   term_clear();\r\n   term_set_cursor (ROWS + 1 + ROW_OFFSET, 0);\r\n   printf (&quot; &#x5B;R]estart &#x5B;Q]uit&quot;);\r\n   fflush (stdout);\r\n}\r\n\r\n\/** life_evolve.\r\nCalculate which cells live and which die. *\/\r\nint life_evolve ()\r\n{\r\n   int i, j;\r\n   char *_grid = (char *)grid;\r\n   char *_lastgrid = (char *)lastgrid;\r\n\/* Note that I'm referencing the grid as a one-dimentional array\r\nhere, so I can precompute the offsets into the array while doing\r\nthe big loop. Every evaluation of the form &quot;grid&#x5B;row]&#x5B;col]&quot;\r\nrequires a multiplication and an addition; most of these are\r\nunnecessary, since we're working through the grid sequentially. *\/\r\n   int diffs = 0;\r\n   for (i = 0; i &lt; ROWS; i++)\r\n   {\r\n      int row_offset = i * COLS;\r\n      for (j = 0; j &lt; COLS; j++)\r\n      {\r\n         int offset = row_offset + j;\r\n         int c = 0;\r\n         if (i &gt; 0)\r\n         {\r\n            int row_above = i - 1;\r\n            if (j &gt; 0 &amp;&amp; grid&#x5B;row_above]&#x5B;j - 1]) c++;\r\n            if ( grid&#x5B;row_above]&#x5B;j]) c++;\r\n            if (j &lt; COLS - 1 &amp;&amp; grid&#x5B;row_above]&#x5B;j + 1]) c++;\r\n         }\r\n         if (j &gt; 0 &amp;&amp; _grid&#x5B;offset - 1]) c++;\r\n         if (j &lt; COLS - 1 &amp;&amp; _grid&#x5B;offset + 1]) c++;\r\n         if (i &lt; ROWS - 1)\r\n         {\r\n            int row_below = i + 1;\r\n            if (j &gt; 0 &amp;&amp; grid&#x5B;row_below]&#x5B;j - 1]) c++;\r\n            if ( grid&#x5B;row_below]&#x5B;j]) c++;\r\n            if (j &lt; COLS - 1 &amp;&amp; grid&#x5B;row_below]&#x5B;j + 1]) c++;\r\n         }\r\n\r\n\/* This is where the actual simulation is done -- just the next\r\ndozen lines. Work out whether a cell lives or dies, according\r\nto its current status and the number of neighbours it has. *\/\r\n\r\n         if (_grid&#x5B;offset])\r\n         {\r\n            if (c == 2 || c == 3)\r\n            {\r\n            }\r\n            else\r\n               _grid&#x5B;offset] = 0;\r\n         }\r\n         else\r\n         {\r\n            if (c == 3) _grid&#x5B;offset] = 1;\r\n         }\r\n         if (_grid&#x5B;offset] != _lastgrid&#x5B;offset]) diffs++;\r\n      }\r\n   }\r\n   return diffs;\r\n}\r\n\r\n\/** life_init_grid *\/\r\nint life_init_grid ()\r\n{\r\n   int i, r, c;\r\n   memset (grid, 0, sizeof (grid));\r\n   memset (lastgrid, 0, sizeof (lastgrid));\r\n   for (i = 0; i &lt; 60; i++)\r\n   {\r\n\/* The below is mathematically wrong, unless ROWS and COLS are\r\npowers of 2 (which they might be). *\/\r\n      r = rand() % ROWS;\r\n      c = rand() % COLS;\r\n      grid&#x5B;r]&#x5B;c] = 1;\r\n   }\r\n   memcpy (lastgrid, grid, sizeof (grid));\r\n   return 0;\r\n}\r\n\r\n\/** Get a &quot;random&quot; number from the R register *\/\r\n\/*\r\nint getrnd (void)\r\n{\r\n\/* Note: Hi-tech C 3.09 wants directives #asm and #endasm\r\non the first column, absolutely *\/\r\n#asm\r\nld a,r\r\nld l,a\r\nld h,0\r\n\/* Note that zcc expects return values in the HL register. *\/\r\n#endasm\r\n}\r\n*\/\r\n\r\n\/** main *\/\r\nint main (int argc, char **argv)\r\n{\r\n   int cycles, delay;\r\n   BOOL stop = FALSE;\r\n\/* This is a lookup table for numbers up to 80 -- this is the largest\r\nnumber the program will output. Using a table takes up a certain\r\namount of memory, but it avoids doing number-to-ASCII co which is slow. *\/\r\n\r\n   srand (getrnd());\r\n\/* srand(time(&amp;amp;t)); *\/\r\n   life_init_grid();\r\n   life_clear_display();\r\n\/* Use a running count of program loops to seed the random\r\nnumber generator when &quot;R&quot; is pressed. This gives a 16-bit\r\nseed, which is better than the 8-bit seed we can get from\r\nthe R register. The first time the simulation runs, we have\r\nto use the R register. *\/\r\n   cycles = 0;\r\n   delay = 1;\r\n\/* It's best to hide the cursor -- otherwise we see it scanning\r\n   down the display *\/\r\n   term_hide_cursor(); while (!stop)\r\n   {\r\n      int diffs, c;\r\n      life_draw_grid ();\r\n      term_set_cursor (ROWS + 1, 0);\r\n      diffs = life_evolve ();\r\n      if (diffs == 0)\r\n      {\r\n         srand (cycles);\r\n         life_init_grid();\r\n         life_clear_display();\r\n      }\r\n      c = term_peekchar();\r\n      if (c == 'q') stop = TRUE;\r\n      if (c == 'r')\r\n      {\r\n         srand (cycles);\r\n         life_init_grid ();\r\n         life_clear_display();\r\n      }\r\n      cycles++;\r\n   }\r\n\r\n   term_clear();\r\n   term_show_cursor();\r\n   fflush (stdout);\r\n   return 0;\r\n}\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-584\" src=\"https:\/\/automatico.freevar.com\/wp-content\/uploads\/2021\/08\/game-300x192.png\" alt=\"\" width=\"460\" height=\"294\" srcset=\"https:\/\/automatico.freevar.com\/wp-content\/uploads\/2021\/08\/game-300x192.png 300w, https:\/\/automatico.freevar.com\/wp-content\/uploads\/2021\/08\/game-768x490.png 768w, https:\/\/automatico.freevar.com\/wp-content\/uploads\/2021\/08\/game.png 996w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_387\" class=\"pvc_stats all  \" data-element-id=\"387\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The graphic test program of the video terminal was originally written in BASIC.\u00a0I managed to translate it into C language (Hi-tech 3.09) and build a library to more simply invoke the primitive graphics functions. The generation of a random number is regulated by the variable &#8220;t&#8221; type time_t.\u00a0The time.h library defines the time_t type which [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_387\" class=\"pvc_stats all  \" data-element-id=\"387\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"parent":338,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-387","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/387"}],"collection":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":33,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/387\/revisions"}],"predecessor-version":[{"id":947,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/387\/revisions\/947"}],"up":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/338"}],"wp:attachment":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/media?parent=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}