DLAN - Display Language - for ZX Spectrum 16K/48K by Campbell Systems ================================================= =================== Summary ======= DLAN is a simple but powerful language to generate textual displays using a ZX Spectrum. Its uses range from advertising to education, or just for its own absorbing interest. DLAN commands are entered as REM statements, so that all the facilities of the natural Spectrum editor are available. DLAN itself is pure machine code, invoked using a USR action. The commands are generally interpreted one after another in a cyclic fashion, so that if left to itself DLAN gives a never-ending sequence of effects. A central concept is the WINDOW, defined as any rectangle of whole lines and columns within the 24 x 32 character display. Any number of windows can be defined, overlapping or otherwise. Effects such as text display and scrolling (four directions to choose from) operate Within the currently defined window, leaving the rest of the screen unchanged. Another major feature of DLAN is its repertoire of print styles or fonts, many of them large size and even some with proportional spacing. (i.e. the letters "l","A",”N" can be of different widths in a font.) The 48K version of DLAN has a bigger choice of fonts than the 16K version. DLAN is also a word processor; it maintains a clean left-hand margin when printing text, and minimises word breaks. Thus a professional display of text is possible with the minimum of effort. Command Structure ================= DLAN commands are single letters or symbols, optionally prefixed with a number up to 255 which is a repetition factor. For example, '5' means scroll up 1 line, and '155' means scroll up 15 lines. Most commands are followed by text or parameters. For example, ‘=HELLO’ means print (command is ‘=’ symbol) the phrase "HELLO". And '4SD’ means scroll (command '5') down 4 lines. 'D' is the Down parameter. Commands are entered within Basic REM statements. You can have any number of commands in a REM statement, using semi-colon (;) as a del1m1ter. For example... 20 REM 3=HELLO;4SR;P This prints the word "HELLO" 3 times; scrolls the window 4 columns to the right, and then pauses for 1 second (P) before continuing with the next command. Each command could have written as a separate REM, with identical result. But combining commands into fewer REMs can save space. In general, DLAN interprets commands sequentially, but it also offers a facility equivalent to Basic GOSUB. This allows you to encode a labelled sequence of commands, and execute it from any number of places within the command list. 10 levels of nesting are supported. i.e. you can GOSUB to a sequence which in turn has its own GOSUB calls, etc. The REM statements will normally get automatically renumbered in tens when DLAN USR code is invoked, so insertions are never a problem. Alphabetic DLAN commands, and alphabetic parameters, may be entered in upper case or lower case interchangeably. One more general point : DLAN never stops because of user errors. Instead, it either ignores a bad parameter or command, or takes some default action. You will not make DLAN crash. We will now describe each of the commands fully. W: Define or recall a Window ============================ Wraabbccdd Waabbccdd Wr where 'r' is optional reference letter; you can recall a window defined fully elsewhere just by referring to its letter. Upper case and lower case are differentiated here, and where 'aa' is start screen line (00 = top, 23 = bottom), ‘bb' is number of screen lines (max = 24-aa), ‘cc' is left-most screen column (00 to 31), ‘dd’ is number of screen columns wide (max = 32-cc). Note that when aa, bb etc are less than 10, you must give a leading zero. Before interpreting the first command, DLAN assumes the current window to be the full screen, as if you had started with a command: W00240032; The use of reference letter is highly recommended: you can define all your windows in one REM and then refer to them where needed with the short 'Wr' method. And if a window has to be changed (i.e. you want to define it elsewhere) then there is only one change to make to the DLAN commands. For example, suppose we have a window at line 5 for 6 lines, column 10 for 15 lines, we can define it as: WA05061015; Now, at any place in the DLAN command program, we can recall window "A" just by coding: WA; (or, wA; but not Wa; since the small "a" does not match the big "A".) E: Edge the current window ========================== En where 'n' is a digit 1 to 9 denoting one of 9 styles in which to make a frame around the window currently defined. Further, after making the frame DLAN then shrinks the window by 1 all round, so that the frame is then not affected by subsequent scrolls etc. within the window. (If the window is already too small in one direction, this shrink is suppressed.) Rather than list all the styles, we leave it to you to explore them. Note that the use of repetition factor causes progressive shrinkage, e.g.: 5E8; C: Set Colour ============= Cn; or Cnm; where 'n' and 'm' are colour codes 0-7 as defined on your Spectrum keyboard. The first or only colour code is deemed to be PAPER colour. The second code, if present, is INK colour. It INK colour is not given, it is left unchanged. This command does not have immediate effect, but rather affects subsequent commands such as Fill and Print (q.v.) F: Fill the current window ========================== Fx; or F; where 'x' is the character or graphic which DLAN then fills the window with. If no fill character is given, then the only effect is to repaint the window in whatever are the currently defined colours, as last given via 'C' command. Note that by alternatively filling and changing colour you can get very pleasing effects. And by mixing in colours where INK and PAPER are the same, you can create an on-off flashing effect, as opposed to the FLASH swap-the-colours effect. e.g.: C17;F;C77;F;C17;P The fast way to clear a window is to fill with SPACE character. =: Print text ============= =Any text you like….; This is the way to display text, scrolling upwards from the lowest part of the current window. A fresh line is started for each '=' command. DLAN word-processes to keep the left margin tidy and to minimise word breaks at end of line. Any strings of 2 or more spaces are reduced to a single space. The current type font is used ('T' q.v.) and where appropriate DLAN employs proportional spacing. The use of a repetition factor causes the whole paragraph to be repeated, for example: 5=Hello everybody; produces the effect: Hello everybody Hello everybody Hello everybody Hello everybody Hello everybody (And not: Hello everybodyHello everybody...) The text can include graphic characters and UDGs. But DLAN has five of its own UDGs as follows: UDG graphics Q R and S are styles of grey (try them) UDG graphic T is a colon (:) UDG graphic U is a semi-colon (;) The reason for the last two is that direct semi-colon confuses the Basic editor, and direct colon confuses DLAN! Do not use direct colour code, INV VIDEO, or AT and TAB tokens within your text, because DLAN simply converts these codes into spaces. But this does provide a way to show leading spaces, as in a paragraph start. Try it. By using the 'grey' patterns of UDG graphics Q/R/S with various combinations of PAPER and INK colour, you can get some "new" Spectrum colours. Note especially that although graphic Q and R are almost identical pixel stripes, they give quite different colour effects. <: Print Right-to-1eft ======================