          ---[]----- -------- ---[]----- -------- ---[]----









                                BASIC+













                     The POWER of machine code

                             from BASIC

                        Over 40 NEW Commands









      D.D.S.



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    1



Below is a list of all the new commands and their uses.

NB.All the new instructions are preceded by '!', and they may be

typed in upper or lower case.



Toolkit Functions

The following commands are not the most comprehensive of

routines, they have been included to help you in the development

of your programs but have been kept brief, to save memory.

!RENUM x,y      Renumbers the whole program. The first new

                number is x and the following numbers are

                increments of y. Does not renumber GOTO etc

                eg !RENUM 100,10

                changes

                10 PLOT 80,80: GOSUB 100

                14 BEEP 1,1

                16 STOP

                105 DRAW 50,50,4000

                108 RETURN

                TO:-

                100 PLOT 80,80: GOSUB 100

                110 BEEP 1,1

                120 STOP

                130 DRAW 50,50,4000

                140 RETURN

!DELETE x,y     Deletes all the lines, starting at line x and

                upto line y.

                Using the above example (after  !RENUM)  !DELETE

                110,130 , would leave you with:-

                100 PLOT 80,80: GOSUB 100

                140 RETURN

!DISPLAY x      Display the contents of memory in decimal, ASCII

                and hexadecimal starting from x. It will print

                20 lines then pause pressing any key will

                display the next 20. Space key exits.

!REMOVER        Removes all the REM statements from the whole

                program. It will also remove  the  rest  of  the

                line behind the REM command, if REM is the first

                command then it will remove the whole line.

                eg !REMOVER will change:-

                10 PRINT "hello":REM intro

                20 REM in the next line is CHR$ 234

                30 PRINT "no more REM"

                To:-

                10 PRINT "hello"

                30 PRINT "no more REM"



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    2



General functions

!DOKE x,y       Pokes A number between 0-65535 (y) into two

                consecutive memory locations at x.

                eg to change the UDGS to start from 30000

                !DOKE 23675,30000

                It is stored in the standard zilog format of

                (x)=low order byte (x+1)=high order byte

                so PEEK 23675=48 and peek 23676=117

                (48+(117*256))=30000

!DEEK x         Double peeks and prints the contents of location

                x. If you have folloed the above example then

                !DEEK 23675 will print 30000

!MOVE x TO y,z  This moves a block of code from x to y length=z.

                This is a very fast and powerful routine.

                To save and recall screens:-

                10 PLOT 60,70: DRAW 95,95,4000

                20 !MOVE 16384 TO 40000,6912: CLS

                30 PAUSE 0: !MOVE 40000 TO 16384,6912

                To fill a block of memory:-

                10 INPUT "pick a number between 0-255 ";n

                20 POKE 16384,n

                30 !MOVE 16384 TO 16385,255

                40 GOTO 10

!ONERROR x      When an error occurs eg BREAK or OUT OF SCREEN

                the program stops what it is doing and jumps to

                line number x. If x=0 then it doesn't jump to

                any line it just carries on with the program.

                This will stop anyone BREAKing into the program.

                To reinable break make x greater than 9999

                eg !ONERROR 0      ;to disable the break key

                   !ONERROR 40000  ;back to normal

!NOISE x        Generates a white noise sound for length x, this

                is normally used for explosion effects.

!SOUND x,y      This calls the ROM sound routine. It can produce

                a wider range of sounds than the beep statement

                eg: FOR a=10 TO 100:!SOUND a,5: NEXT a

                The rough guide is x=sound and y=duration

                If you wish to create an exact note, (frequency;

                =f), use the following formula:

                x=437500/f-30 and y=time*f

                The frequency of a note can be found from a beep

                command with - 261.6*2^(BEEP!2)

!FILL x,y       This command was sadly missing from the spectrum

                It will fill in, an enclosed shape where x and y

                are co-ordinates inside the shape. It will fill

          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    3

                in the bottom two lines aswell.

                x=0-255 (across) y=0-191 (down) 0=top of screen

                eg: CIRCLE 80,80,79: !FILL 80,80



Window Commands

The following commands all work through 'WINDOWS'. For those who

don't know what a window is (in computing terms, at least) then

I shall explain. Imagine infront of you is a large white wall.

Now imagine you have a window in the middle of the wall. Through

the window the world looks different the sky is blue, while your

wall is white. Night comes, the window is now black but the wall

remains white. A man walks by appearing at one side of the

window and disappearing at the other side. Now if you think of

the TV screen as the wall, we can knock holes into it to create

our own windows. These windows can then change while the rest of

the screen remains the same.



With BASIC+ you can have a maximum of 16 windows which can be

any size from the whole screen to a single character square, and

can start at any position on the screen, including the bottom

two lines.



!WINDOW w AT x,y,d,a   Define a window number w starting at x,y

                and down the screen d lines, and width a.

                x can be between 0-23, eg to set window 1 to be

                the whole screen - !WINDOW 1 AT 0,0,23,31

                NB. Windows can overlap each other though this

                will lead to problems when changing the contents

                Once defined the window will remain the same

                untill you redefine it with another !WINDOW

                command

!CLS w          This clears the screen contents of window w.

!CFILL w,x      This will fill window W with ASCII character x

                NB. !CFILL 3,144 - will fill window 3 with the

                graphic USR "A"

!ATTR w TO i,p  Change the ATTRibutes of window w to INK i,

                PAPER p. i and p must be in the range 0-7

                The Window will change to these colours straight

                away and whenever cleared with !CLS w

!FADE w         A random number of pixels will be removed from

                window w. This command needs to called

                repeatedly to clear the whole window.

!SCROLL L w     Scroll window w either Left,

!SCROLL R w                            Right,

!SCROLL U w                            Up,

!SCROLL D w                         or Down by one pixel.

                NB.see !WDATA



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    4

!WRAP L w       This scrolls window w either L,R,U or d by one

!WRAP R w       pixel and anything that going off the side

!WRAP U w       reappears on the opposite side.

!WRAP D w



!CSROLL L w     This scrolls window w for a whole character

!CSROLL R w     square, either L,R,U or D.

!CSROLL U w     NB. see !WDATA

!CSROLL D w



!CWRAP L w      This scrolls window w either L,R,U or D by one

!CWRAP R w      character square, and anything going off the

!CWRAP U w      side reappears on the opposite side.

!CWRAP D w



!WDATA w,x      When a window is scrolled the edge it is removed

                from is replaced with 0 bytes or pixels, however

                you can decide to alter this so it is replaced

                with any bit pattern eg x=255 will leave a solid

                black line while x=170 will leave lines.

                Eg: !WINDOW 0 AT 1,1,4,4

                       !WDATA  0,255

                       FOR a=0 to 32: !SCROLL R0: NEXT a

                

Sprite Commands

Finally there are 16 Hi-resolution, animated sprites in colour.

It should be noted that unlike many sprite routines these are

not operated by interrupts. This at first may seem to be a

disadvantage. However interrupt driven software tends to create

more problems than it solves. An interrupt occurs 50 times every

second. The computer then searches through every sprite to see

if it needs to move,  more often than not it doesn't which means

that the program is wasting time, slowing the game down. It

makes more sense to tell the sprites to move when you want them

to move. This approach also allows you more control on the game.

You move your man, then the aliens move, then you move etc. With

interrupts the aliens might move Twice then you move, then you've

got a long piece of basic and the the aliens might move five

times. it also prevents any hardware problems with joysticks

etc.

!SPRITE         Tells the computer to move any and all the

                sprites that you want to move (see !SINIT).

!SUDG n UDG x1,x2,x3,x4 MOVE f

                Sprite number n should animate between graphic

                number x1 then x2, then x3, then x4, they should

                move between each graphic at speed f: f=0-31 The



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    5

                graphics for the sprites start at USR "A" this

                is normally 65368 but can be altered by !DOKEing

                the new address into 23675  Please don't get the

                sprites numbers mixed up with the UDGS. The

                sprites are four times the size of a normal UDG

                so sprite 1=USR "a" but sprite 2=USE "E". You

                can have upto 255 sprites graphics at one time,

                they just follow on from each other.

!SINIT n AT x,y MOVE f DATA z

                This places sprite number n at position x,y.

                f and z hold data telling the computer how the

                sprite should move. f is the speed at which the

                sprite should move. It is the number of times

                you need to call !SPRITE before the sprite moves

                if f=255 then it will move continuously.

                If z=128 then the sprite will bounce if it hits

                the sides.32 will make it stop and erase itself

                if it hits anything. 8 will make it continue if

                it hits anything. 0 will just make it stop if it

                hits anything.

                x is in the range of 0-175. y=0-239

                A sprite will not move untill after it has been

                placed on the screen with a !SINIT command. If

!SMOVE n STEP x,y MOVE z

                Tells the computer that when it moves sprite

                number n it should step x pixels vertically and

                y pixels horizontally.z is the number of times

                the sprite should move before stopping, 255

                makes it move continuously.

                x and y can be in the range of -8 to +8

!SPUT n AT x,y  This will erase sprite number n from its last

                position and print it at x,y

!SATTR n TO i,p This prints sprite n in INK n and PAPER p,

                whenever it is printed. If this command isn't

                used then the sprite is printed INK 8, PAPER 8

                i and p must be in the range 0-7

!SKILL n        This will stop sprite number n from moving, if

                n=255 then all the sprites will stop.

!CMOVE n CODE s,l

                This command makes the sprite move in a set

                pattern. The pattern it will move is stored in

                memory at s and is l number of moves. For each

                move you must poke 3 bytes. The first two bytes

                show the STEP that the sprite must move from its

                present position the third byte shows the number

                of times it must move in this direction before

                starting the next move (see !SMOVE). After

          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    6

                obaying all the instructions it will repeat them

                again from s.

Unlike many sprite routines which operate on the whole screen,

you can have a limited control over the area in which they move.

You can create a window in which the sprites move. This must

start in the top left hand corner but you can alter the depth of

the screen with !SDEPTH x

(x= 16-191 in hires) and the width with ! SWIDTH x (x=16-255).

This enables you to have the Score, Time ,Fuel etc on screen

without the sprites moving over them.

        ----[##]----[[]]----[##]----[[]]----[##]----[[]]----



  64 Column Display



 This short program lets you print, in 64 columns, any of the 223

 Sinclair characters or 21 User Definable GraphicS (UDGS) on any

 or all of the 24 lines of the screen.

    

  LOADING

 RAMTOP should be lowered by 'CLEAR'ing at any address below

 64558

 eg: CLEAR 64557

 Then type LOAD ""CODE and press ENTER.

 Once LOADED, the program is invoked by calling 'USR 64558'

  PRINTING

 You can now print in 64 Columns by PRINTING through stream 1.

 eg PRINT #1;"hello"

 You can print any of the ASCII codes 32-127 (space to copyright

 symbol) and the keywords (165-255 (RND-COPY)) you can also print

 the block graphics (128-143). The 21 UDGS are stored from 65368

 onwards, but are only 4 bits wide and share the same byte with

 the next UDG, this means that USR "a" and USR "B" are in the

 same 8 bytes.



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    7

  POSITIONING

 You can print on any line using AT, or along the line using TAB.

 These work virtually the same as the sinclair PRINT commands.

 eg PRINT AT 10,55;"here"

 eg PRINT AT 22,40;"and here"

 eg PRINT TAB 33;"tabbed"

 One difference is that the screen automatically SCROLLS when you

 try to type past the bottom screen

 eg PRINT AT 23,10;"A"

 (to prevent scrolling on the bottom line: PRINT AT 23,10;"A"; )

 NB.see POKES for scrolling

  PUNCTUATION

 The normal seperators ,; and ' can be used and work as normal.

  STRINGS

 You can print any length of string which can hold 'hidden'

 control codes for printing colours or positioning text. However

 you can't use pRINT CHR$ .(This will cause a fatal crash!) You

 can easily overcome this by placing CHR$ into a string variable

 first.

 eg. LET a$=CHR$ (214):PRINT #1;a$

 Multiple strings should be seperated by ';' and not by '+'.

 eg PRINT #1;"hello ";a$;" you now owe ";x

  COLOUR and CONTROL CODES

 Unfortunately you can still only have one INK and one PAPER

 colour in each character square. The text can be printed in any

 INK, PAPER, (0-9) with BRIGHT or FLASH with OVER and INVERSE by

 using these commands as normal. The 64 Print routine uses the

 same colours as the normal 32 column print routine. Colour

 control codes can be sent but MUST BE INSIDE strings.

 eg LET a$="ink "+CHR$ 16+CHR$ 5+"cyan": PRINT #1;a$



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    8

You can also send the following codes:-

CHR$ 8 -backspace             CHR$ 13 -new line,

CHR$ 16;CHR$ x -ink,          CHR$ 17;CHR$x -paper,

CHR$ 18;CHR$ x -flash,        CHR$ 19;CHR$ x -bright,

CHR$ 20;CHR$ x -inverse,      CHR$ 21;CHR$ x -over

CHR$ 22;CHR$ r;CHR$ c -at,    CHR$ 23;CHR$ c;CHR$ 0, -tab

 POKES

The following are bytes used by the program. These can be

altered to customise the program to suit your needs.

Bytes Address  Name   Contents

 1     64912   FLAG   Used to remember multiple commands

 1     64913   WIDTH  The width across the screen to which will

                      print, poke 2 to 64 (32 will simulate a

                      normal screen. Half of this is the cosser

                      position. Does not affect TAB and AT.

 2     64914/5 PPOS   The last position printed at in 64 mode.

 2     64916/7 CHARS2 Location of charset-128 (64792)

 1     64918   SCROLS No of lines to scroll,from the bottom of

                      the screen. poke 2-23 for partial scrolls

 1     64919   MASK   Used to mask off unwanted nybble of byte.



The redefined charset is stored after the program from 64920 an

is 440 bytes long this can be altered by poking CHARS2. The 21

UDGS are stored from 65368 onwards which is normally USR "A".



        ----[##]----[[]]----[##]----[[]]----[##]----[[]]----

SPRITE DESIGNER

This program was written to design the sprites  for  BASIC+.  I

does however, have many features which lends itself to a more

general use. The character sets included, were all designed on

this program, and demonstrate how easy it is to quickly design



          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    9

characters, larger graphics can be built up from smaller UDGS.

Little documentation is needed, as the program is run by menus

which are self explanitary.



                [[]]----[##]----[[]]----[##]----[[]]



PRINTER

This is a very versitile program, which i still use alot for my

own use. It is, to the best of my knowledge, the only shaded

dump with a different shade for BRIGHT colours as well as all

the INK and PAPER colours. This gives a better appearance to the

finished picture. The program will no doubt be used mainly for

full screen dumps, though I have often used it for printing

cassette labels and inlays for trial programs. ALL the

instructions that you need are included in the program, which is

run from simple to use menus.

                [##]----[[]]----[##]----[[]]----[##]

SHRINK

This program will compress any section of screen into a

condensed form. The condensed section is then saves to tape or

M/drive. It can be reloaded at any address and will instantly

reprint the section you saved. The position it is reprinted at

can be varied. This will save you more space, say you wanted a

forest scene you need save only one tree but reprint it at five

or six different positions. There are two shrink routines one

tries to condense all the data the second condenses all the 0

and 255 bytes, you can save which ever is the smallest. The best

savings in memory are on the largest screens with alot of

similar patterns on them eg mostly black or white.







          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----    10

                              N O T E S

                             -----------

























          -------- ---[]----- -------- ---[]----- ---------



          ---[]----- -------- ---[]----- -------- ---[]----

                    QUICK GLANCE OPTIONS    

                    T o o l k i t

                    !RENUM start,increment

                    !DISPLAY from

                    !REMOVE

                    G e n e r a l

                    !DOKE address,number

                    !DEEK address

                    !MOVE from TO to,len

                    !ONERROR line

                    !NOISE duration

                    !SOUND duration,sound

                    !FILL across,down

                    W I N D O W S w=window no.

                    !CLS w

                    !CFILL w,CHR$

                    !ATTR w TO ink,paper

                    !FADE w

                    !SCROLL l,w (l,r,u or d)

                    !WRAP l,w

                    !CSCROLL l,w

                    !CWRAP   l,w

                    S p r i t e s

                    !SPRITE

                    !SUDG n UDG a,b,c,d MOVE f

                    !SINIT n AT across,down MOVE turns

                    !SMOVE n STEP across,down MOVE turns

                    !SPUT n AT across,down

                    !SATTR n TO ink,paper

      D.D.S.        !SKILL n

                    !CMOVE n CODE start,turns

          -------- ---[]----- -------- ---[]----- ---------