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 

======================



          <Any text you like....;



This is the other way to display text, on a 'moving belt' system. After 

an initial scroll of the current window, text is built and scrolled 

right-to-left along the bottom of the window, until the last character 

of text is printed. Any over-run is simply dropped off at the left-hand 

boundary of the window. Word-processing logic is not used except with 

respect to proportional spacing of letters in some fonts.  



S: Scroll the window contents 

=============================



          S; or SU; or SD; or SL; or SR;



The contents of the current window are scrolled by one line or column in 

the direction indicated. To scroll by more lines or columns, use the 

repetition factor, for example: 



          10SR; 



which scrolls 10 columns to the right. 



'S;' by itself is taken to mean 'SU;' (Scroll UP) 



B: Set Border Colour 

====================



          Bn;



where 'n' is colour code 0-7 be1ng the Spectrum code of the colour to 

which the TV screen border is set. The effect is immediate. If no 

'B' command is given, DLAN assumes 3. (Magenta) 



A: Set other Spectrum Attributes 

================================



          A...; 



One or more of the following parameters may be given: 



          B = Bright     D = Dull     F = Flash     S = steady



For example, to set bright and flash: 



          ABF; or AFB; or AF;AB;



DLAN starts off by assuming ABS, i.e. bright and steady. The effect of 

A command is delayed in the same way as C command. 



P: Pause for 1 second 

=====================



          P; (no parameters) 



For longer pauses, use the repetition factor, e.g. to pause 15 seconds: 



          15P;



T: Type Font Select 

===================



          Tn;



DLAN has a repertoire of different print styles and sizes, for use 

with the '=' and < commands. The 16K version of DLAN has four 

styles, selected by T1; T2; T3; T4; respectively - in addition to the 

standard Spectrum font. The 48K version has these plus a further 

seven via codes 5,6,7,8,9,A, B. 



If the Type code is not matched, or if just 'T;' is given, then DLAN 

reverts to standard Spectrum font. 



Most styles have upper case only, and one has lower case only. Any 

text character not matched is replaced with upper/lower case if 

possible to find a match. If this fails, the individual character is 

shown in standard Spectrum font. In the case of the normal-size fonts, 

this may look quite acceptable. 



Some fonts have special proportional spaced letters, especially M and W 

which are wider than the rest, and 1 and i and period which are kept to 

single column width. The full set of fonts is as follows.. 



T1; a very pretty 1 x 1 Serif, upper case only, 0-9, ?.

T2; a clear 2 x 2 Serif, upper case only, 0-9, ?.

T3; a highly decorative modern font in 2 x 2, upper case only, 0-9, ?. 

T4; a magnetic ink style in 1 x 1, upper case only, 0-9, ?. 

T5: a chunky bold 1 x 1, upper case only, 0-9, . 

T6; full character set 2 tall x 1 wide in Sans Serif 

T7; another 2 x 1, upper and lower case, very elegant 

T8; Bold 2 x 1 in upper case only, 0-9, ?. 

T9; beautifully clear 3 x 1 in lower case only, 0-9, ?. 

TA; gracefully-proportioned 3 x 2 Serif, upper case only, 0-9,?. 

TB; strikingly effective 3 x 2 Shadow face, upper case only, 0-9, ?. 



#: Set Command Delay 

====================



          #; (no parameters) 



DLAN waits for about 1/5th second between commands, or between repetitions 

of a command; but you can alter this interval at will to any number of 

TV frames between one and 255 (0-5 seconds) by giving a repetition 

Factor being the number of TV frames. So for the fastest pace, use  

just '#;' and for the slowest pace, use '255#;' Although the individual 

effects, such as scrolling, are at a predetermined pace, the use of # 

affects the overall pace of the sequence of commands. You can change 

pace with as many # commands as you like. DLAN starts off with an 

assumed value of 10 - about 1/5th second. 



^: GOSUB equivalent 

===================



          ^x;



where 'x' is the one-letter label of a DLAN command subroutine. DLAN 

hunts for command of '^x' and transfers its processing to that command 

if found. 'x' may be upper case or lower, and these ARE differentiated. 



*: Subroutine Entry Point

=========================



          *x;



where 'x' is the one-letter label to which a ^ command refers.

You can have labels of any length, but only the first character is

examined by DLAN.



R: Return to ^ caller

=====================



          R;



This is analogous to the Basic RETURN statement. But since DLAN has

no "GOTO" equivalent, you must also use 'R;' to separate your top-

level DLAN commands from any subroutines which follow. In other

words, DLAN restarts at the beginning if there is no ^ corresponding

to an 'R;'.



Notice that DLAN supports up to 10 levels of nesting. This means that

a '*x;' routine can itself also call other routines using '^X:', and

these in turn can call others - up to 10 layers deep.



Another noteworthy aspect of DLAN ^ command is that it can take a

repetition factor. DLAN keeps track of the number of repetitions

at all levels. An interesting application is to use 'nnn^A;R;*A;'

etc. at the beginning, and '....;R;' at the end of the main sequence,

so that DLAN very rarely goes back to the exact beginning. This may

be of use to prevent DLAN's automatic re-definition of windows and

colours at the start of each cycle.



A final note on subroutines: it is easy to forget the 'R;' at the

end of the main sequence. If forgotten, the effect is to have DLAN

drop into the first subroutine, and exit directly back to the start

of the command list. Similar errors happen if 'R;' is omitted at

end of subroutines.



X: Exit to Basic

================



          X;



If you wish to have DLAN exit without having to press the "x" key, this

command will do so. It is provided so that you can merge your own Basic

with DLAN, for example to COPY the screen after adding any extra PRINTs.

Any DLAN commands following an X; command can never be processed.



Programming Tips

================



a) Write and test a little at a time.



b) If your text is not appearing, you probably forgot the '=' in

front of it:



c) For a large job, it can get tedious waiting for the whole sequence

to reach the bit you've just coded. So, temporarily use a '^X;R;'

at the beginning, and '*X;' just in front of the piece being

tested, or some earlier strategic point. You can easily remove

these later.



d) Experiment with all the fonts, edges, colours, etc. and try deliberate

overlap of windows - they can be quite pleasing.



LOAD/SAVE/RUN

=============



There are two versions of DLAN, one for l6K use, the other for 48K use.

They are identical in terms of logic, but the 48K version has more font

tables and loads at a higher RAM address. Your cassette contains the

following:



   Program: DLAN  which contains a sample REM DLAN sequence, and

                  which auto-loads the next component, which is...



   Bytes: DLAN16K which is the machine code for l6K use. This code drives

                  the sample sequence of DLAN commands.



   Bytes: DLAN48K which is the machine code for 48K use. You must load this

                  yourself as advised by the sample program, if you have 48K.



To start with, just LOAD "" the tape and stop (not rewind) when the

example program advises. The example sequence will give further details

about how to proceed with the 48K version.



DLAN machine code must be loaded above a RAMTOP preset with a CLEAR.

So, to make your own DLAN display, first CLEAR 26345 or 50391 (for l6K or

48K respectively), then LOAD "DLAN16K" or "DLAN48K" CODE, and then compose

your REM DLAN statements. Then we suggest you complete your programs with

the following, which include SAVE and auto-LOAD facilities.



l6K:   9990 RANDOMIZE USR 30335: STOP

       9995 SAVE DLAN LINE 9996: SAVE DLANmc CODE 26346,6253: STOP

       9996 CLEAR 26345: LOAD  CODE: RUN 



48K:   9990 RANDOMIZE USR 63103: STOP

       9995 SAVE DLAN LINE 9996: SAVE DLANmc CODE 50392,14976: STOP

       9996 CLEAR 50391: LOAD  CODE: RUN 



To save your complete DLAN program just enter the command: GOTO 9995

Your saved program will now load and execute just with LOAD .



Notice that the important line is 9990 RANDOMIZE USR xxxxx, which passes

control to DLAN. Since this is the first non-REM line, and there are no

preset variables, you can conveniently invoke DLAN just with RUN.



If there are no REM lines at the start of your program, DLAN exits.

Otherwise, it interprets your REM commands until interrupted either

by having "x" key pressed, or by interpreting the "X" command. But one

other key is used: "f will freeze upon completion of the current command,

and one resumes with any key except "x" or "f".



Upon exit via "x" key/command, DLAN will have renumbered your REMS in tens,

and set the program cursor to the current REM. (Only lines below 9990 are

renumbered, hence the choice of line numbers 9990 etc for the permanent use

described above.)



User BASIC

==========



If you wish to add your own BASIC processing - e.g. printing extra titles

or addressees, and COPYing to your printer, we suggest placing a GOTO

instead of the STOP, following the USR function. You will probably also

prefer to use the "X" command rather than using the "x" key. And if the

renumber function gets in your way, you can suppress this by adding 46 to

the USR address. e.g. RANDOMIZE USR 63149 instead of 63103.



DLAN Command Summary

====================



    Command      Meaning                Parameters

    =======      =======                ==========



        A        Attribute              B (Bright)  D (Dull)  F (Flash)  S (Steady)



        B        Screen Border          0-7 colour code



        C        Colour                 p or pi ( paper and ink colours )



        E        Edge and shrink        1-9 edge pattern code

                                        current window



        F        Fill window            Fill character, or space, or if no parameter

                                        then only colours are affected.



        P        Pause for 1 sec.       ( no parameters )



        R        Return from sub-       ( no parameters )

                 routine



        S        Scroll                 U (Up, default)  D (Down)  L (Left)  R (Right)



        T        Type Font Select       1-9,A,B font code, else resume normal

                                        Spectrum font.



        W        Window define or       raabbccdd or aabbccdd or r, where

                 Select                 r  = non-numeric reference label

                                        aa = start screen line

                                        bb = number of screen lines deep

                                        cc = start screen column (leftmost)

                                        dd = number of columns wide



        X        Exit to Basic          ( no parameters )



        =        Print text             Text to be printed, scrolled up from the

                                        bottom of the current window, and using

                                        word processing.



        <        Print text             Text to rolled right-to-left after an

                                        initial up-scroll, in bottom part of

                                        current window.



        ^        Subroutine call        One-character name of subroutine



        *        Subroutine entry       One-character name of subroutine



        #        Tempo control          ( no parameters, but repetition factor is

                                          number of TV frames pause between

                                          commands. )





NOTICE

======



Program DLAN and its manual are the copyright of Campbell Systems, and no

unauthorised duplication of cassette or manual is allowed.



All the special fonts except T6 are created by and are the copyright of

IMAGE SYSTEMS 185 Elm Road, New Malden, KT3 3HX, England.

