(2023-04-24) (L)VTL as the starting point for LPC-oriented applications ----------------------------------------------------------------------- Today, I released a new version of LVTL, called LVTL-O. It's still portable and under 300 SLOC of C89, but optimized for both execution speed and memory consumption, as well as fixing some critical bugs. So, whoever uses LVTL-A (although I doubt many people have downloaded it over the course of two days), should switch to LVTL-O as a drop-in replacement. The main page at hoi.st no longer offers LVTL-A for download either, only the new LVTL-O version. The new sharball also has some more VTL-2 examples that I found to be working fine after all the bugfixes, including my all-time favorite game, Bulls and Cows. Although, of course, this B&C variant is easier to play because zeros are not allowed anywhere in the number. By the way, why did I find Bulls and Cows so amusing and why does this particular game bear a special meaning when it's run on VTL? Well, because it's the first game I encountered that doesn't need any real-time interface. It's a challenge-response type game. You send a four-digit challenge and receive a two-digit response. In fact, some time ago, I coded up a JS function version of this game where you pass your digits as a hexadecimal BCD number (e.g. if your guess is 1234, you pass 0x1234) and receive the response in the format BxCy, e.g. B3C1 for 3 bulls and 1 cow. And the entire game "interface" was just a function call (and another call to reinitalize it). You can wrap it into anything: graphics, text, voice, radioteletype, Morse code... Imagine playing Bulls and Cows over Morse. That's something you can't do with Tetris. So, why is it significant that we can run B&C in VTL? Because VTL itself is fully line-oriented, and all program editing flow is designed in a challenge-response fashion. In fact, it was designed with teletypes in mind, because not every computer hobbyist in the late 1970s could afford CRT displays, not to mention full-featured terminals. Home PCs with TV adapters that allowed to use home TV sets as displays would only appear a bit later, in the early 1980s. And, as even Tiny BASIC was so verbose it's a bit unfair to call it "Tiny", VTL allowed its users to save keystrokes, paper tape and teletype ink. Speaking of paper tape... I don't actually know if the original design of VTL was to also be fully compatible with the 5-bit ITA-2 code, also known as Baudot-Murray code, in its US variant, but it's quite close to that. The only exception is that ITA-2 doesn't have a character for a percent sign (%) and * (asterisk), so, as far as I understand, the bell character (S in FIGS mode, for US variant) is used instead of the latter, and we can extend the encoding by adding % as FIGS+CR or something. So, ideally, a "5-bit" version of VTL only uses these characters: Bits Letters Figures ----- ------- ------- 00000 null 00100 space 10111 Q 1 10011 W 2 00001 E 3 01010 R 4 10000 T 5 10101 Y 6 00111 U 7 00110 I 8 11000 O 9 10110 P 0 00011 A - 00101 S * 01001 D $ 01101 F ! 11010 G & 10100 H # 01011 J ' 01111 K ( 10010 L ) 10001 Z " 11101 X / 01110 C : 11110 V ; 11001 B ? 01100 N , 11100 M . 01000 CR % 00010 LF 11011 Shift to figures 11111 Shift to letters And, indeed, the original VTL-2 for Altairs only used these characters + the percent sign, while LVTL extends the range of variables to most lowercase letters (except xyz) and some special characters like @[\]^_`, as well as introduces three new bitwise operators - &, | and ^, two of which are not present in the ITA-2 set. Well, as the precedent of using * as both a system variable name and an operator was set by the original VTL-2, and & is also used both as a sysvar and as an "and" operator in LVTL already, nothing prevents us from aliasing | with ! for "or" and ^ with # for "xor". And this is what I also have done in LVTL-O as one of the improvements. As long as we only use all-capital letters and strings, we can write LVTL programs that still can be ITA-2-encoded and punched onto a 5-hole tape (provided we also have encoded % as something like FIGS + CR). Now, where do we go from here? I'm planning to create a somewhat restricted subset of LVTL: with only 26 uppercase letters and only ITA-2 characters + percent sign (so ! and # operators will be the only versions of | and ^), also without interactive input evaluation, and the ? sysvar in this version will only accept integers, like in VTL02sg. This restricted version also will have a reference implementation in C89 (based on the cut-down LVTL-O code, of course), but then I'll try porting it to some other runtimes. Which ones, is a story for another time. --- Luxferre ---