The A&F Utilikit

Fitting The Utilikit

The utilikit is supplied in a 4K EPROM which plugs into the utility ROM socket on the Atom's circuit board. Take care not to touch the metal pins when handling the EPROM since static electricity may cause it damage.

Unplug the Atom and unscrew its base. In the centre of the circuit board is a 24-pin socket marked IC24. The Utilikit fits into this socket and the end with the semi-circular cut-out must face the aluminium heat sink.

Make sure that none of the pins become bent and that they are all secure in the socket and that the EPROM is the right way round before replacing the base of the Atom.

Plug the Atom back in and enter LINK #AF00 (or LINK 44800).

The message "(C) A&F 1982" should appear on the screen.

The Utilikit is now ready for use.

Instructions for use

No floating point ROM fitted

When you switch on the machine you must enter LINK #AF00 (or LINK 44800) to switch on the Utilikit. The message "(C) A&F 1982" will be printed.

Every time you press the BREAK key, all the Utilikit commands are disabled and you need to LINK #AF00 to restore them.

Floating point ROM fitted

Every time you switch on your machine, all the Utilikit commands will be available to you without having to LINK #AF00, but none of the 'features' will be available.

The COLD (=cold start when the Atom has just been plugged in) and WARM (= warm start after BREAK has been pressed) are designed to switch these facilities on for you.

These commands are equivalent to LINK #AF00 and LINK #AF25 respectively. See the appropriate headings in the following section for a description.

Features

When the Utilikit has been switched on with a LINK #AF00 (or with a COLD or WARM command, if you have a floating point ROM fitted) the following features are available. These are switched off whenever BREAK is pressed.

Visible Loading and Saving

Each byte of information sent or received from the cassette player is displayed at the top right of the screen. This applies to both fast (1200 baud) or slow (300 baud) COS.

Beep after Loading and Saving

When a program has finished loading or saving, there will be three short beeps.

Auto repeat on all keys

Any key which is held down for more than 25 sixtieths of a second (except for the LOCK or BREAK keys). The keys will then normally repeat every 5 sixtieths of a second, but this speed can be changed by altering the number in location #42 (decimal 66). For example, ?66=8 will make the keys repeat every 8 sixtieths of a second. To disable this facility, enter ?66= -1. If the repeat key is held down the keys will repeat even faster which speeds up editing considerably once you are used to it .

Extended input buffer

Allows lines of up to 208 characters to be entered and edited. If you are short of memory space, you may compress three normal length lines onto one extra-long line.

Error Handler

Whenever there is an error, the error number is given and the line in which the error occurred is listed. The Utilikit adds no more error numbers but uses the same ones as the Atom normally does.

Commands

AT X,Y

Puts the cursor at screen co-ordinates X and X, where X is the line number (0-15) and X is the column number (0-31).

CLR X,Y

Sets all the integer variables, from X to Y inclusive, to zero. CLR by itself sets all the integer variables to zero.

KEY X

Sets X to the ASCII value of whichever key may be pressed at the time, or if no key is pressed then X will be zero. Try this example:

DO DO KEY A; UNTIL A; PRINT A; TONE (A%84),4; UNTIL 0

ON ERROR

When an error occurs in a program and this statement has been used, the program will continue with whatever follows the ON ERROR statement.

ON ESC

The same as ON ERROR but control will return to the statement after the ON ESC when the ESCAPE key is pressed. This allows you to use the ESCAPE key as a simple function key in a program. If the control key is pressed at the same time as ESCAPE then you will escape from the program as usual.

ESC OFF

This is used to disable the ON ESC command. It should be used before ending a program (otherwise an END is treated as an ESCAPE).

DATA

This statement is used with RESTORE and READ to store information in a program. DATA statements must be on separate lines and the items of information should be separated by commas.

RESTORE (X)

This command is used to set up the data pointer for the READ statement. X may be a line number, a label or an expression (like the Atom's GOTO or GOSUB). If X is omitted he program will be searched for the first DATA statement (there will be an ERROR 127 if none is found) and the data pointer will be restored to that line.

READ X (,Y,Z..)

Reads in a number, expression or string at the current position of the data pointer. X may be a string, an integer variable or an array element. Here is an example:

 10 DIM DD(2),S(10)
 20 FOR N =1 TO 2
 30 RESTORE (100+N)
 40 READ X,DD(N),$S
 50 PRINT X,DD(N),$S
 60 NEXT N
 70 END
101 DATA 3,-99,3.14159
102 DATA 10*N,ABS RND %7,END

TONE X,Y

Produces a note of pitch X and duration Y played through the Atom loudspeaker. X ranges from 0 to 83, corresponding roughly to seven octaves on a normal piano keyboard (i.e. 0 corresponds to bottom A, 12 to A an octave higher, etc, middle C is 39) Y ranges from 0 to 255.

VAR #

Variable dump. Displays integer variables from A to Z. VAR# will print the variables in hexadecimal.

/LIST (X)

Controlled list. Lists the program from line X , or from the beginning if X is omitted.

The listing may be halted at any time by pressing the space bar and one line may be listed at a time by repeatedly holding done the space bar and releasing it, line by line. A quick (especially quick if the program lines are short) tap on the space bar will set it off listing continuously again.

If on of the alphabetic keys is pressed followed by the space bar, the listing will continue in the opposite direction. When either end of the program is reached the direction is changed automatically without having to press an alphabet key. Press ESCAPE to stop.

HEX X

The contents of the bytes in memory at address X are printed out in hexadecimal together with the ASCII equivalents. The listing may be stopped and restarted by pressing the space bar.

DIS X

Disassemble from address X. The disassembled listing is formatted as follows. Address in hexadecimal at left, followed by the opcode and the mnemonics for that instruction. On the right is a comments column, which shows the ASCII equivalents of the bytes being disassembled. Where there is a branch or jump, the instruction at the address branched or jumped to is also disassembled on the same line and the comments column is omitted. The following key may be used to control the disassembler.

Space Bar: pauses until an alphanumeric key is pressed. As with /LIST it is possible to list one line at a time.

S: start. Disassembly continues from whichever address is entered

after the FROM? prompt.

A: Again. Starts disassembly again from the last address entered.

J: Jump. The listing pauses while the cursor is moved about the screen using the cursor control keys.. The cursor should be positioned over the first character of the address you want to jump to, then when any other key is pressed the disassembler will continue from that

address as if it had been typed in hex.

If the cursor is pointed to the opening bracket of, for example, a JMP (0208) instruction the disassembly will continue from the address pointed to by address in locations #0208 and #0209, i.e. from #FE52 in this instance.

R: Return. Returns the disassembler to the address jump to or started from. Whenever A: Again, J: Jump or R-Return is used, the disassembler's stack of stored addresses is displayed. Return takes you back to the nearest (leftmost) of these addresses.

H: Hex. Turns the output to hex dump.

D: Dis. Turns hex output back into disassembly.

CTRL or CTRL : Any of the Atom's (or your own ) control codes may be used, e.g. CTRL-0 to disable page mode r CTRL-B to disable the printer.

ESCAPE: As expected.

FAST

Sets the cassette operating system to 1200 baud. Done automatically when LINK #AF00 or COLD is used.

SLOW

Sets the cassette operating system to 300 baud (with visible loading and saving).

COLD

For people with floating point ROMs to initialise the Utilikit. It enables the Utilikit features, sets auto-repeat to 5 sixtieths of a second, and puts you in FAST COS.

WARM

Like COLD, but: WARM will not work if the Atom has just powered up. The copyright message is not displayed. Auto-repeat speed is not set.

Locations #220 and #221 are not initialised to enable FAST COS. This means that by entering !#220=#E000 the WARM command will subsequently initialise the Atom DOS (if fitted) as well as enabling the Utilikit features. Similarly, !#220=#AE43 will make WARM always put you in SLOW COS instead of FAST COS.

Both WARM and COLD execute an ESC OFF to disable the effect of ON ESC.

AUTO (X) (,Y)

Gives automatic line numbers starting at X in steps of Y.

The default value for both X and Y is 10.

If page mode is off (PRINT $15 or CTRL-O) then you will automatically be given a space (which may be deleted) after each line

number. With page mode on (PRINT $14 or CTRL-N) this space is omitted. Press ESCAPE to finish.

BMOVE (X) ,Y TO Z

Block Move. Lines X to Y inclusive are all moved up or down from their original position in the program to line Z.

REN is then printed and the program may be renumbered (as if REN had been entered) but if ESCAPE is pressed then all the lines moved will be left numbered Z.

If the program is renumbered and some of the GOTOs, GOSUBs or RESTOREs refer to the block of lines that have been moved, take care to check them with the FIND command since they may not renumbered correctly after the move. Labels are not affected.

DEL (X) (,Y)

Block delete from line X to line Y inclusive.

If X is omitted, all lines up to line Y are deleted.

If Y is omitted, all lines from X onward are deleted.

FIND "..." ("...")

Searches the program for occurrences of the string between the first pair of quotes. If you leave a space and define a second string between quotes, the command does a search and replace.

If you use CTRL-I (= PRINT$9) when the string to be found is defined, it will act as a wild card. The character corresponding to the wild card during the search will always be matched. The first character in the string cannot be a wild card.

When a string is found in the program, the appropriate line is listed with the string in inverse video. There will be a pause until a key is pressed.

If the space bar is pressed, the next occurrence (if any) is found and listed.

If S is pressed, then SUB will be printed with whichever string was defined as the replacement string, and this will be substituted in place of the string highlighted on screen. The substitute string may be a null string.

If A is pressed, then AMEND is printed and whatever is entered is inserted in the program in place of the string highlighted on screen.

Pressing RETURN alone will delete the string.

If K is pressed, then KILL is printed and the rest of the line is deleted. This is intended for deleting REM statements.

Pressing ESCAPE escapes from this command.

REN (X) (,Y)

Renumbers the program from line X to Y inclusive. If both X and Y are omitted, the whole program is renumbered with lines starting at line 10 in steps of 10. If X is omitted, all lines up to line Y are renumbered. If Y is omitted, all lines from X onward are renumbered. Unless just RETURN is pressed after REN, you are prompted for START and STEP.

If REN runs out of line numbers (32767 is the maximum) it causes an ERROR 109 (number too big) and the line number given shows how far renumbering would have been able to proceed before this point would have been reached.

If you try to renumber a section of program which would cause the last renumbered line to exceed the following (not renumbered) line number, you will be asked to press C or ESCAPE to continue or escape.

All relevant GOTOs, GOSUBs and RESTOREs are renumbered. Calculated GOTOs etc. will be listed. In page mode, no attempt is made to renumber them. With page mode off, calculated expressions, of the form GOTO (300+X) or RESTORE (50+10*N) where the first number inside the brackets is assumed to be a base address and the rest of the expression an offset, will be renumbered. The rest of the line is untouched and the whole line is listed.

Abbreviations

Commands may be abbreviated as follows.

/LIST (X)	/.
AT
AUTO		AU.
BMOVE		BM.
CLR
COLD
DATA		DA.
DEL
DIS
ESC OFF		ES.
FAST		FA.
FIND
HEX		H.
KEY		K.
ON ERROR	O.
ON ESC	
RESTORE		RES.
READ
REN
SLOW		SL.
TONE		T.
VAR		V.
WARM		W.

Technical Notes

The Utilikit uses no zero-page RAM from #80 to #AD inclusive. Locations #AE and #AF are used for the data pointer and are only used by RESTORE and READ.

Locations #40 and #41 store the address reached by the interpreter when a BRK occurs. The statement in a BASIC program which caused an error should be traceable to just before or after the address in these locations

The Utilikit uses the following page 2 RAM:

Locations #21C and #21D store the address to which the interpreter jumps after the ESCAPE key is pressed. #21D=0 if ON ESC has not been used.

Locations #21E and #21F store the address to which the Utilikit jumps after the BRK key is pressed and none of its own commands have been found. Set to #C9D8 by COLD.

Locations #220 and #221 store the address to which the WARM command jumps. Set to the address of the FAST command by the COLD command.

Machine code programmers should be able to add their own BASIC commands (e.g. high-resolution graphics, printer utilities, memory paging) by altering some of these locations.

If #21E and #21F point to your own command interpreter then you commands will be checked for every time there is an error. If you have a floating point ROM fitted, all your commands should still be available after BREAK since BREAK does not affect these locations (Only COLD does that).

The WARM command might also be re-vectored to initialise your own set of vectors.

Finally, to use the vertical scrolling routine (as in the controlled list) in a BASIC program, you should LINK #AB59.

These notes are copyright A&F Software 1982.