======== VDKCOM12 ======== VDK key macro overlay file compiler for Eric Meyer's Video Display Editor v2.65 Version 1.2 copyright 1988 by Fred Haines. Released by the author to the CP/M community for all reasonable noncommercial purposes. NEW IN VERSION 1.2 There are no new features in this version - it only incorporates a number of changes in the structure and the code suggested by Rob Friefeld which, along with the elimination of the console report of bytes processed, makes the program run very much faster. See VDKCOM.Z80 for details. NEW IN VERSION 1.1 Making the user type "" or "" to select an option - while it corresponded to what he saw in the K menu of VINST - was unduly tedious, both for him and for me. Changing the option flags to simple lower case "n" and "q" eliminated not just lines of code, but whole subroutines. I have also added a literal character indicator prefix, the slash. If you want to print a carat in a key macro string without causing the next character to become an actual control character, type "/^". To print a single slash, type "//". If you need to start a no-option key macro with lower case "n" or "q", type "/n" or "/q". HOW TO USE VDKCOM VDKCOM compiles an ASCII text file into a *.VDK file of key macros which VINST will install in VDE. It alsos convert an existing VDK file into a text file with the extension VDT. It allows you to create, edit, and re-edit complicated key macros with a full-featured word processor - VDE itself - instead of the backspace-only line editor in VINST. The syntax is: VDKCOM .VDT converts text file to VDK overlay VDKCOM .VDK converts overlay to VDT text file Use VDE in NONDOCUMENT mode to type a file that looks like what you see when you use the K option of VINST, substituting lower case "n" or "q" for the No Repeat and Quiet option indicators and : qThis line would be for key 0 in Quiet mode.^M nThis line would be for key 1 in No Repeat mode.^M This line would be key 3, with key 2 unassigned. n^M^M^M The line above, key 4, prints with two blank lines following it. q"This is in quotes, but no carriage return at the end." "This line is ^P^BMacro Key 7^P^B with embedded boldface codes."^M q^VThis line turns insert on before printing the line.^A^A^A^A_^F^D_^M n ^A^A^A^A ...and so on. Lines correspond to the number keys in 0 to 9 order, with blank lines for unassigned keys. Do NOT embed control codes. Type everything in ASCII. For instance, to underline, type out '^P^Swords underlined^P^S'. It's a good idea to make hard carriage returns visible by toggling them on with the ^OD command. VDKCOM accepts trailing spaces as part of the macro, even though you can't see them, so, if you don't want them, make sure each line is terminated by a hard carriage return. Individual key macro strings may not exceed 127 bytes in the VDK file, though they may in the VDT text file, since ASCII representations of single-byte control codes require two bytes, and option flags and slashes don't contribute to the length of the string. The total of all strings may not exceed 498 output bytes. This is two bytes less than allowed by VDE and VINST, but, under the program's present logic, it would require an inordinate amount of code to make those last two bytes available. If you really need them, add them to the VDK file with ZPATCH or any other patcher, locate the last string-length byte, and add 2 (in hex) to it. For a quick demo, remove the leading spaces from the lines below, mark them as a block, and write them out to .VDT. Run VDKCOM .VDT. Then load the resulting VDK file into VDE with the command VINST VDE .VDK. q^C^C^C^E^E^E^E^E^[^E q^[b^[0^Qs^X^[=^M1^[= 1^S^V ^D^[!0^[1^Qb^B^Ku ^[=^M0^V^I^V^B^G^[![^[0^X ^[=^M0^T^B^N^[0^X q^P^[^P^I^P^K^P^[9 q^V^KrA0:LH.FMT^M q^G^G^G^G^X q^A^A^S q^A^A^S q^KrHEADER^M Key macro 0 measures off one full page if the top margin is 0 and the page length is 58 lines. Adjust for different page lengths by adding or subtracting ^E's. I use this macro to move from line 1 of a page to line 1 of the next page. I then use key macro 9 to read in a page header from a separate file that contains nothing but the properly spaced header text with a # in place of the page number. I search for # with a ^Qf and replace it with the appropriate page numbers. This happens so quickly on my 9 mhz SB180 with hard disk that it is virtually unnoticeable, but there is a faster way to do it. Just make up a header at the top of the first page, or, if you want to start page headers only on page two, at the foot of the file, and mark it as a block. Use key macro 0 to move from the top line of a page to the top line of the next, and copy the header into place with the ^KC command. Don't forget to erase the original of the header at the foot of the file when you get there. Key macro 1 softens and reforms a paragraph by removing the hard carriage returns from the ends of each line. Key macro 2 changes a document in flush left block format (like this one) to indented paragraph form, and key macro 3 changes it back again. Key macro 4 embeds my DIABLO 1610-compatible printer's code for setting a left margin in column 11 (^K=0Bh) in the document. If I want another margin I add or subtract from 0Bh and overwrite the ^K with the appropriate control character. You may well be able to substitute your own printer's set left margin code for this one. Key macro 5 reads in a previously prepared letterhead stored as LH.FMT on drive/user A0. Key macro 6 removes four spaces or characters from the beginning of each line, used to remove line numbers from the beginnings of messages in modem capture files. PROGRAMMER'S NOTE: A VDK file is a data structure four records long. The first two bytes are an ID number which VINST checks to ensure that it is working with the correct version. The current number, 0250h, is valid for several recent versions of VDE. These two bytes are followed by up to ten strings, each preceded by a string-length byte which VDE uses to index the string's location. Each string is limited by the size of a buffer in VDE to 127 bytes. An empty string is indicated by a string-length byte of 00h. After the last byte of the last string, the remainder of the 512 bytes are filled with 00h. It is a peculiarity of VDKCOM that it needs to write two null bytes at the end of the file, which means that it will accept only 498 bytes for the total length of all strings (512, less two ID bytes, less 10 string-length bytes, less these two more) rather than the 500 that VDE and VINST allow. When you look at the key macro buffer of VDE using the K option of VINST, you see something that looks like this: <0>This line would be for key 0 in Quiet mode.^M <1>This line would be for key 1 in No Repeat mode.^M <2><> <3>This line would be key 3, with key 2 unassigned. <4>^M^M^M <5>The line above, key 4, prints with two blank lines following it. <6>"This is in quotes, but no carriage return at the end." <7>"This line is ^P^BMacro Key 7^P^B with embedded boldface codes."^M <8><> <9><> The numbers down the side and the option indicators , , and <> (no option) are supplied by VINST. The VDT text file version of the same macro keys would omit the string numbers and no option indicators, and convert the and to simple lower case 'n' and 'q'. If you need lower case 'n' or 'q' as the first character of a key macro, just precede it with a slash, which will be ignored. VDKCOM recognizes blank lines as unassigned keys. These produce an "error" message when invoked by VDE. VDE recognizes a No Repeat option if the the high bit is set on the first byte of the macro string after the length byte, and a Quiet option if the high bit is set on both of the first two bytes of the string. The translation procedure from text to overlay requires: Enter two-byte ID string 02h 50h in output file. Enter 00h to save a place for a string length byte. Check for "n" or "q" as first three bytes of new string and add 80h to the next byte or next two bytes input as required. Read in the rest of the string byte by byte and output each byte to the output file. If "^" appears in the string, drop it and subtract 40h from next byte to make it into a real control character. If "/" appears, ignore it and print the next character literally. "/^" prints "^" rather than turn the character following the carat into a control code, and "//" prints a single slash. A single input slash is ignored. When the CRLF pair is encountered in the input text file, convert it to a 00h place marker for the length of the next string. Get the number of bytes output in the last string and write it to the position of the string-length byte at the head of the preceding string. When the text file's ^Z EOF is encountered, fill the remainder of the total 512 bytes with 00h and close the files. When converting VDK overlays to VDT text files, the procedure is more or less reversed. VDKCOM converts the string length bytes to CRLF pairs, the control code bytes to two-byte ASCII strings '^c', and finishes off the file when all strings are accounted for by inserting an EOF ^Z. In addition, VDKCOM has error checking for file opening and closing and for individual and overall string length, and it reports activity to keep the user from thinking the program has hung, though the counters on the screen are otherwise meaningless. The structure of the four-sector VDK file in CP/M is so similar to the eight-sector MS/DOS version that you can use VDKCOM, along with a patcher, to create a VDK file for installation in VDE12, the MS/DOS version of VDE. Make up the VDT file as you would for CP/M, then patch the second ID byte from 50h to 60h and add four records of nulls. Fred Haines Glendale Littera RCPM/QBBS 818 956-6164