|
Forum Index : Microcontroller and PC projects : New CMM2 apps, Hexen, Curl, and a web browser
| Author | Message | ||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 12322 |
Three new programs come with firmware 8.00.00b7, in its programs zip (CMM2_Programs_8.00.00b7.zip): https://github.com/UKTailwind/CMM2V1.5/releases/tag/v8.00.00b7 Hexen and curl run on every generation; the web browser needs a Generation 2 or 3. The browser and curl use the WiFi module, with OPTION WIFI set so that the Colour Maximite 2 has joined your network (MM.INFO(IP ADDRESS) shows whether it has). Copy each program's folder from the zip to the root of the SD card. The App User Guide in the release has a chapter on each. Hexen Raven Software's Hexen: Beyond Heretic, the third of the games on the Doom engine after Doom and Heretic, through rh1tech's frank-idtech1 (Chocolate Doom's Hexen). It takes about 9 seconds to load. On a Generation 2 it then runs at the game's 35 frames a second (about 31 with its music on). On a Generation 1 its timed demo runs at 88 frames a second with the sound off. Hexen is still sold, so its game data is not in the zip: copy your own hexen.wad, from the CD or the GOG or Steam release, into A:/hexen beside hexen.app. The 4-level demo version of hexen.wad works too. Then: CHDIR "A:/hexen" RUN "hexen.app" A new game starts by choosing the Fighter, the Cleric or the Mage. For the add-on Deathkings of the Dark Citadel, put hexdd.wad there as well and start it with RUN "hexen.app", -file hexdd.wad. • Keys: as Heretic's (the arrows, Ctrl to fire, Space to open, Alt or , and . to strafe), with / to jump, PgUp, Ins and Home to fly, PgDn, Del and End to look, [ and ] to choose an artifact, Enter to use it and Backspace to use one of each. Esc is the menu, with saving and loading. Ctrl-C leaves. • Files: its settings and saved games go in an idtech1 folder in the folder it is started from. Hexen also saves each hub's levels there as you travel between them, so leave room on the card. • So far it has been played with the demo's levels; saving and the hubs' travel with a full hexen.wad have not yet been tried. The web browser Web pages from the internet on the Colour Maximite 2's own screen, with their text, pictures and layout, and links followed with the mouse. It is NetSurf, a browser written for small computers, with the Colour Maximite 2's screen, keyboard, mouse and network. Copy the browser folder from the zip to A:/browser, then: MODE 9,16 RUN "A:/browser/browser.app" The browser draws in the mode the screen is in, which must have 16-bit colour: MODE 9,16 (1024x768), MODE 11,16 (1280x720), or on a Generation 3 MODE 18,16 (1024x600). OPTION DEFAULT MODE 9,16 makes such a mode the default, so the monitor is not switched for every RUN. It opens with mather.host. To go straight to another page: RUN "A:/browser/browser.app", https://en.wikipedia.org/wiki/Maximite • Using it: click a link to follow it; the wheel, the arrow keys and Page Up and Down scroll; the bar at the top has Back, Forward, Stop, Reload and the address (click it, type, Enter). Forms and search boxes work. A link to a file (a zip, a PDF) saves it in A:/downloads. Ctrl-C, or the button at the right of the bar, ends it. • What it draws: pages in HTML and CSS, including the CSS that sites use today (CSS variables, flexible boxes, calc(), clamp()), and pictures in JPEG (progressive too), PNG, GIF, BMP and SVG. JPEG and PNG are decoded by the firmware's own decoders, the ones LOAD JPG and LOAD PNG use. The text is in the DejaVu fonts. • What it does not do: JavaScript. Pages that build themselves with JavaScript show little or nothing, but many sites work well without it: Wikipedia, text.npr.org, lite.cnn.com, gnu.org, and mather.host. No video or sound, no CSS grid, and no rounded corners or shadows. • Speed and memory: on a Generation 3, text.npr.org takes about 6 seconds and a Wikipedia article about 11, its pictures arriving while you read. It has about 20 MB for a page; a bigger one is stopped with a page that says so, and the browser carries on. • HTTPS: sites are checked against the certificate authorities in cacert.pem, and the clock must be right (WEB NTP sets it). • Settings: A:/browser/res/Choices holds the home page (homepage_url) and the text size (font_size, in tenths of a point: 120 is 12 point), one to a line, and the editor can change them. curl The curl that is on almost every other computer, version 8.23.0, with the same options, so the examples you find on the web work here too. It fetches files and pages over HTTP and HTTPS, and sends forms and data to web servers. It needs firmware 8.00.00b2 or later. Copy the curl folder from the zip to A:/curl: it holds curl.app and cacert.pem. The words after RUN's comma are curl's options and the address, as on any other computer, and a word with a space in it goes in double quotes. It can be run from any folder, and a file it saves goes in the current folder unless you give a path. It ends by itself when it has finished; Ctrl-C stops it, in the middle of a transfer or while it prints. Some examples: ' show a page on the screen RUN "A:/curl/curl.app", https://example.com/ ' save it as page.html RUN "A:/curl/curl.app", -o page.html https://example.com/ ' save a file under its own name, data.zip RUN "A:/curl/curl.app", -O https://example.com/files/data.zip ' follow redirections to the file itself RUN "A:/curl/curl.app", -L -O https://example.com/latest ' carry on with a download that was stopped RUN "A:/curl/curl.app", -C - -O https://example.com/files/big.zip ' show only the headers RUN "A:/curl/curl.app", -I https://example.com/ ' send a form (POST) RUN "A:/curl/curl.app", -d "name=Peter&city=Perth" https://example.com/form ' send a file as a form does RUN "A:/curl/curl.app", -F "file=@photo.jpg" https://example.com/upload ' send JSON from a file RUN "A:/curl/curl.app", -H "Content-Type: application/json" -d @data.json https://example.com/api ' log in with a user name and password RUN "A:/curl/curl.app", -u user:password https://example.com/private/ ' keep cookies from one run to the next RUN "A:/curl/curl.app", -c cookies.txt -b cookies.txt https://example.com/ ' quietly (-s, with -S still showing errors), the page sent compressed RUN "A:/curl/curl.app", -sS --compressed -o page.html https://example.com/ Options in a file: a double quote cannot be passed in a word, and a command line can be at most about 250 characters. For anything longer, put the options in a file, one to a line without the leading dashes, made with the editor or written by a program with PRINT #: # A:/fetch.cfg silent show-error header = "User-Agent: Colour Maximite 2" url = "https://example.com/one.txt" output = "one.txt" url = "https://example.com/two.txt" output = "two.txt" RUN "A:/curl/curl.app", -K A:/fetch.cfg Add the line parallel to fetch the files at the same time, which is quicker when there are several. • Help: -h shows the commonest options, --help all lists every one, and --manual shows curl's whole manual (Ctrl-C stops it). • When it fails it says why, and MMBasic gives curl's error code: "A:/curl/curl.app ended with code n". The commonest: 6, the site's name was not found; 7, the site did not answer; 22, the server said no (with -f); 23, the file could not be written (a wrong folder, or the card is full); 28, it took too long; 60, the site's certificate was refused. • Certificates and the clock: an HTTPS site is checked against cacert.pem, beside curl.app or in A:/. With the wrong date every HTTPS site is refused (code 60), and curl says what date it thinks it is: WEB NTP sets the clock. -k turns the checking off, for a home-made certificate on your own network only. cacert.pem goes out of date as authorities come and go, and curl can fetch a new one from the people who make curl. When it has arrived without an error, put it in place of the old one (RENAME will not write over a file that is there): RUN "A:/curl/curl.app", -o A:/curl/cacert.new https://curl.se/ca/cacert.pem KILL "A:/curl/cacert.pem" RENAME "A:/curl/cacert.new" AS "A:/curl/cacert.pem" • Speed: over HTTPS up to about 1 MB a second, less when the WiFi signal is weak; saved to the card, no faster than the card can write. • What it leaves out: FTP and the other protocols (it has HTTP, HTTPS and file: addresses), HTTP/2 and HTTP/3, IPv6, and Brotli and zstd compression (gzip and deflate work). Licences and source Hexen is under the GNU GPL version 2; NetSurf under the GNU GPL version 2, and its libraries under the MIT licence; curl under the curl licence, with Mbed TLS (Apache 2.0) and zlib. Every licence is in the zip's licences folder. The source of each is in the firmware's repository, apps/hexen, apps/browser and apps/curl, with the changes made for the Colour Maximite 2. Please report pages that draw wrongly, or anything else that goes wrong, here. Edited 2026-12-03 23:21 by matherp |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |