Sr. Developer @easytechgreen

Week of the 06/13/2022 - #24

Contents

tech

  • Hartverdrahtet - 4K demo
  • The Secrets of Monkey Island’s Source Code

Linux Apple II emulator(s)

  • Non-Windows (Linux / Pi) Support #856 - Issue in AppleWin repo related to Linux support
  • SDL version of AppleWin - This is a fork of AppleWin which has an SDL frontend. It works great and the code uses the original AppleWin code so its kept up-to-date. I learned about it from the previous github issue. From the GitHub page: “This is a linux port of AppleWin, that shares 100% of the code of the core emulator and video generation. Audio, UI, scheduling and other peripherals are reimplemented. Number one goal is to stay source compatible with AppleWin, to make git merge a trivial operation. Shared files are modified as a last resort.”
  • Clock Signal - A latency-hating emulator of 8- and 16-bit platforms: the Acorn Electron, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Enterprise 64/128, Commodore Vic-20 and Amiga, MSX 1, Oric 1/Atmos, Sega Master System, Sinclair ZX80/81 and ZX Spectrum. It’s a little hard to setup because the ROMS are not provided.

The Secrets of Monkey Island’s Source Code

Kakimori dip pens

  • Use and care guides - Your treasured tools require care and maintenance to ensure a lifetime of use. We’ll show you how to use and look after your stationery through videos and illustrated guides. While it may seem tedious at first, learning how to maintain your tools is a wonderful way to deepen your connection to them.
  • Kakimori Instagram Profile

Atari 2600 demos

WIFI for a GameBoy

Wifi Gameboy Cartridge

  • There oughta be a WiFi Game Boy cartridge. - Before you waste your time with this article, I should probably make clear what this cartridge can do and, maybe more importantly, what it cannot do. This is a basic 32kiB Game Boy cartridge with an ESP8266 microcontroller to add Wifi capabilities. With this, you can access data from the internet or your local network on your Game Boy or send data from it. Since the ESP8266 can do a lot of preprocessing for the Game Boy, a Twitter client is just as conceivable as a Reddit browser. If you implement one. This is not a generic browser, but you can relatively easily implement services on the ESP8266 and write simple code that is executed on the Game Boy as an interface.

May / June Demo Party releases

Feather Wiki

  • Feather Wiki - Feather Wiki is an app for creating personal non-linear notebooks, databases, and wikis that is entirely self-contained and runs in your browser. The app and all of the content you create using it are stored within the single HTML file generated when you save your wiki. Publishing your content for the world to see is as simple as uploading that file to a web server, and updating is as simple as overwriting the file.

BBS Software

  • MysticBBS - Mystic BBS was conceived around the year 1995 when the author became frustrated by the lack of customization available with Renegade BBS, and first released to the public in late 1997 during a period when many BBS packages were seeing a decline (or a full stop) in development. Mystic is developed from the ground up with all original source code and is intended to be the spiritual successor to both Telegard and Renegade (two of the packages the author used prior to developing Mystic BBS).
  • ENiGMA½ BBS Software - ENiGMA½ is a modern BBS software with a nostalgic flair!. Develop in Node.js. GH page

Static site generators with NO JavaScript

  • Astro - Build fast websites, faster. Astro is a new kind of static site builder for the modern web. Powerful developer experience meets lightweight output. Docs.
  • Qwik - Qwik is a new kind of web framework that can deliver instant loading web applications at any size or complexity. Your sites and apps can boot with less than 1kb of JS (including your code, regardless of complexity), and achieve unheard of performance at scale.

FormKit

More ASCII / ANSI stuff

Here are a couple of new resources, artists and other ASCII/ANSI stuff I looked into:

Logo by Cleaner

Cleaner 1

Evoke 2011 - Cleaner & Sylvao

Cleaner 1

Fluid Promotional

Cleaner 1

1999 Ascii Collection by Cleaner

Cleaner 1

  • Graphics mode in assembly 8086 - This question show how to print ASCII characters / files with assembly into VGA memory. Here’s a small library which initializes the Video and writes a string to the screen:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;GFX mode 13h print librrary ver:1.0
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;txti       init font adress
 ;char       cx=color,al=ASCII,scr:di<=al ;cl=ch => no background
 ;print      scr:di <= ds:si ,cx=color cl=ch => no background
 ;printl     scr:di text after call ,cx=color ...
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 txti:   pusha           ;init font adress
     push es
     mov ax,1130h    ; VGA BIOS - font info
     mov bh,3        ; font 8 x 8 pixels
     int 10h         ; ES:BP returns font address
     mov [cs:fonts],es   ;get font adr
     mov [cs:fonto],bp
     pop es
     popa
     ret
 fonts   dw 0        ; font address for printing ...
 fonto   dw 0
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 char:   pusha       ;cx=color,al=ASCII,scr:di<=al ;cl=ch => no background
     push    ds
     push    es
     push    word 0A000h
     pop es
     sub     ah,ah
     shl     ax,3
     mov     ds,[cs:fonts]
     mov     si,[cs:fonto]
     add     si,ax
     mov     dh,8
 .char0: mov     dl,8
     lodsb
     mov     ah,al
 .char1: mov     al,cl
     rcl     ah,1
     jc  .char2
     mov     al,ch
 .char2: cmp     cl,ch
     jz  .char3
     mov     [es:di],al
 .char3: inc     di
     dec     dl
     jnz     .char1
     add     di,320-8
     dec     dh
     jnz     .char0
     pop es
     pop     ds
     popa
     ret
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 print:  pusha       ;scr:di <= ds:si ,cx=color cl=ch => no background
 .l0:    lodsb
     or  al,al
     jz  .esc
     call    char
     add     di,8
     jmp     short .l0
 .esc:   popa
     ret
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 printl: mov [cs:.dat],si    ;scr:di text after call ,cx=color ...
     pop si
     push    ax
     push    di
     push    ds
     push    cs
     pop ds
 .l0:    lodsb
     or  al,al
     jz  .esc
     call    char
     add     di,8
     jmp     short .l0
 .esc:   pop ds
     pop di
     pop ax
     push    si
     add di,9*320
     mov si,[cs:.dat]
     ret
 .dat:   dw  0
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; end. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

if can be used like so:

 start:
     call txti ; just once at program startup

     mov di,50+320*10
     mov cx,127
     call printl
     db  'SPEKTRA software & hardware',0

     mov di,50+320*30
     mov cx,127
     call printl
     db  'print test',0
  • AnsiGo - AnsiGo is a simple ANSi to PNG converter written in pure Go. It converts files containing ANSi sequences (.ANS) into PNG images.

XBin specification

A good way to distribute ASCII art that can then be loaded in assembly is the XBIN file format. Moebius (and probably most ANSI/ASCII editors) export to .xb which is an easy fileformat to implement. Here I’ve copied the spec from a web page which is no longer online and can only be accessed through the timemachine.

The XBin format is used to save ASCII/ANSI art in a binary format which is closer to the way the image is stored in memory. Basically for each character there are two bytes: the attribute byte and the characater. The XBin format also supports several run length encoding compression schemes which are useful when attributes and/or characters repeat. The specification can be found in the Wayback machine.

Here is a quick summary:

  • An XBIN consists of 4 main parts, a header (required), a palette (optional), a font (optional), and the image data (optional).
  • Header consists of 11 bytes. It can be represented by the following C struct:
typedef struct XB_Header {
   unsigned char   ID[4];     // XBIN
   unsigned char   EofChar;   // Fixed: End of file character (Ctrl-Z, Ascii 26, 1A hex)
   unsigned short  Width;     // Width of the image in character columns.
   unsigned short  Height;    // Height of the image in character rows
   unsigned char   Fontsize;  // Font Size 1 Numeric Number of pixel rows
   unsigned char   Flags;     // Flags
};

The flag specification is the following:

bit 7    Unused
bit 6    Unused
bit 5    Unused
bit 4    512Chars   1: the image is built up out of 512 characters instead of 256
bit 3    NonBlink   1: he image should be shown in non-blink (IceColor) mode.
bit 2    Compress   1: Indicates if the XBin has compressed image data
bit 1    Font       1: Indicates if a font is present
bit 0    Pelette    1: Indicates if a palette is present

Palette.

A palette is only present when the ‘Palette’ bit is set in the Flags field of the XBin header. The palette is built up of 48 bytes, a red, green and blue value (in that order) for each of the 16 colors. Each palette value can range from 0 to 63.

Font

A Font is only present when the ‘Font’ bit is set in the Flags field of the XBin header. For each character (256, or 512 when the ‘512Chars’ bit is set in the Flags field) FontSize bytes are stored in sequence. The character set is defined from the top row of each character matrix to the bottom row. In a 16 pixel high font, the first 16 bytes are the fontmatrix for ascii value 0, the next 16 are for ascii 1 and so on. In total, a 16 pixel font would have a font of 4096 bytes (16*256). Technically, the biggest font possible would be 16Kb in size. (32 pixels high, 512 characters), and the smallest would be 256 bytes (1 pixel high, 256 characters).

Image data

The image data is a raw image of video memory. Each character consists of 2 bytes, the first being the character, the second being the attribute (color). The size of the image data would thus be equal to WidthHeight2. Unless the ‘Compress’ bit is set in the Flags field, image data is stored in the exact way you would need it in video memory. When the ‘Compress’ bit is set, image data is compressed with XBin-Compression. This is a fairly simple compression system, which should pose no real difficulty to decompress.

Compression

  • The XBin compression uses a slightly improved Run-Length Encoding scheme
  • Aa,Ab,Ac,Ba,Bb,Bc,De,Zx,Yu This string represents a part of the uncompressed data. The capital letters are character bytes, the lower case letters are attribute bytes.
  • The XBin compression consists of a sequence of repeat counters followed by the appropriate number of data bytes.
  • XBin compression works on a ROW by ROW basis. The compression does NOT carry through to the next line.
  • The repeat counter byte is split up in two parts, the two most significant bits are the compression type, the six least significant bits are the actual repeat counter.
  • The two most significant bits specify the type of compression: 00 - no compression, 01 - character compression, 10 - attribute compression and 11 - both attribute and character compression
  • The six least significant bits specify the repeat: 000000 means repeat once, 000001 means repeat twicet, etc
  • Lets see some examples:
    • [00,6]aabbcdddeeffgg decompresses to: aabbcdddeeffgg
    • [01,6]Aabcdefg decompresses to: AaAbAcAdAeAfAg
    • [10,6]aBCDEFG decompresses to: AaBaCaDaEaFaGa
    • [11,6]Aa decompresses to: AaAaAaAaAaAaAa

Hartverdrahtet - 4K demo

Tools

“The author, Demoscene Passivist, says the demo took around two months to complete and used a number of tools to keep the final product within the 4,096-byte limit, including a code compressor, Shade Minifier, and 4klang, the minimalist software synthesizer used to compose the music.”

  • Shader Minifier - Shader Minifier is a tool to pack HLSL or GLSL shader code. You can use it to make nice 4k PC-demos (such as this one) or to obfuscate your shader code in your next video game (don’t forget there are tools to intercept and display your shader code while your application is running). It generates a code as small as possible that is equivalent to the input code. The generated code is also designed to compress well, and has been optimized for use with Crinkler, but should perform well with any other compression tool. Shader Minifier generates a C header file you can include from your code. This file contains the shader code in a compact string and macros to retrieve the name of the uniforms (because they are renamed).
  • 4klang - Alcatraz Software Synthesizer - 4klang is a modular software synthesizer package intended to easily produce music for 4k intros. It consists of a VSTi plugin example songs/instruments as well as an example C project showing how to include it in your code. Or if you dare to compile it yourself also the source code for the synth core and VSTi plugin. 4klang was developed by Dominik ´Gopher´ Ries and Paul ´pOWL´ Kraus of Alcatraz.

From the ShaderToy code:

/**
 **   __ __|_  ___________________________________________________________________________  ___|__ __
 **  //    /\                                           _                                  /\    \\  
 ** //____/  \__     __ _____ _____ _____ _____ _____  | |     __ _____ _____ __        __/  \____\\ 
 **  \    \  / /  __|  |     |   __|  _  |     |  _  | | |  __|  |     |   __|  |      /\ \  /    /  
 **   \____\/_/  |  |  |  |  |  |  |     | | | |   __| | | |  |  |  |  |  |  |  |__   "  \_\/____/   
 **  /\    \     |_____|_____|_____|__|__|_|_|_|__|    | | |_____|_____|_____|_____|  _  /    /\     
 ** /  \____\                       http://jogamp.org  |_|                              /____/  \    
 ** \  /   "' _________________________________________________________________________ `"   \  /    
 **  \/____.                                                                             .____\/     
 **
 ** JOGL2 port of my PC 4k intro competition entry for Revision 2012. This is the raymarching fragment
 ** shader that is rendered to a fullscreen billboard. The shader basically encapsulates a 
 ** sphere-tracing based raymarcher for a single fractal formula with camera handling. The different 
 ** intro parts are all parameter and camera position variations of the same fractal.
 **
 ** This is the 'normal', unminified version I used during development.
 **
 ** Papers and articles you should be familiar with before trying to understand the code:
 **
 ** Distance rendering for fractals: http://www.iquilezles.org/www/articles/distancefractals/distancefractals.htm
 ** Ambient occlusion techniques: http://www.iquilezles.org/www/articles/ao/ao.htm
 ** Sphere tracing: A geometric method for the antialiased ray tracing of implicit surfaces: http://graphics.cs.uiuc.edu/~jch/papers/zeno.pdf
 ** Rendering fractals with distance estimation function: http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
 **
 ** For an impression how this routine looks like see here: http://www.youtube.com/watch?v=UjgRGDhgehA
 ** Original release from the Revision 2012 can be found here: http://www.pouet.net/prod.php?which=59086
 **/