{"id":338,"date":"2021-07-31T19:28:46","date_gmt":"2021-07-31T17:28:46","guid":{"rendered":"https:\/\/automatico.freevar.com\/?page_id=338"},"modified":"2021-09-29T15:51:43","modified_gmt":"2021-09-29T13:51:43","slug":"esp32","status":"publish","type":"page","link":"https:\/\/automatico.freevar.com\/index.php\/z80-mbc2\/esp32\/","title":{"rendered":"ESP32 graphic and ANSI terminal"},"content":{"rendered":"<p><span style=\"font-size: 14pt;\">What is there to write that has not already been written about this project by Fabrizio Di Vittorio <a href=\"https:\/\/github.com\/fdivitto\">https:\/\/github.com\/fdivitto<\/a>. <\/span><\/p>\n<p><span style=\"font-size: 14pt;\">This terminal, as far as I&#8217;m concerned, is a real HW and SW masterpiece.\u00a0<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The processor used is an ESP32 SOC programmed to make a graphic page available to the user.\u00a0The primitive functions made available allow you to draw lines, circles, polygons, points;\u00a0to manage the pointing of a mouse;\u00a0to accept characters from a keyboard;\u00a0generate audio;\u00a0emulate an ANSI \/ VT terminal and more.\u00a0The circuit is connected via TTL serial to the central unit and has as I \/ O a standard 640 \u00d7 480 VGA port, a PS \/ 2 port for mouse, a PS \/ 2 port for keyboard and a non-amplified monaural audio output.<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The documentation, schematics and the library can be found at this address<\/span><\/p>\n<p><a style=\"font-size: 14pt;\" href=\"http:\/\/www.fabglib.org\">http:\/\/www.fabglib.org<\/a><\/p>\n<p><span style=\"font-size: 14pt;\">The following program shows the graphic potential of the terminal.\u00a0It was written in BASIC language and this version is adapted to Basic-85 for CP \/ M.<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n1 REM Draws some graphics\r\n100 WIDTH 255\r\n105 GOSUB 10000: REM Define functions\r\n106 REM Disable cursor and clear screen\r\n107 PRINT FNCURSOROFF$;FNCLR$;\r\n110 REM\r\n120 REM ** POINTS **\r\n130 FOR I = 0 TO 100\r\n140 REM Set random pen color\r\n150 PRINT FNPEN$(RND*255, RND*255, RND*255);\r\n160 REM Draw a pixel at random position\r\n170 PRINT FNPIXEL$(RND*640, RND*480);\r\n180 NEXT I\r\n190 FOR I = 0 TO 120: PRINT FNSCROLL$(4, 4);: NEXT I\r\n200 REM\r\n210 REM ** LINES **\r\n220 FOR I = 0 TO 100\r\n230 REM Set random pen color\r\n240 PRINT FNPEN$(RND*255, RND*255, RND*255);\r\n250 REM Draw a line\r\n260 PRINT FNDRAW$(RND*640, RND*480, RND*640, RND*480);\r\n270 NEXT I\r\n280 FOR I = 0 TO 120: PRINT FNSCROLL$(-4, 4);: NEXT I\r\n290 REM\r\n300 REM ** FILLED RECTANGLES **\r\n310 FOR I = 0 TO 50\r\n320 REM Set random brush color\r\n330 PRINT FNBRUSH$(RND*255, RND*255, RND*255);\r\n340 REM Set random pen color\r\n350 PRINT FNPEN$(RND*255, RND*255, RND*255);\r\n360 REM Fill and draw rectangle\r\n370 X1 = RND*640: Y1 = RND*480: X2 = RND*640: Y2 = RND*480\r\n380 PRINT FNFILLRECT$(X1, Y1, X2, Y2);\r\n390 PRINT FNRECT$(X1, Y1, X2, Y2);\r\n400 NEXT I\r\n410 FOR I = 0 TO 120: PRINT FNSCROLL$(4, -4);: NEXT I\r\n420 REM\r\n430 REM ** FILLED ELLIPSES **\r\n440 FOR I = 0 TO 50\r\n450 REM Set random brush color\r\n460 PRINT FNBRUSH$(RND*255, RND*255, RND*255);\r\n470 REM Set random pen color\r\n480 PRINT FNPEN$(RND*255, RND*255, RND*255);\r\n490 REM Fill and draw ellipse\r\n500 X = RND*640: Y = RND*480: W = RND*320: H = RND*240\r\n510 PRINT FNFILLELLIPSE$(X, Y, W, H);\r\n520 PRINT FNELLIPSE$(X, Y, W, H);\r\n530 NEXT I\r\n540 FOR I = 0 TO 120: PRINT FNSCROLL$(-4, -4);: NEXT I\r\n550 REM\r\n560 REM ** FILLED POLYGONS **\r\n570 FOR I = 0 TO 50\r\n580 REM Set random brush color\r\n590 PRINT FNBRUSH$(RND*255, RND*255, RND*255);\r\n600 REM Set random pen color\r\n610 PRINT FNPEN$(RND*255, RND*255, RND*255);\r\n620 REM Build coordinates\r\n630 C = 3 + INT(RND*4): REM Number of points\r\n640 P$ = &quot;&quot;\r\n650 FOR J = 1 TO C\r\n660 X = INT(RND*640): Y = INT(RND*480)\r\n670 P$ = P$ + STR$(X) + &quot;;&quot; + STR$(Y)\r\n680 IF J &lt; C THEN P$ = P$ + &quot;;&quot;\r\n690 NEXT J\r\n700 REM Fill and draw path\r\n710 PRINT FNFILLPATH$(P$);\r\n720 PRINT FNPATH$(P$);\r\n730 NEXT I\r\n740 FOR I = 0 TO 120: PRINT FNSCROLL$(-4, 0);: NEXT I\r\n750 REM Clear screen, clear terminal and enable cursor\r\n760 PRINT FNCLR$;FNCLRTERM$;FNCURSORON$;\r\n765 WIDTH 80\r\n770 END\r\n10000 REM\r\n10010 REM ** DEFINE FUNCTIONS **\r\n10020 DEF FNPEN$(R%, G%, B%) = CHR$(27)+&quot;_GPEN&quot;+STR$(R%)+&quot;;&quot;+STR$(G%)+&quot;;&quot;+STR$(B%)+&quot;$&quot;\r\n10030 DEF FNBRUSH$(R%, G%, B%) = CHR$(27)+&quot;_GBRUSH&quot;+STR$(R%)+&quot;;&quot;+STR$(G%)+&quot;;&quot;+STR$(B%)+&quot;$&quot;\r\n10040 DEF FNPIXEL$(X%, Y%) = CHR$(27)+&quot;_GPIXEL&quot;+STR$(X%)+&quot;;&quot;+STR$(Y%)+&quot;$&quot;\r\n10050 DEF FNDRAW$(X1%, Y1%, X2%, Y2%) = CHR$(27)+&quot;_GLINE&quot;+STR$(X1%)+&quot;;&quot;+STR$(Y1%)+&quot;;&quot;+STR$(X2%)+&quot;;&quot;+STR$(Y2%)+&quot;$&quot;\r\n10060 DEF FNRECT$(X1%, Y1%, X2%, Y2%) = CHR$(27)+&quot;_GRECT&quot;+STR$(X1%)+&quot;;&quot;+STR$(Y1%)+&quot;;&quot;+STR$(X2%)+&quot;;&quot;+STR$(Y2%)+&quot;$&quot;\r\n10070 DEF FNFILLRECT$(X1%, Y1%, X2%, Y2%) = CHR$(27)+&quot;_GFILLRECT&quot;+STR$(X1%)+&quot;;&quot;+STR$(Y1%)+&quot;;&quot;+STR$(X2%)+&quot;;&quot;+STR$(Y2%)+&quot;$&quot;\r\n10080 DEF FNELLIPSE$(X%, Y%, W%, H%) = CHR$(27)+&quot;_GELLIPSE&quot;+STR$(X%)+&quot;;&quot;+STR$(Y%)+&quot;;&quot;+STR$(W%)+&quot;;&quot;+STR$(H%)+&quot;$&quot;\r\n10090 DEF FNFILLELLIPSE$(X%, Y%, W%, H%) = CHR$(27)+&quot;_GFILLELLIPSE&quot;+STR$(X%)+&quot;;&quot;+STR$(Y%)+&quot;;&quot;+STR$(W%)+&quot;;&quot;+STR$(H%)+&quot;$&quot;\r\n10110 DEF FNPATH$(POINTS$) = CHR$(27)+&quot;_GPATH&quot;+POINTS$+&quot;$&quot;\r\n10120 DEF FNFILLPATH$(POINTS$) = CHR$(27)+&quot;_GFILLPATH&quot;+POINTS$+&quot;$&quot;\r\n10130 DEF FNSCROLL$(X%, Y%) = CHR$(27)+&quot;_GSCROLL&quot;+STR$(X%)+&quot;;&quot;+STR$(Y%)+&quot;$&quot;\r\n10140 DEF FNCLR$ = CHR$(27)+&quot;_GCLEAR$&quot;\r\n10150 DEF FNCURSORON$ = CHR$(27)+&quot;_E1$&quot;\r\n10160 DEF FNCURSOROFF$ = CHR$(27)+&quot;_E0$&quot;\r\n10170 DEF FNCLRTERM$ = CHR$(27)+&quot;_B$&quot;\r\n10180 RETURN\r\n<\/pre>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_338\" class=\"pvc_stats all  \" data-element-id=\"338\" 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>What is there to write that has not already been written about this project by Fabrizio Di Vittorio https:\/\/github.com\/fdivitto. This terminal, as far as I&#8217;m concerned, is a real HW and SW masterpiece.\u00a0 The processor used is an ESP32 SOC programmed to make a graphic page available to the user.\u00a0The primitive functions made available allow [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_338\" class=\"pvc_stats all  \" data-element-id=\"338\" 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":82,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-338","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/338"}],"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=338"}],"version-history":[{"count":18,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/338\/revisions"}],"predecessor-version":[{"id":393,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/338\/revisions\/393"}],"up":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/82"}],"wp:attachment":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/media?parent=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}