VTL-09

VTL-09 (Very Tiny Language for 6809) is a minimal BASIC-inspired programming language. It is based on VTL-2, which was written for the 6800 microprocessor in the MITS 680b computer by Gary Shannon and Frank McCoy in 1977, and fit into exactly 768 bytes of EPROM (three 1702 devices)! Several people have ported VTL-2 to the 6502 processor as VTL02. Patrick McMullen and Carl Warren ported it to the 6809 as VTL-09.

VTL-09 Listing

Carl Warren's book "The MC6809 Cookbook" describes VTL-09. However, many printings of the book omitted the actual source code listing, which fortunately appeared as Appendix E in the copy I purchased in 1983:

   "The MC6809 Cookbook" by carl d. warren
   First Edition, Fourth printing
   Copyright (c) 1980 by TAB BOOKS Inc.

My source listing (see link below) is an exact transcription of Appendix E as found in the book. I entered it exactly as-is, as all capital letters, with all spelling mistakes and other typos, just as found. I don't see how this code could have assembled without errors and actually run as there appear to be numerous typos. Also, the syntax of the assembler source code is different from that used by both 6809 assemblers I use: TSC's ASMB for FLEX, and Microware's ASM for OS-9.

Some examples of the issues I found (with line numbers):

   000046  ORG     0
   000103  DECBUF-1RMB
   000115  PRGM    $               *PROGRAM STARTS HERE
   000119  START   LDU     #STACK  *LOAD THE STACK
   000137          LEAX    3       *BUMP PAST LINE #
   000163  EVIL    CMP B   #":"    *IF : THEN BRANCH
   000197  FIND    LDX     #$PRGM  *FIND LINE#
   000220          PUL A
   000290          STA     1,X+
   000521          BRA     $+2     *SKIP NEXT INSTRUCTION
   000593  LF      LDA     #$0D    *LINE-FEED

Comments:
  46: need to shift columns to right
 103: not sure what was intended
 115: probably should be PRGM EQU * for other assemblers?
 119: why using U instead of S for stack?
 137: probably LEAX 3,X -- maybe was shortcut syntax allowed by their assembler?
 163: probably should be #': for other assemblers
 197: don't think $PRGM is a valid operand
 220: should this be PULU A, or PULS A?
 290: 6809 has no such addressing mode!! should either be 1,X or ,X+
 521: probably should be *+2 for TSC or Microware assembler syntax?
 593: maybe should be $0A?

Work In Progress

I hope to be able to modify the code into a working program. If anyone is interested in helping with this project, please contact me.

On July 1, 2022 John L. sent me his modified version of the VTL-09 source code that fixed several obvious typos and changed the syntax of some of the code to be compatible with the OS-9 and FLEX and lwasm assemblers. He had also found the source code for the 6800 version of VTL-2, and by comparing it to VTL-09 was able to correct some mis-spelled labels.

I then modified the I/O to use 6809 FLEX routines instead of D4BUG routines. The TSC 6809 Mnemonic Assembler for FLEX assembles the revised source code with 0 errors (refer to link below), but the Microware 6809 assembler generates lots of phasing errors. When I run the generated binary under FLEX the "OK" prompt is displayed, and I can enter both direct (no line number) and program (with line number) statements, but it doesn't do anything other than display "OK" again. But I think we're getting closer.

I subsequently found a scanned copy of the user manual for the MEK6809D4 evaluation board, which had (barely) sufficient information on the three I/O routines in the D4BUG monitor ROM that VTL-09 was using. This will help me to determine if my emulated I/O routines are correct, or not. I also found binary images of the two ROMs used by the MEK6809D4, but don't want to spend the effort to disassemble them if I don't need to.

However, I decided to also try another approach: assemble the original 6800 source code for VTL-2 (as fixed by Mike Douglas) with the TSC 6809 assembler (refer to link below). After adding routines that emulate the Altair 680b monitor's I/O routines with calls to FLEX console I/O, VTL-2 came to life on July 7th on 6809 FLEX running under the SWTPCemu 6809 emulator. I also found a copy of the user manual for the Altair 680b PROM Monitor (with complete assembler source code) that will help me design the correct code for the emulated I/O routines for VTL-2.

But VTL-2 on the 6809 runs only slightly better than the modified VTL-09. At least I can now enter and execute several direct statements. But when I enter a few program statements, they won't run, and trying to list them generates pages of gibberish. Often after entering a third program statement, SWTPCemu halts with an invalid opcode error message. Some of these problems might be due to the old version of SWTPCemu (v5.8.1 Build 9) I am running under XP Mode on my Windows 7 computer? The most likely cause of my problems is that there are incompatibilities between some 6800 instructions and their 6809 counterparts. This needs to be investigated in detail, but I haven't had time to do that yet.

This has taken much more time than I had planned, so will have to put this project aside for now. Hopefully someone else will have more success than I have had.

Links

Other

An interesting implementation of a "real" BASIC for the 6809 is Santa Barbara Tiny BASIC (SBTB), by James A. Hinds. It was published in the May 1981 issue of Dr. Dobb's Journal as an 18 page assembler listing. (James Hinds also designed The MILL, a 6809 plug-in card for the Apple ][ computer.) The executable is only approx. 1.6KB (slightly more than twice the size of VTL-2). Someone has actually put in the effort to transcribe that source code (SBTB.txt), and modified it to use FLEX input and output routines. (Note: Len K. found several TAB characters in the source code that need to be replaced with space characters in order for the TSC assembler to accept it.) You can also watch a short video showing it in operation.


Use the Reload/Refresh button in your web browser (or Ctrl+F5 or Shift+Reload) to ensure you get the latest version of this page.
Last revised 2022-Nov-27 13:43 PST.
Copyright 2022 David C. Wiens.


Home   Other 6809   Contact   Site mapNo JavaScript!