Table of Contents

Firmware routines & explanations

SOFT968 Cover (picture by Nich Campbell) Bruce Godden and Paul Overell, Locomotive Software
David Radisic, Amstrad

Published by
Amstrad Consumer Electronics plc
Brentwood House
169 Kings Road
Brentwood Essex

All rights reserved
First edition 1986

Reproduction or translation of any part of this publication without the written permission of the copyright owner is unlawful (woops).

Amstrad and Locomotive Software reserve the right to amend or alter the specification without notice. While every effort has been made to verify that this complex software works as described, it is not possible to test any program of this complexity under all possible conditions. Therefore the program and this manual are provided “as is” without warranty of any kind, either express or implied.

IBM is a trademark of International Business Machines Corporation.
CP/M, CP/M Plus and Dr Logo are trademarks of Digital Research Inc.

SOFT 968 Copyright © 1986 Locomotive Software Ltd. and Amstrad Consumer Electronics plc

I'm missing a few chapters of SOFT968. If you own a full copy, or an original, I would be happy if you could send me the missing parts (as scans, pdf, ascii or whatever) :

  • Chapters 1, 2, 14 and 15.
  • Appendix I, II, III, VI, VIII and XII.

Preface

The computers in the CPC range contain ROMs which hold the BASIC interpreter and the ‘firmware’. The firmware consists of low level routines responsible for driving the hardware, handling the screen, handling real-time events and other similar functions.
This manual describes the firmware.

This manual is applicable to the full range of CPC machines; 464, 664, 6128 and 464+DDI-1. The firmware in these machines is not identical. All 464s contain V1.0 of the firmware, all 664s contain V1.1 and all 6128s contain V1.2. All firmware calls are upwards compatible, that is, any firmware call available in V1.0 is available in V1.1 and V1.2 and any firmware call available in V1.1 is available in V1.2. Upwards compatibility will be maintained in any future versions of the firmware.

As stated above this manual relates only to the firmware section of the ROMs. Other AMSOFT publications describe the BASIC interpreter (though not at a system level) and the various implementations of CP/M. However, the areas in which CP/M and the firmware interact are covered in this manual. Also, areas of the firmware that are affected by the addition of a disc interface are covered in this manual.

3 The Keyboard

The Key Manager is the pack associated with the keyboard. All the attributes of the keyboard are generated and controlled by the Key Manager. These attributes include repeat speed, shift and control keys, function keys and key translation. The joysticks are also scanned by the Key Manager.

The Key Manager has three levels of operation. The lowest level scans the keyboard, the middle level converts the key pressings into key values and the top level converts the key values into characters. The user may access the Key Manager at whichever level is most appropriate for a given program. It is usually unwise, however, for a program to mix accesses at different levels.

4 The Text VDU

The Text VDU is a character based screen driver. It controls 8 different streams each of which can have an area of screen allocated to it (a window). The Text VDU allows characters to be written to the screen and read from the screen. It also treats certain 'characters' as 'control codes' which can have various effects, from moving the cursor to setting the colour of an ink.

5 The Graphics VDU

The Graphics VDU allows individual pixels (dots) on the screen to be set or tested and lines to be drawn. The plotting takes place on an ideal screen that is always 640 points wide and 400 points high. This means that more than one point on the ideal screen will map onto a particular pixel on the real screen. The width of the ideal screen (640 points) is chosen to be the horizontal number of pixels on the screen in the highest resolution mode (mode 2). The height of the ideal screen (400 points) is chosen to be twice the vertical number of pixels on the screen in all modes. This ensures that the aspect ratio of the screen is approximately unity, i.e. a circle looks circular and not elliptical.

6 The Screen Pack.

The Screen Pack is used by the Text and Graphics VDUs to access the hardware of the screen. It also controls the features of the screen that affect both the Text VDU and Graphics VDU, such as what mode the screen is in.

7 The Sound Manager.

The Sound Manager deals with the sound chip. It allows various envelopes and sounds to be set up and played under the control of the user. Most of the control is achieved using software rather than the sound chip hardware.

8 The Cassette Manager

The Cassette Manager deals with reading files from and writing files to tape. These operations can either be performed on a character by character basis or on a whole file at once. There is no hardware support for the cassette, even the timing for reading and writing bits is performed by software.

The format of data on the tape is described in great detail. This will only be of academic interest to most users. More general information can be found in sections 8.4 onwards. In the case of V1.1 machines or the CPC464 with a DDI-1 fitted, a |TAPE command will have to be used to access the Tape Operating System.

9 AMSDOS

AMSDOS is a disc operating system used with all the CPC range of computers, of course, in the case of the 464 the DDI-1 has to be fitted. AMSDOS enables programs to be access disc files in a similar manner to cassette files, indeed existing programs which currently use the cassette should be able to use disc files with little or no modification.
The main source of incompatability will be filenames, AMSDOS filenames must conform to CP/M standards but cassette filenames are far less restricted.

AMSDOS has been designed to complement CP/M, not to compete with it. They share the same file structure and can read and write each other's files.

AMSDOS resides in the same ROM as the CP/M BIOS.

10 Expansion ROMs, RSX and RAM Programs

The system can address up to 252 expansion ROMs, mapped over the top 16K of memory, starting at #C000. The Kernel supports two varieties of expansion ROM, foreground and background. A resident system extension (RSX) is similar in use to a background ROM, but must be loaded into RAM before it can be used.

A foreground ROM contains one or more programs, only one of which may be running at one time. The on-board BASIC is the default foreground program. Other possible foreground programs are:

  • other systems, such as FORTH or CP/M.
  • applications, such as a Word Processor or Spread Sheet.
  • tools, such as an Assembler or Debugger.

A RAM program, once loaded, takes over the machine in much the same way as a foreground ROM program. Games will generally be RAM programs.

There may be up to 16 background ROMs, each of which provides some sort of service independent of the foreground program. It is expected that expansion peripherals will each have an associated background ROM containing suitable support routines. Other background ROMs may augment the existing machine software; for example, by providing further graphics functions.

A resident system extension (RSX), once loaded, provides some sort of service in the same way as a background ROM. An RSX might, for example, provide special support for a given printer - where it is more economical to provide the software on cassette rather than in ROM (or PROM).

11 Interrupts

There is only one source of interrupts in an unexpanded CPC (not Plus), namely a regular time interrupt. Expansion boards may generate interrupts, but suitable software must be provided to deal with the extra interrupts.

The system runs with interrupts enabled most of the time. It is inadvisable to disable interrupts for a prolonged period if this is avoidable because the time interrupts will be missed.

A number of firmware routines enable interrupts and this is remarked upon in their descriptions. In particular the kernel routines dealing with ROMs and the restart instructions ( eg. LOW JUMP ) enable interrupts.

12 Events

The event mechanism is primarily provided by the Kernel to support the handling of interrupts and other external events. However, the mechanism may also be used to handle internal events in complicated programs (such as a simulation, for ex ample). An event is characterised by the following:

  • a. Event Class (see section 12.1)
    Events may be synchronous or asynchronous, express or normal.
  • b. Event Priority (see section 12.1)
    Synchronous events have an associated priority.
  • c. Event Count (see section 12.2)
    • Each time an event occurs the count is incremented.
    • Each time an event is processed the count is decremented.
    • The event may be disarmed by setting the count negative.
  • d. Event Routine. (see section 12.3)
    The address of the routine which is called to process the event.

An event appears to the Kernel as a data block containing the above values (see Appendix X for the exact layout of an event block). The block must be in the central 32K bytes of memory, so that the Kernel can access it without worrying about the ROM enable state.

When an event occurs the associated event block is kicked by calling KL EVENT. If the event count is negative, the 'kick' is ignored, otherwise the event count is incremented (up to a maximum of 127) and the event routine will be called at some time in the future - depending on the event class. When the event routine returns the event count is decremented, unless it has been set to zero or negative in the meantime.

13 The Machine Pack

The Machine Pack deals with the low level driving of the hardware. It also talks to the Centronics port (and hence the printer) and is in charge of running 'load and go' programs.

16 The Firmware Indirections

This section gives the detailed entry and exit conditions and effects of the routines in the indirections jumpblock. See section 14.2 for a list of these routines.

The firmware indirections are taken by the firmware at key points. They allow the user to intercept and alter a number of firmware actions without having to provide a complete new firmware package.

The descriptions given are for the default settings of the indirections. Replacement routines need not perform all the actions that the default routine performs although they are advised to do so.

#BDCD - IND : TXT DRAW CURSOR

Place the cursor blob on the screen (if enabled).

Default action:

If the cursor is enabled and turned on then the cursor blob is drawn on the screen. If not then no action is taken. The current text position is forced into the window (see TXT VALIDATE) and the cursor blob is written at the resulting position. The cursor blob is an inverse patch. This routine will only be called twice if TXT UNDRAW CURSOR is called in between.

Entry conditions:

No conditions.

Exit conditions:

AF corrupt.
All other registers preserved.

Notes:

This indirection is provided to allow the user to change the form of the cursor blob. See TXT PLACE CURSOR for a description of how the cursor blob is normally written.

The Text VDU routines call this indirection whenever the cursor is placed on the screen. All the Text VDU routines that read from the screen, write to the screen or change the current position remove the cursor (using TXT UNDRAW CURSOR) before performing their action and place it back on the screen afterwards (using TXT DRAW CURSOR). An example of such a routine is TXT WR CHAR that writes a character on the screen.

This indirection is set up when TXT INITIALISE or TXT RESET is called.

Related entries:

TXT PLACE CURSOR
TXT UNDRAW CURSOR

#BDD0 - IND : TXT UNDRAW CURSOR

Remove the cursor blob from the screen (if enabled).

Default action

If the cursor is enabled and turned on then the cursor blob is removed from the screen. If not then no action is taken. The cursor blob is an inverse patch. This routine will only be called after TXT DRAW CURSOR has been used to place the cursor on the screen.

Entry conditions

No conditions.

Exit conditions

AF corrupt. All other registers preserved.

Notes

This indirection is provided to allow the user to change the form of the cursor blob. See TXT REMOVE CURSOR for a description of how the cursor blob is normally removed.

The Text VDU routines call this indirection to remove the cursor from the screen. All the Text VDU routines that read from the screen, write to the screen or change the current position remove the cursor (using TXT UNDRAW CURSOR) before performing their action and place it back on the screen afterwards (using TXT DRAW CURSOR). An example of such a routine is TXT WR CHAR that writes a character on the screen.

This indirection is set up when TXT INITIALISE or TXT RESET is called.

Related entries

TXT DRAW CURSOR
TXT REMOVE CURSOR

#BDD3 - IND : TXT WRITE CHAR

Write a character onto the screen.

Default action

Put a character on the screen at a character position.

Entry conditions

A contains the character to write.
H contains the physical column to write at.
L contains the physical row to write at.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes

The character position to write at is given in physical coordinates. i.e. Row 0, column 0 is the top left corner of the screen. The position is not checked for legality.

TXT WRITE CHAR is called by TXT WR CHAR to print a character on the screen. The removing of the cursor blob and the calculation of the new current position are performed by TXT WR CHAR and not by TXT WRITE CHAR.

This indirection is set up when TXT INITIALISE or TXT RESET is called.

Related entries

TXT OUTPUT
TXT UNWRITE
TXT WR CHAR

#BDD6 - IND : TXT UNWRITE

Read a character from the screen.

Default action

Try to read a character from the screen at a character position.

Entry conditions

H contains the physical column to read from.
L contains the physical row to read from.

Exit conditions

If a readable character was found:

  • Carry true.
  • A contains the character read.

If no recognisable character was found:

  • Carry false.
  • A contains zero.

Always: BC, DE, HL and other flags corrupt.
All other registers preserved.

Notes

The character position to read from is given in physical coordinates. i.e. Row 0, column 0 is the top left corner of the screen. The position is not checked for legality.

This indirection is called by TXT RD CHAR to read a character from the screen. TXT RD CHAR removes the cursor from the screen before calling this indirection.

The read is performed by comparing the matrix found on the screen with the matrices used to generate characters. As a result changing a character matrix, changing the pen or paper inks or changing the screen (e.g. drawing a line through a character) may make the character unreadable. In particular the cursor blob will cause confusion and so it should not be on the screen.

Special precautions are taken against generating inverse space (character #8F). Initially the character is read assuming that the background to the character was written in the current paper ink. If this fails to generate a recognisable character or it generates inverse space then another try is made by assuming that the character was written in the current pen ink.

The characters are scanned starting with #00 and finishing with #FF. Thus, if there are two possible character matrices that match the screen, the smaller of the two character numbers will be returned.

This indirection is set up when TXT INITIALISE or TXT RESET is called.

Related entries

TXT RD CHAR
TXT WRITE CHAR

#BDD9 - IND : TXT UNWRITE

Output a character or control code.

Default action

Print a character on the screen or obey a control code (characters #00..#1F). Works on the currently selected stream (except as noted below).

Entry conditions

A contains the character or code.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes

This indirection is called by TXT OUTPUT to do the work of printing characters or obeying the control codes. It is provided to allow the user to change the method of dealing with characters and control codes or to allow the user to redirect output (to the printer for example). TXT OUTPUT merely preserves the registers around the call of TXT OUT ACTION.

Control codes may take up to 9 parameters. These are the characters sent following the initial control code. The characters sent are stored in a buffer until sufficient have been received to make up all the required parameters. The control code buffer is only long enough to accept 9 parameter characters.

There is only one control code buffer which is shared between all the streams. It is, therefore, possible to get unpredictable results if the output stream is changed part of the way through sending a control code sequence.

If the VDU is disabled then no characters will be printed on the screen. In V1.1 firmware control codes that are specially marked in the control code table will not be obeyed if the VDU is disabled. Other control codes and all control codes in V1.0 firmware will be obeyed.

If the graphics character write mode is enabled then all characters and control codes are printed using the G raphics VDU (see GRA WR CHAR) and are not obeyed. Normally characters are written by the Text VDU (see TXT WR CHAR).

This indirection is set up when TXT INITIALISE or TXT RESET is called.

Related entries

TXT OUTPUT
TXT WR CHAR

#BDDC - IND : GRA PLOT

Plot a point.

Default action

Check if the point lies inside the current window and if so write it in the current graphics pen ink and using the current graphics write mode. The current graphics position is always moved to the specified point.

Entry conditions

DE contains the user X coordinate of the point to plot.
HL contains the user Y coordinate of the point to plot.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes

The position of the point to plot is given in user coordinates, i.e. relative to the user origin.

This indirection is called by GRA PLOT RELATIVE and GRA PLOT ABSOLUTE to plot the point requested. It is provided to allow the user to change the method for plotting (to output to an X -Y plotter for example). GRA PLOT RELATIVE converts from relative to user coordinates and then calls this indirection; GRA PLOT ABSOLUTE calls this indirection immediately.

To write the point on the screen the SCR WRITE indirection is used. Thus the point is plotted using the current graphics write mode.

This indirection is set up when GRA INITIALISE or GRA RESET is called.

Related entries

GRA PLOT ABSOLUTE
GRA PLOT RELATIVE
GRA TEST
SCR WRITE

#BDDF - IND : GRA TEST

Test a point.

Default action

Cheek if the point is inside the graphics window and return the ink it is currently set to if so. Otherwise, return the current graphic paper ink. The current graphics position is always moved to the specified point.

Entry conditions

DE contains the user X coordinate of the point to test.
HL contains the user Y coordinate of the point to test.

Exit conditions

A contains the decoded ink of the specified point.
BC, DE, HL and flags corrupt.
All other registers preserved.

Notes

The position of the point to test is given in user coordinates, i.e. relative to the user origin.

This indirection is used by GRA TEST RELATIVE and GRA TEST ABSOLUTE to test the point requested. It is provided to allow the user to change the method for testing (comparing with the current pen ink for example). GRA TEST RELATIVE converts from relative to user coordinates and then calls this indirection; GRA TEST ABSOLUTE calls this indirection immediately.

To test the ink of a point inside the window the SCR READ indirection is used.

This indirection is set up when GRA INITIALISE or GRA RESET is called.

Related entries

GRA PLOT
GRA TEST ABSOLUTE
GRA TEST RELATIVE
SCR READ

#BDE2 - IND : GRA LINE

Draw a line.

Default action

Draw a line between the current graphics position and the given endpoint using the current graphics write mode. Points on the line that lie outside the current graphics window will not be plotted. The current graphics position is always moved to the specified endpoint.

Entry conditions

DE contains the user X coordinate of the endpoint.
HL contains the user Y coordinate of the endpoint.

Exit conditions

AF, BC, DE and HL corrupt. All other registers preserved.

Notes

The position of the endpoint is given in user coordinates, i.e. relative to the user origin.

This indirection is used by GRA LINE RELATIVE and GRA LINE ABSOLUTE to draw the line requested. It is provided to allow the user to change the method for line drawing (to output to an X -Y plotter for example). GRA LINE RELATIVE converts from relative to user coordinates and then calls the indirection; GRA LINE ABSOLUTE calls the indirection immediately.

The line is split up into horizontal or vertical sections that are drawn separately (see SCR HORIZONTAL and SCR VERTICAL). The SCR WRITE indirection is called to write the points in these sections. This means that the line is plotted using the current graphics write mode.

In V1.0 firmware the line is plotted in the current pen ink. But in V1.l firmware the setting of the line mask determines how pixels on the line will be plotted. The line mask is bit significant and is used repeatedly in the order bit 7, bit 6 down to bit 0 for each pixel in the line. If the bit is one then the pixel is plotted in the graphics pen ink. If the bit is zero then the action taken depends on the graphics background write mode. If the background mode is opaque then the pixel is plotted in the graphics paper ink. If the background mode is transparent then the pixel is not plotted.

In V 1.1 firmware the first pixel of the line (that at the current graphics position) is not plotted if the first point plotting mode is set false.

This indirection is set up when GRA INITIALISE or GRA RESET is called.

Related entries

GRA LINE ABSOLUTE
GRA LINE RELATIVE
GRA SET BACK
GRA SET FIRST
GRA SET LINE MASK
SCR HORIZONTAL
SCR VERTICAL

#BDE5 - IND : SCR READ

Read a pixel from the screen.

Default action

Read a pixel from the screen and decode its ink.

Entry conditions

HL contains the screen address of the pixel.
C contains the mask for the pixel.

Exit conditions

A contains the decoded ink that the pixel was set to.
Flags corrupt.
All other registers preserved.

Notes

The mask supplied must be a mask for a single pixel otherwise the decoding of the ink read from the screen will not work correctly.

This indirection is set up when SCR I NITIALISE or SCR RESET is called. It is called by GRA TEST.

Related entries

GRA TEST
SCR WRITE

#BDE8 - IND : SCR WRITE

Write pixel(s) using the current graphics write mode.

Default action

Plot a pixel or pixels on the screen using the current graphics write mode.

Entry conditions

HL contains the screen address of the pixel(s).
C contains the mask for the pixel(s).
B contains the encoded ink to plot with.

Exit conditions

AF corrupt.
All other registers preserved.

Notes

The pixel mask supplied can be for a single pixel or more than one pixel (or even no pixels). The ink supplied should be encoded to cover the whole of a byte (see SCR INK ENCODE).

The pixel is plotted using the current Graphics VDU write mode. These modes are:

  • FORCE : Pixel is set to the new ink irrespective of the old ink.
  • XOR : Pixel is set to the ink formed by exclusive-orIng the new ink for the pixel and its current setting.
  • AND : Pixel is set to the ink formed by anding the new ink for the pixel and its current setting.
  • OR : Pixel is set to the ink formed by oring the new ink for the pixel and its current setting.

The write mode can be set by calling SCR ACCESS appropriately.

This indirection is called by all Graphics VDU write routines, in particular GRA PLOT RELATIVE, GRA PLOT ABSOLUTE, GRA LINE RELATIVE, GRA LINE ABSOLUTE and GRA WR CHAR, to plot pixels on the screen. It is provided to allow the user to intercept the lowest level of point plotting (perhaps to add yet another plotting mode).

This indirection is set up when SCR INITIALISE or SCR RESET is called.

Related entries

GRA PLOT
SCR ACCESS
SCR PIXELS
SCR READ

#BDEB - IND : SCR MODE CLEAR

Clear the screen to ink 0.

Default action

Clear the screen memory to zeros. This indirection is provided to allow the user to prevent the screen being cleared after the mode is changed.

Entry conditions

No conditions.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes

Normally this indirection performs the actions described in SCR CLEAR. In V1.0 firmware it is necessary for the user to set up the inks if this indirection is intercepted (see Appendix XIII). In V1.1 firmware the screen pack sets up the inks for the user after SCR MODE CLEAR has been called. This indirection is set up when SCR INITIALISE or SCR RESET is called. N.B. When this indirection is called the text and graphics VDUs are in non-standard states.

Related entries

SCR CLEAR
SCR SET MODE

#BDEE - IND : KM TEST BREAK

Test for break (or reset).

Default action

Test if the escape key is pressed, if not then no action is taken. If escape, shift and control are all pressed and no other keys then the system is reset. Otherwise, a break event is reported (see KM BREAK EVENT).

Entry conditions

Interrupts disabled.
C contains shift and control key states.

Exit conditions

AF and HL corrupt.
All other registers preserved.

Notes

This indirection is called by the firmware from the interrupt path. Thus interrupts are disabled and they must remain disabled.

If bit 7 of C is set then the control key is pressed. If bit 5 of C is set then one of the shift keys is pressed.

This indirection is called after the keys have been scanned and the escape key was found to have been pressed. It is provided to allow the user to alter the action of a break (particularly to prevent the system reset, see RESET ENTRY).

This indirection is set up when KM INITIALISE or KM RESET is called.

Related entries

KM BREAK EVENT

#BDF1 - IND : MC WAIT PRINTER

Print a character or time out.

Default action

Wait for the Centralises port to become not busy and then send a character to it. If the port remains busy for a long time the routine times out and the character is not sent.

Entry conditions

A contains the character to send.

Exit conditions

If the character was sent OK:

  • Carry true.

If the Centronics port timed out:

  • Carry false.

Always:

  • A and BC corrupt.
  • All other registers preserved.

Notes

This indirection is provided to allow the user to drive the printer in a different way.
For example, ‘escape sequences’ could be handled or the time out could be changed.

This indirection is called by the routine MC PRINT CHAR. It tests whether the printer is busy in the same way as MC BUSY PRINTER and sends the character in the same way as MC SEND PRINTER.

This indirection is set up when MC RESET PRINTER is called.

Related entries

MC BUSY PRINTER
MC PRINT CHAR
MC SEND PRINTER

#BDF4 - IND : KM SCAN KEYS

Scan the keyboard.

Default action

Scans the keyboard and updates the key state map. Newly pressed keys are detected and appropriate markers are inserted into the key buffer.

Entry conditions

No conditions except that interrupts must be disabled.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved and interrupts remain disabled.

Notes

This indirection is called every fiftieth of a second during a ticker interrupt. The repeat speeds and start -up delays of the keys are measured in scans of the keyboard and hence fiftieths of a second.

If the escape key is pressed then the indirection KM TEST BREAK is called to process the break.

Related entries

KL SCAN NEEDED
KM READ KEY
KM TEST BREAK
KM TEST KEY

17 The High Kernel jumpblock

Separate from the main firmware jumpblock is a small jumpblock for Kernel routines associated with ROM state and ROM selection. The routines accessed through this jumpblock are all RAM resident, to avoid confusion while the ROM state and ROM select are changed! The RAM area is copied out of ROM during the power-up initialization. The jumpblock should not be altered by the user.

The entry KL POLL SYNCHRONOUS is the ‘odd man out’ amongst the routines in this jumpblock. Unlike the other synchronous event handling routines, which are in the lower ROM, this routine is RAM resident. This minimises the overhead involved in polling for synchronous events.

A brief listing of the entries in this jumpblock can be found in section 14.3. A discussion of ROMs and the memory map can be found in section 2, further discussion of ROMs can be found in section 10 and a discussion of events can be found in section 12.

#B900 - HI: KL U ROM ENABLE

Enable the upper ROM.

Action

Enables the currently selected upper ROM. Reading from addresses #C000 and up will now return the contents of the ROM.

Entry conditions

No conditions.

Exit conditions

A contains the previous ROM state.
Flags corrupt.
All other registers preserved.

Notes

The mechanisms provided for calling subroutines in the upper ROM and for selecting upper ROMs automatically enable the ROM as required. This routine is used by the firmware but is otherwise of little use.

The previous ROM state may be passed to KL ROM RESTORE to reset the state to what it was before this routine was called.

This routine enables interrupts.

Related entries

KL L ROM ENABLE
KL ROM RESTORE
KL ROM SELECT
KL U ROM DISABLE

#B903 - HI: KL U ROM DISABLE

Disable the upper ROM.

Action

Disables the upper ROM. Reading from addresses #C000 and up will now return the contents of the RAM.

Entry conditions

No conditions.

Exit conditions

A contains the previous ROM state.
Flags corrupt.
All other registers preserved.

Notes

Disabling the upper ROM gives read access t o the top 16K of RAM, which is usually used as the screen memory. Note that the mapping of a location in screen memory to pixels on the screen depends on the mode and on the screen offset. It is inadvisable to disable the upper ROM while executing instructions in it! The previous ROM state may be passed to KL ROM RESTORE to reset the state to what it was before this routine was called. This routine enables interrupts.

Related entries

KL L ROM DISABLE
KL ROM RESTORE
KL U ROM ENABLE

#B906 - HI: KL L ROM ENABLE

Enable the lower ROM.

Action

Enables the lower ROM. Reading from addresses below #4000 will now return the contents of the ROM.

Entry conditions

No conditions.

Exit conditions

A contains the previous ROM state.
Flags corrupt.
All other registers preserved.

Notes

In general the lower ROM is disabled except when a firmware routine is called. The firmware jumpblock arranges to enable the lower ROM automatically and to disable it again when the routine returns. This routine is used by the firmware but is otherwise of little use.

The previous ROM state may be passed to KL ROM RESTORE to reset the state to what it was before this routine was called.

This routine enables interrupts.

Related entries

KL L ROM DISABLE
KL ROM RESTORE
KL U ROM ENABLE

#B909 - HI: KL L ROM DISABLE

Disable the lower ROM.

Action

Disables the lower ROM. Reading from addresses below #4000 will now return the contents of the RAM.

Entry conditions

No conditions.

Exit conditions

A contains the previous ROM state. Flags corrupt. All other registers preserved.

Notes

In general the lower ROM is disabled except when a firmware routine is called.
The firmware jumpblock arranges to enable the lower ROM automatically and to disable it again when the routine returns.

The previous ROM state may be passed to KL ROM RESTORE to reset the state to what it was before this routine was called.

This routine enables interrupts.

Related entries

KL LROM ENABLE
KL ROM RESTORE
KL U ROM DISABLE

#B90C - HI: KL ROM RESTORE

Restore the previous ROM state.

Action

The ROM state change routines all return a value giving the previous ROM state.
Given that value KL ROM RESTORE will reset the state to what it was before the change.

Entry conditions

A contains the previous ROM state.

Exit conditions

AF corrupt. All other registers preserved.

Notes

The previous ROM state is the value returned by one of:

  • KL U ROM ENABLE
  • KL U ROM DISABLE
  • KL L ROM ENABLE
  • KL L ROM DISABLE
  • KL ROM SELECT

It is possible to use KL U ROM DISABLE to reverse the effect of a call of KL U ROM ENABLE (amongst various other combinations). However, calling KL ROM RESTORE is the prefered method since it restores the state to what it was, which might have been enabled anyway.

This routine enables interrupts.

Related entries

KL L ROM DISABLE
KL L ROM ENABLE
KL ROM SELECT
KL U ROM DISABLE
KL U ROM ENABLE

#B90F - HI: KL ROM SELECT

Select a particular upper ROM.

Action

Select a given upper ROM and enable the upper ROM.

Entry conditions

C contains the ROM select address of the required ROM.

Exit conditions

C contains the ROM select address of the previously selected ROM.
B contains the previous ROM state.
AF corrupt. All other registers preserved.

Notes

The previous state can be passed to KL ROM RESTORE to reset the ROM enable to what it was. Both the previous state and the previous selection can be passed to KL ROM DESELECT to restore the state to what it was and to select the previously selected ROM again.

The mechanisms provided for calling routines in expansion ROMs automatically perform ROM selection as required (see section 2).

It is inadvisable to select another upper ROM whilst executing instructions in the upper ROM.

This routine enables interrupts.

Related entries

KL CURR SELECTION
KL PROBE ROM
KL ROM DESELECT
KL ROM RESTORE

#B912 - HI: KL CURR SELECTION

Ask which upper ROM is currently selected.

Action

Returns the ROM select address of the currently selected upper ROM.

Entry conditions

No conditions.

Exit conditions

A contains the ROM select address of the currently selected ROM.
All other registers and flags preserved.

Notes

It is not possible to predict the ROM select address at which any particular expansion ROM will be fitted. The 'far address' used to reference subroutines in expansion ROMs includes a ROM select byte which must be set up at run time.
This routine returns the ROM select address of the current ROM so that it can set up suitable ‘far addresses'.

Related entries

KL PROBE ROM
KL ROM SELECT

#B915 - HI: KL PROBE ROM

Ask class and version of a ROM.

Action

The first few bytes of all upper ROMs contain information in a standard form about the ROM. This routine extracts the class, mark number and version number bytes from the ROM at the given ROM select address.

Entry conditions

C contains the ROM select address of the ROM to probe.

Exit conditions

A contains the ROM's class.
L contains the ROM's mark number.
H contains the ROM's version number.
B and flags corrupt.
All other registers preserved.

Notes

The ROM class returned may take any of the following values:
0: Foreground ROM.
1: Background ROM.
2: Extension foreground ROM.
#80: On board ROM (the built in BASIC foreground program).

Selecting a ROM address where no ROM is fitted implicitly selects the on-board ROM and so it will return #80 as its class.
The meaning of the mark and version numbers depends on the ROM. See section 10 for a description of expansion ROMs.

This routine enables interrupts.

Related entries

KL ROM SELECT
KL CURR SELECTION

#B918 - HI: KL ROM DESELECT

Restore previous upper ROM selection.

Action

Set the ROM state and upper ROM selection to what they were before KL ROM SELECT was called.

Entry conditions

C contains the ROM select address of the previously selected ROM.
B contains the previous ROM state.

Exit conditions

C contains the ROM select address of the currently selected ROM.
B corrupt.
All other registers and flags preserved

Notes

The previous ROM selection and state are the values returned by KL ROM SELECT. The currently selected ROM returned by this routine is the ROM that was selected by calling KL ROM SELECT (unless further selections have been made).

The mechanisms provided for calling subroutines in expansion ROMs automatically perform ROM selection as required. It is inadvisable to select another upper ROM whilst executing instructions in the upper ROM.

This routine enables interrupts.

Related entries

KL CURR SELECTION
KL ROM RESTORE
KL ROM SELECT

#B91B - HI: KL LDIR

Move store (LDIR) with ROMs turned off.

Action

Performs an LDIR instruction (LoaD Increment and Repeat) with both upper and lower ROMs disabled.

Entry conditions

BC, DE, HL as required by the LDIR instruction.

Exit conditions

F, BC, DE, HL as set by the LDIR instruction.
All other registers preserved.

Notes

This routine may be used to move areas of RAM irrespective of the ROM state.

This routine enables interrupts.

Related entries

KL LDDR
RAM LAM (RST4)

#B91E - HI: KL LDIR

Move store (LDDR) with ROMs turned off.

Action

Performs an LDDR instruction (LoaD Decrement and Repeat) with both upper and lower ROMs disabled.

Entry conditions

BC, DE, HL as required by LDDR instruction.

Exit conditions

F, BC, DE, HL as set by LDDR instruction.
All other registers preserved.

Notes

This routine may be used to move areas of RAM irrespective of the ROM state.

This routine enables interrupts.

Related entries

KL LDIR
RAM LAM (RST4)

#B921 - HI: KL POLL SYNCHRONOUS

Check if an event with higher priority than the current event is pending.

Action

If the synchronous event queue is not empty then the priority of the highest priority pending event is compared with the current event's priority (if any).

Entry conditions

No conditions.

Exit conditions

If there is a higher priority event pending:

  • Carry true.

If there is no higher priority event pending:

  • Carry false.

Always:

  • A and other flags corrupt.
  • All other registers preserved.

Notes

This routine is in the high jumpblock to minimise the overhead of polling for synchronous events. If the synchronous event queue is empty then the routine takes only a few instructions.

While a synchronous event is being processed the Kernel remembers its priority.

The synchronous event routine may itself poll the synchronous event queue, but only events of a higher priority than itself are notified to it.

This routine may enable interrupts.

Related entries

KL EVENT
KL DONE SYNC
KL DO SYNC
KL NEXT SYNC

#B92A - HI: KL POLL SYNCHRONOUS

Ensure keyboard is scanned at next opportunity.

Action

Force the Key Manager to scan the keyboard when the next ticker interrupt occurs.
This may be used to reduce the probability of key pressings being missed while interrupts are disabled.

Entry conditions

No conditions.

Exit conditions

AF and HL corrupt.
All other registers preserved.

Notes

The keyboard is normally scanned on every sixth ticker interrupt (every fiftieth of a second). While interrupts are disabled the ticks are lost and the keyboard will not be scanned. If interrupts are disabled for a significant period (more than three ticks) then this routine should be called just before interrupts are re-enabled. If interrupts are disabled for a long time (more than twelve ticks) then the user might consider calling this routine and re-enabling interrupts for a short time every fiftieth of a second.

Related entries

KM SCAN KEYS

18 The Low Kernel Jumpblock

The bottom of memory, from #0000 to #003F inclusive, is occupied by the code for the restart (RST) instructions and a number of Kernel entries. Most of these entries are concerned with access to subroutines in ROM and RAM. The RST's are:

  • RST 0 performs a system reset.
  • RST instructions 1 to 5 inclusive have been used to extend the Z80 instruction set to provide extra CALL and JUMP instructions, which use addresses extended to include ROM state and ROM select components.
  • RST 6 is available to the user.
  • RST 7 is used by interrupts.

Since all the entries supplied must be available whether the lower ROM is enabled or not, the area is copied into RAM from the ROM during power-up initialization.

The user is not intended to alter this jumpblock (except where noted in the USER RESTART and EXT INTERRUPT areas). If the user does change the area then it is the user's responsibility to ensure that the changes do not affect other programs. To some extent this can be achieved by ensuring that t he lower ROM is always enabled when other programs are running. However, since the other programs may disable the lower ROM this is insufficient in most cases. Ideally the original jumpblock contents should be restored where there is any doubt.

Section 2 c ontains a discussion of ROMs and the memory map and section 10 contains a general discussion of external ROMs. A brief list of the routines in this area can be found in section 14.4.

#0000 RST 0 - LOW: RESET ENTRY

Completely reset the machine as if powered up.

Action

When the machine is first turned on execution starts here. Calling or jumping to #0000, or executing RST 0, resets the machine to its initial power-up state.

Entry conditions

No conditions.

Exit conditions

Does not return!

Notes

All hardware is reset and the firmware is completely initialized. Once all tables and jumpblocks have been set up, control is passed to the default entry in ROM 0 (see section 10).

Related Entries

MC START PROGRAM

#0008 RST 1 - LOW: LOW JUMP

Jump to lower ROM or RAM, takes inline ‘low address’ to jump to.

Action

RST 1 is used to extend the instruction set. It is an expanded form of the jump instruction. It should be followed by a 2 byte ‘low address’ which specifies the location to jump to and the required ROM state.

Entry conditions

All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

The ‘low address’ following the restart instruction is laid out as follows:

bits:151413 … 0
U L Address
  • If the ‘U’ bit is set then the upper ROM is disabled.
  • If the ‘L’ bit is set then the lower ROM is disabled.
  • ‘Address’ is the actual address of the target routine to jump to once the ROM state has been set.

When the target routine returns the ROM state is restored to what it was before the jump. To accomplish this 4 bytes are pushed onto the stack and so care should be taken when indexing up the stack (to find the address of inline parameters, for example).

The LOW JUMP, RST 1, 'instruction' may replace the first byte of a JP (jump) instruction. It is intended for use in jumpblocks. The main firmware jumpblock is made up almost exclusively of LOW JUMP ‘instructions’.

It is assumed that the destination of the jump is a routine which will return in the usual way. The restart instruction itself does not return. The value at the top of the stack when a LOW JUMP is executed must, therefore, be a return address.

Executing a LOW JUMP enables interrupts.

Related Entries

FAR CALL (RST 3)
FIRM JUMP (RST 5)
KL FAR ICALL
KL FAR PCHL
KL LOW PCHL

#000B - LOW: KL LOW PCHL

Jump to lower ROM or RAM.
Register HL contains the ‘low address’ to jump to.

Action

Takes a ‘low address’ as a parameter and jumps to it. The ‘low address’ specifies both the address to jump to and the ROM state required.

Entry conditions

HL contains the ‘low address’ to jump to. All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

The ‘low address’ is laid out as follows:

bits:151413 … 0
U L Address
  • If the ‘U’ bit is set then the upper ROM is disabled.
  • If the ‘L’ bit is set then the lower ROM is disabled.
  • ‘Address’ is the actual address to jump to, once the ROM state has been set.

When the target routine returns the ROM state is restored to what it was before the jump. To accomplish this 4 bytes are pushed onto the stack and so care should be taken when indexing up the stack (to find the address of inline parameters, for example).

It is assumed that the destination of the jump is a routine which will return in the usual way. The value at the top of the stack when a LOW PCHL is executed must, therefore, be a return address.

Interrupts are enabled.

Related Entries

KL FAR ICALL
KL FAR PCHL
LOW JUMP (RST1)
PCHL INSTRUCTION

#000E - LOW: PCBC INSTRUCTION

Jump to address in BC.

Action

Equivalent to the JP (HL) instruction (or PCHL in some assembler dialects), except that the destination is in BC not HL.

Entry conditions

BC contains the address to jump to. All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

Calling PCBC INSTRUCTION is a useful way of invoking a routine whose address has been picked out of a table or otherwise established at run time.

Related Entries

KL FAR PCHL
KL LOW PCHL
KL SIDE PCHL
PCDE INSTRUCTION
PCHL INSTRUCTION

#0010 RST 2 - LOW: SIDE CALL

Call to a sideways ROM, takes inline ‘side address’ to call.

Action

RST 2 is used to extend the instruction set. It is an expanded form of the CALL instruction. It should be followed by a 2 byte ‘side address’ which specifies the location to call and the required ROM selection.

Entry conditions

All registers and flags are passed to the target routine untouched except for IY (which is set to point at a background ROM's upper data area).

Exit conditions

IY corrupt.
All other registers and flags are as set by the target routine.

Notes

The ‘side address’ following the restart instruction is laid out as follows:

bits:15,1413 … 0
Off Address
  • 'Off’ gives a value in the range 0..3, which, when added to the ROM select address of the main foreground ROM, gives the ROM select address of the required ROM.
  • After #C000 has been added to it, ‘address’ is the address of the routine to call.

The target routine returns to the instruction immediately following the inline 'side address'. The ROM select and ROM state are restored to what they were before the call. To accomplish this 6 bytes are pushed onto the stack and so care should be taken when indexing up the stack (to find the address of inline parameters, for example).

When the target routine is entered the lower ROM is disabled and the appropriate upper ROM is selected and enabled.

SIDE CALLs are provided to support foreground programs split over a number of ROMs (up to four). See section 9 on expansion ROMs.

Interrupts are enabled.

Related Entries

FAR CALL (RST3)
KL SIDE PCHL

#0013 - LOW: KL SIDE PCHL

Call to a sideways ROM, HL contains the ‘side address’ to call.

Action

Takes a ‘side address’ and calls it. The ‘side address’ specifies the address of the routine to call and which upper ROM to select.

Entry conditions

HL contains the ‘side address’ to call.
All registers and flags are passed to the target routine untouched except for IY (which is set to point at a background ROM’s upper data area).

Exit conditions

IY corrupt.
All other registers and flags are as set by the target routine.

Notes

The ‘side address’ is laid out as follows:

bits:15,1413 … 0
Off Address
  • 'Off’ gives a value in the range 0..3, which, when added to the ROM select address of the main foreground ROM, gives the ROM select address of the required ROM.
  • After #C000 has been added to it, ‘address’ is the address of the routine to call.

When the target routine is entered the lower ROM is disabled and the appropriate upper ROM is selected and enabled.

The target routine returns to the ROM select and ROM state are restored to what they were before the call. To accomplish this 6 bytes are pushed onto the stack and so care should be taken when indexing up the stack (to find the address of inline parameters, for example).

Side calls are provided to support foreground programs split over a number of ROMs (up to four). See section 10 on external ROMs.

Interrupts are enabled.

Related Entries

FAR CALL (RST3)
KL FAR ICALL
KL FAR PCHL

#0016 - LOW: PCDE INSTRUCTION

Jump to address in DE.

Action

Equivalent to the JP (HL) instruction (or PCHL in some assembler dialects), except that the destination is in DE not HL.

Entry conditions

DE contains the address to jump to.
All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

Calling PCDE INSTRUCTION is a useful way of invoking a routine whose address has been picked out of a table or otherwise established at run time.

Related Entries

KL FAR PCHL
KL LOW PCHL
KL SIDE PCHL
PCBC INSTRUCTION
PCHL INSTRUCTION

#0018 RST 3 - LOW: FAR CALL

Call subroutine in RAM or any ROM, takes inline address of ‘far address’.

Action

RST 3 is used to extend the instruction set. It is an expanded form of the CALL instruction that allows routines to be called anywhere in RAM or in any ROM. The restart is followed by the address of a 3 byte ‘far address’ which specifies the location to call and the required ROM state and ROM selection.

Entry conditions

All registers and flags are passed to the target routine untouched except for IY (which is set to point at a background ROM's upper data area).

Exit conditions

IY preserved.
All other registers and flags are as set by the target routine.

Notes

The restart instruction takes a 2 byte inline parameter which is the address of a ‘far address’. The ‘far address’ is laid out as follows:

Byte:0,12
AddressROM
  • Bytes 0..1 give the address of the routine to call.
  • Byte 2 is the ROM select byte which takes values as follows:
    • #00..#FB: Select the given ROM, enable upper, disable lower.
    • #FC: No change of ROM selection, enable upper, enable lower.
    • #FD: No change of ROM selection, enable upper, disable lower.
    • #FE: No change of ROM selection, disable upper, enable lower.
    • #FF: No change of ROM selection, disable upper, disable lower.

The reason that the 'far address' is not contained in the FAR CALL instruction directly is because the ROM select byte for routines in ROM will depend upon the particular configuration of expansion ROMs on the machine and must therefore be established and set at run time.

Registers are passed to the target routine untouched except for the IY register.
When entering a background ROM this is set to point at the base of the ROM's upper data area. (See section 10.4 and KL INIT BACK).

The target routine returns to the instruction immediately following the inline parameter. The ROM select and ROM state are restored to what they were before the call. This is accomplished by pushing values on the stack and so care should be taken when indexing up the stack after a FAR CALL instruction. (The stack usage is 4 bytes for ROM select bytes in the range #FC..# FF and 6 bytes for ROM select bytes in the range #00.. #FB.)

Interrupts are enabled.

Related Entries

KL FAR ICALL
KL FAR PCHL
LOW JUMP (RST1)
SIDE CALL (RST2)

#001B - LOW: KL FAR PCHL

Call subroutine in RAM or any ROM.
C and HL contain the ‘far address’ to call.

Action

The far call mechanism allows subroutines to be called anywhere in RAM or in any ROM. This routine takes a 'far address' and calls the given routine setting the requested ROM state and ROM selection.

Entry conditions

HL contains the address of the routine to call.
C contains the ROM select byte.
All registers and flags are passed to the target routine untouched except for IY (which is set to point at a background ROM's upper data area).

Exit conditions

IY preserved.
All other registers and flags are as set by the target routine.

Notes

The ROM select byte takes values as follows:

  • #00..#FB: Select the given ROM, enable upper, disable lower.
  • #FC: No change of ROM selection, enable upper, enable lower.
  • #FD: No change of ROM selection, enable upper, disable lower.
  • #FE: No change of ROM selection, disable upper, enable lower.
  • #FF: No change of ROM selection, disable upper, disable lower.

Registers are passed to the target routine untouched except for the IY index register. When entering a background ROM this is set to point at the base of the ROM's upper data area. (See section 10.4 and KL INIT BACK).

When the target routine returns, the ROM select and ROM state are restored to what they were before the call. This is accomplished by pushing values onto the stack and so care should be taken when indexing up the stack after using this routine. (The stack usage is 4 bytes for ROM select bytes in the range #FC..#FF and 6 bytes for ROM select bytes in the range #00.. #FB.)

Interrupts are enabled.

Related Entries

FAR CALL (RST3)
KL FAR ICALL
KL LOW PCHL
KL SIDE PCH

#001E - LOW: PCHL INSTRUCTION

Jump to address in HL.

Action

Entry comprises a JP (HL) instruction (or PCHL in some assembler dialects).

Entry conditions

HL contains the address to jump to.
All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

Calling PCHL INSTRUCTION is a useful way of invoking a routine whose address has been picked out of a table or otherwise established at run time.

Related Entries

KL FAR PCHL
KL LOW PCHL
KL SIDE PCHL
PCBC INSTRUCTION
PCDE INSTRUCTION

#0020 RST 4 - LOW: RAM LAM

LD A,(HL) with all ROMs disabled.

Action

RST 4 is used to extend the instruction set. It is equivalent to a LD A,(HL) instruction except that it always reads from RAM irrespective of whether the ROMs are enabled or not.

Entry conditions

HL contains the address of the location to read.

Exit conditions

A contains the value read from the given location.
All other registers and flags preserved.

Notes

Writing to a location always writes to RAM, even if the location is in one of the ROM areas and the ROM is enabled. The RAM LAM, RST 4, 'instruction' is the read equivalent.

Interrupts are enabled.

Related Entries

KL LDDR
KL LDIR

#0023 - LOW: KL FAR ICALL

Call subroutine in RAM or any ROM, HL points at ‘far address’.

Action

The far call mechanism allows subroutines to be called anywhere in RAM or in any ROM. This routine takes the address of a 'far address' and calls the given routine setting the ROM state and ROM selection required.

Entry conditions

HL contains the address of the ‘far address’ to call. All registers and flags are passed to the target routine untouched except for IY (which is set to point at a background ROM's upper data area).

Exit conditions

IY preserved.
All other registers and flags are as set by the target routine.

Notes

The parameter passed is the a ddress of a 3 byte 'far address'. This is laid out as follows:

Byte:0,12
AddressROM
  • Bytes 0..1 give the address of the routine to call.
  • Byte 2 is the ROM select byte which takes values as follows:
    • #00..#FB: Select the given ROM, enable upper, disable lower.
    • #FC: No change of ROM selection, enable upper, enable lower.
    • #FD: No change of ROM selection, enable upper, disable lower.
    • #FE: No change of ROM selection, disable upper, enable lower.
    • #FF: No change of ROM selection, disable upper, disable lower.

Registers are passed to the target routine untouched except for the IY index register. When entering a background ROM this is set to point at the base of the ROM's upper data area. (See section 10.4 and KL INIT BACK).

When the target routine returns, the ROM select and ROM state are restored to what they were before the call. This involves pushing values onto the stack and so care should be taken in indexing up the stack after calling this routine. (The stack usage is 4 bytes for ROM select bytes in the range #FC.. #FF and 6 bytes for ROM select bytes in the range #00.. #FB.)

Interrupts are enabled.

Related Entries

KL FAR CALL
KL FAR PCHL

#0028 RST 5 - LOW: FIRM JUMP

Jump to lower ROM, takes inline address to jump to.

Action

RST 5 is used to ext end the instruction set. It is an expanded form of the jump instruction for jumping to routines in the lower ROM or into the central 32K of RAM. The restart is followed by the address of the routine to jump to.

Entry conditions

All registers and flags are passed to the target routine untouched.

Exit conditions

All registers and flags are as set by the target routine.

Notes

The lower ROM is enabled before the jump is taken and is disabled (rather than restored) when the target routine returns. Neither the upper ROM state nor the ROM selection are changed. Two bytes are pushed onto the stack and so care should be taken when indexing up the stack (to find the address of inline parameters, for example).

It is assumed that the destination of the jump is a routine which will return in the usual way. The restart instruction itself does not return. The value at top of stack when a FIRM JUMP is executed must, therefore, be a return address.

The FIRM JUMP, RST 5, 'instruction' may replace the first byte of a JP (jump) instruction, particularly in jumpblocks, much like a LOW JUMP. A FIRM JUMP is slightly faster than a LOW JUMP but a LOW JUMP is more flexible in dealing with ROM states.

Interrupts are enabled.

Related Entries

LOW JUMP(RST1)

#0030 RST 6 - LOW: USER RESTART

Undedicated RST instruction.

Action

The eight bytes from #0030 to #0037 inclusive maybe patched as required.

Entry conditions

Unknown.

Exit conditions

Unknown.

Notes

If the lower ROM is disabled when an RST 6 instruction is executed then the instructions patched into locations #0030 to #0037 are executed in the normal way.

If the lower ROM is enabled when the RST 6 instruction is executed then the firmware disables the lower ROM and jumps to #0030 to execute the instructions planted by the user.

Generally the lower ROM is disabled except while the firmware is active. Since there are no RST 6s in the firmware there should be no problem about the ROM state when a RST 6 is executed. However, to cope with all eventualities, if the lower ROM is found to be enabled when the restart is executed then the ROM state before the lower ROM is disabled is saved in location #002B. If the lower ROM is found to be disabled then location #002B is left untouched. The value stored is suitable to be passed to KL ROM RESTORE to re-enable the ROM (although KL L ROM ENABLE will have the same effect).

The user can detect whether the lower ROM was enabled when the restart was executed if location #002B is set to zero when the RST 6 area is patched and after processing each restart. If #002B is zero when the RST 6 code is entered then the lower ROM was disabled, and if it is non-zero then the lower ROM was enabled.

The default action for RST 6 as set at power-up is to perform a RST 0, i.e. a system reset.

Related Entries

None.

#0038 RST 7 - LOW: INTERRUPT ENTRY

Hardware interrupt entry point.

Action

The Z80 runs in interrupt mode 1, which treats normal interrupts as RST 7 instructions. The firmware interrupt handler looks after the built in regular time interrupt. External interrupts, generated by expansion hardware, are passed on to user supplied software.

Entry conditions

No conditions.

Exit conditions

All registers and flags preserved.

Notes

The user must not use RST 7s as these are dedicated to the processing of interrupts.
If the interrupt is from an external source then the user supplied interrupt routine, EXT INTERRUPT, is called. See section 10 for a fuller discussion of interrupts.
The user may patch this area (#0038..#003A inclusive) to intercept interrupts if it is absolutely necessary (see Appendix XI, particularly section c).

Related Entries

EXT INTERRUPT

#003B - LOW: EXT INTERRUPT

External interrupt routine.

Action

The five bytes from #003B to #003F inclusive must be patched by the user if there are going to be any external interrupts. When an external interrupt is detected by the firmware interrupt handler the lower ROM is disabled and the code at #003B is called.

Entry conditions

No conditions.

Exit conditions

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes

When the routine is called interrupts are disabled and they must remain disabled.

Under no circumstances may the user enable interrupts or use the second register set. Before the routine returns it must clear the interrupt source.

See section 11.2 for a discussion of external interrupts.

When an interrupt routine is set up the current contents of #003B..#003F should be copied elsewhere before they are replaced. If, when the routine is called, it discovers that its hardware is not responsible for the interrupt then it should jump to the copy of the previous external interrupt routine (whose hardware may be responsible).

The purpose of an interrupt routine is to clear the interrupt as quickly as possible, and perhaps perform a minimum of processing. While in the interrupt path no further interrupts are acknowledged. If the interrupt generates a substantial work load, then it should be translated into an event, so that the system is not delayed in the interrupt path for any longer than necessary (see section 11.3).

The interrupt routine must be in RAM at addresses lower than #C000 (as the ROM enable and disable routines cannot be called from the interrupt path).

The default external interrupt routine merely returns. This means that the interrupt will not be cleared and so it will repeat as soon as interrupts are re-enabled. This will cause the machine to 'lock up'.

Related Entries

INTERRUPT ENTRY
KL EVENT

19 AMSDOS BIOS Facilities

AMSDOS uses the CP/M BIOS to access the disc. In order that a program running under AMSDOS may access the disc directly nine of the BIOS extended jumpblock routines are available.

The routines are accessed as external commands. To find the address of the required routines use KL FIND COMMAND. The command names are single control characters (Ctrl A to Ctrl I) as these cannot be typed in from BASIC. An example of how to use these commands can be found in section 10.7.

N.B. The BIOS extended jumpblock itself is not available, indeed it does not exist in an AMSDOS environment.

The BIOS routines available and their command names are as follows:

  • SET MESSAGE Ctrl A (#01)
  • SET UP DISC Ctrl B (#02)
  • SELECT FORMAT Ctrl C (#03)
  • READ SECTOR Ctrl D (#04)
  • WRITE SECTOR Ctrl E (#05)
  • FORMAT TRACK Ctrl F (#06)
  • MOVE TRACK Ctrl G (#07)
  • GET DR STATUS Ctrl H (#08)
  • SET RETRY COUNT Ctrl I (#09)

The word at #BE40 contains the address of the disc parameter header vector. Disc parameter headers and extended disc parameter blocks may be patched as required. For more details on this see section 9.9.

When one of these routines fails (carry false) it returns an error number in the A register. This is referred to in the following pages as the “error status byte”. If bit 7 of this byte is set then the error has already been reported to the user. Bit 6 is used to distinguish errors generated by the floppy disc controller from those generated by AMSDOS.

If bit 6 is zero then the error numbers are as follows:

  • #0E the file is not open as expected.
  • #0F hard end of file.
  • #10 bad command, usually caused by an incorrect filename.
  • #11 file already exists.
  • #12 file doesn't exist.
  • #13 directory is full.
  • #14 disc is full.
  • #15 disc has been changed with files open on it.
  • #16 file is read-only

Also V1.1 machines have error #00.

  • #00 user has hit escape

If bit 6 is one then the error was detected by the floppy disc controller and the other bits are returned as follows:

  • bit 5 data error - CRC error on data or ID field
  • bit 4 overrun error
  • bit 3 drive not ready - there is no disc in the drive
  • bit 2 no data - can't find the sector
  • bit 1 not writable - disc is write protected
  • bit 0 address mark missing

In addition the routine may also return the address of the “error status buffer”. The first byte of this is a count of the number of bytes received during the results phase of the mPD765A disc controller, the following bytes are those received. For information on the meaning of these bytes see the manufacturer's documentation.

On the following pages are the interfaces to the intercepted routines:

BIOS: SET MESSAGE (CTRL/A)

Enable or disable the disc error messages.

Action:

When disc error messages are enabled and an error occurs the BIOS will display error messages on the screen and interact with the user. When disabled no messages are displayed.

Entry conditions:

  • If messages are to be enabled: A= #00
  • If messages are to be disabled: A= #FF

Exit conditions:

A contains previous state.
HL and flags corrupt.
All other registers preserved.

Notes:

The default state is ENABLED.

Related entries:

SET RETRY COUNT

BIOS: SETUP DISC (CTRL/B)

Set disc parameters.

Action:

Sets the values for the motor on, motor off, write current off and head settle times.
Sends a SPECIFY command to the floppy disc controller.

Entry conditions:

HL contains address of parameter block.

Format of the parameter block:

  • bytes 0, 1 motor on timeout in 20 millis econd units.
  • bytes 2, 3 motor off timeout in 20 millisecond units.
  • byte 4 write current off time in 10 microsecond units.
  • byte 5 head settle time in 1 millisecond units.
  • byte 6 step rate time in 1 millisecond units.
  • byte 7 head unload delay (as per mPD765A SPECIFY command).
  • byte 8 bits 7.. 1: head load delay, bit 0: non-DMA mode (as per mPD765A SPECIFY command).

Exit conditions:

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes:

The values given are used for both drives. When using two differing drives use the slower of the two times.

The default values are:

motor on timeout50
motor off timeout250
write current off time175
head settle time15
step rate time12
head load time1
head unload time1
non-DMA mode1

A motor on time of zero will lock the system up. A motor off time of zero will never turn the motor off.
The standard boot program calls this routine to reset some of the disc parameters as specified in the configuration sector, that is, motor on and off timeouts and the step rate.

Related entries

SELECT FORMAT
SET RETRY COUNT

BIOS: SELECT FORMAT (CTRL/C)

Select a disc format.

Action:

This routine initializes the extended disc parameter block for the given format.
Normally the BIOS automatically detects the format of a disc when SELDSK is called by looking at the sector numbers, but for programs such as formatters it is necessary to pre-set the format.

Entry conditions:

A contains first sector number of required format :

  • #41 ⇒ system format
  • #C1 ⇒ data only format
  • #01IBM format

E contains drive number:

  • #00 ⇒ A:
  • #01 ⇒ B:

Exit conditions:

AF, BC, DE and HL corrupt.
All other registers preserved.

Notes:

Bytes 0..21 of the extended disc parameter block are completely reset, all previous values are lost. Bytes 22..24 (track, align flag, auto-select flag) are not affected. See chapter 2.15.

To set a non-standard format the user may patch the extended disc parameter block directly.

BIOS: READ SECTOR (CTRL/D)

Read a sector from disc.

Action:

Read the specified sector into store.

Entry conditions:

  • HL contains address of sector buffer
  • E contains drive number
  • #00 ⇒ A:
  • #01 ⇒ B:
  • D contains track number
  • C contains sector number

Exit conditions:

If sector read OK:

  • Carry true.
    A contains 0
    HL preserved

If failed to read sector correctly:

  • Carry false.
    A contains error status byte (as defined above).
    HL contains address of error status buffer.

Always
Other flags corrupt.
All other registers preserved.

Notes:

The sector buffer may lie anywhere in RAM, even under a ROM.

Related entries:

WRITE SECTOR

BIOS: WRITE SECTOR (CTRL/E)

Write a sector to disc.

Action:

Write the required sector from store.

Entry conditions:

  • HL contains address of sector buffer
  • E contains drive number
  • #00 ⇒ A:
  • #01 ⇒ B:
  • D contains track number
  • C contains sector number

Exit conditions:

If sector written OK:

  • Carry true.
    A contains 0.
    HL preserved.

If failed to write sector correctly:

  • Carry false.
    A contains error status byte as defined above.
    HL contains address of error status buffer.

Always:
Other flags corrupt.
All other registers preserved.

Notes:

The sector buffer may be anywhere in RAM, even underneath a ROM.

Related entries:

READ SECTOR

BIOS: FORMAT TRACK (CTRL/F)

Format an enti re track.

Action:

Format a track.

Entry conditions:

  • HL contains address of header information buffer
  • E contains drive number
  • #00 ⇒ A:
  • #01 ⇒ B:
  • D contains track number

Format of header information:

  • sector entry for first sector
  • sector entry for second sector
  • sector entry for last sector

sector entry format:

byte 0track number
byte 1head number
byte 2sector number
byte 3log2 (sector size)-7

Exit conditions:

If track formatted OK:

  • Carry true.
    A contains 0.
    HL preserved.

If failed to format track correctly:

  • Carry false.
    A contains error status byte as defined above.
    HL contains address of error status buffer.

Always:
Other flags corrupt.
All other registers preserved.

Notes:

The extended DPB must be preset for the required format (see SELECT FORMAT)

Related entries:

SELECT FORMAT

BIOS: MOVE TRACK (CTRL/G)

Move to specified track.

Action:

Move head to specified track without verifying the move.

Entry conditions:

  • E contains drive number
  • #00 ⇒ A:
  • #01 ⇒ B:
  • D contains track number

Exit conditions:

If moved to track OK:

  • Carry true.
    A contains 0.
    HL preserved.

If failed to move to the track:

  • Carry false.
    A contains error status byte as defined above.
    HL contains address of error status buffer.

Always:
Other flags corrupt.
All other registers preserved.

Notes:

This routine is intended as a diagnostic aid and need not normally be used because the read/write/format routines all seek to the correct track automatically.

BIOS: GET DR STATUS (CTRL/H)

Return status for specified drive.

Action:

This routine return status register 3 of the floppy disc controller as defined below for the specified drive:

bit 7undefined
bit 6write protectThe write protect line is true
bit 5drive readyThe ready line is true
bit 4track zeroThe track zero line is true
bit 3undefined
bit 2head addressalways zero
bit 1unit select 1unit select 1, always zero
bit 0unit select 0currently selected drive

Entry conditions:

A contains drive number

  • #00 ⇒ A:
  • #01 ⇒ B:

Exit conditions:

If carry true:

  • A contains drive status byte as defined above.
  • HL preserved.

If carry false:

  • HL contains address of error status buffer, second byte = Drive status byte as described above.
  • A corrupt.

Always:

Other flags corrupt.
All other registers preserved.

Notes:

This routine returns carry to indicate which set of exit conditions have occurred. No other meaning should be attached to the state of the carry.

Related entries:

SELECT FORMAT
READ SECTOR
WRITE SECTOR
FORMAT TRACK
MOVE TRACK

BIOS: SET RETRY COUNT (CTRL/I)

Set the number of retries for reading/writing/formatting.

Action:

Sets the number of times an operation is retried in the event of an error.

Entry conditions:

A contains the new value for retry count.

Exit conditions:

  • A contains old value of retry count.
  • HL and flags corrupt.

All other registers preserved.

Notes:

The pattern of retries is as follows. Each ‘Try’ counts one. The retry pattern is repeated until either the operation succeeds or the number of tries has reached the retry count:

  • Try
  • Try
  • Move in one track and back again
  • Try
  • Move out one track and back again
  • Try
  • Move to inner track and back again
  • Try
  • Try
  • Move in one track and back again
  • Try
  • Move out one t rack and back again
  • Try
  • Move to outer track and back again
  • Repeat

The default value is 16, i.e. twice around the above loop.

Related entries:

READ SECTOR
WRITE SECTOR
FORMAT TRACK

20 AMSDOS External Commands

The disc ROM contained in the 664/6128 and DDI-1 interface contains a number of external commands. These may be found by using KL FIND COMMAND as described in section 10. Facilities available include switching between drive A and B, switching between the tape and disc operating system, cold booting into CPM, displaying a directory of a disc, and erasing and renaming files.

When using the following commands under BASIC they should be preceded by ‘|’ (obtained by pressing shift and @ together on a QWERTY keyboard) or ‘ù’ (on an AZERTY keyboard) to indicate that they are external commands. When calling KL FIND COMMAND the ‘|’ or ‘ù’ should not be used.

Since these commands are designed to be called from BASIC they use the parameter block mechanism for passing parameters to them (as described in sections 10.6 and 10.7). Briefly, the parameter block is pointed at by IX and A contains the number of parameters supplied. IX points at the last parameter and preceding parameters are at positive offsets from IX. The value stored in the parameter block for an integer parameter is the integer itself, and the value stored for a string parameter is the address of the string descriptor. The first byte of the string descriptor is the length of the string; the second and third bytes are a pointer to the characters. The routine will corrupt registers AF, BC, DE, HL, IX and IY.

The external commands contained in the disc ROM are:

A

Action

Set the default drive to drive A.

Parameters

None.

Notes

  • This command is equivalent to the DRIVE command with 'A' as a parameter.
  • This command will fail if AMSDOS is unable to determine the format of the disc in drive A. In which case the default drive will not be changed.
  • When AMSDOS is initialized the default drive is set to drive A.

Related entries

B

Action

Set the default drive to drive B.

Parameters

None.

Notes

  • This command is equivalent to the DRIVE command with 'B' as a parameter.
  • The command will fail if AMSDOS is unable to determine the format of the disc in drive B. In which case the default drive is not changed.
  • When AMSDOS is initialized the default drive is set to drive A.

Related entries

CPM

Action

This command shuts down BASIC and AMSDOS and cold boots CP/M.

Parameters

None.

Notes

  • MC START PROGRAM is used so all ticker chains etc are lost.
  • The CP/M utility AMSDOS.COM performs the inverse function and restores AMSDOS and BASIC.
  • This command can also be used to boot any program that uses the CP/M bootstrap mechanism as described in section 9.5.

Related entries

None.

DIR

Action

Display the disc directory.

Parameters

One optional string parameter.

Notes

  • The parameter is a filename, possibly containing wild cards, only those files which match this filename are displayed. If the parameter is omitted then '*.*' is assumed.
  • The total amount of free space on the disc is shown in Kbytes.
  • The directory is displayed in as many columns as will fit in the text window of the currently selected stream.
  • Files marked SYS are not shown.
  • Files without an extent zero are not shown.
  • Unlike CAS CATALOG (DISC) the directory is neither sorted nor are the sizes shown. The output is similar to that of the CP/M DIR command.

Related entries

DISC

Action

This command redirects both the tape input and output firmware entries to their disc counterparts.

Parameters

None

Notes

Related entries

DISC.IN

Action

This command redirects the tape input firmware entries to their disc counterparts.

Parameters

None

Notes

Related entries

DISC.OUT

Action

This command redirects the tape output firmware entries to their disc counterparts.

Parameters

None.

Notes

Related entries

DRIVE

Action

Set the current default drive.

Parameters

One string parameter.

Notes

  • The string parameter must be a single letter in the range ‘A’ to ‘P’ or ‘a’ to ‘p’.
  • Drives ‘C’ to ‘P’ are for future enhancement.
  • The command will fail if AMSDOS is unable to determine the format of the disc in the requested drive. In which case the default drive will remain unchanged.
  • When AMSDOS is initialized the default drive is set to drive A.

Related entries

A
B

ERA

Action

Erase files.

Parameters

One string parameter.

Notes

  • The string parameter is a filename, possibly containing wild cards. All files which match this filename are erased.
  • A file which matches the filename but is marked R/O will not be erased. In this event a message is displayed for each 16K (extent) of the file.
  • If none of the files on the disc match the filename then an error message is displayed.

Related entries

REN

Action

Rename a file.

Parameters

Two string parameters.

Notes

  • The first string parameter is the new name for the file. A file of this name must not already exist. The second parameter is the name of the file to be renamed.
  • Neither name may contain wild cards.
  • Both files must be on the same drive.
  • The files may be in different users.
  • If the file to be renamed is marked R/O then an error message is displayed and the file is not renamed.
  • The renamed file will have attributes R/W DIR regardless of the original file's attributes. If the file to be renamed does not exist then an error message is displayed.

Related entries

TAPE

Action

This command restores the tape firmware entries to the state they were before AMSDOS was initialized.

Parameters

None.

Notes

The restored firmware entries are:

TAPE is equivalent to the two commands TAPE.IN and TAPE.OUT.

Note that any patches made to the jumpblock entries for these routines made before a DISC, DISC.IN or DISC.OUT command was executed will be lost. However, any patches made to these entries before AMSDOS was initialized will be restored.

Related entries

TAPE.IN

Action

This command restores the tape input firmware entries to the state they were before AMSDOS was initialized.

Parameters

None.

Notes

The restored firmware entries are:

Note that any patches to the jumpblock entries for these routines made before a DISC or DISC.IN command was executed will be lost. However, any patches made to these entries before AMSDOS was initialized will be restored.

Related entries

TAPE.OUT

Action

This command restores the tape output firmware entries to the state they were before AMSDOS was initialized.

Parameters

None.

Notes

The restored firmware entries are:

Note that any patches to the jumpblock entries for these routines made before a DISC or DISC.OUT command was executed will be lost. However, any patches made to these entries before AMSDOS was initialized will be restored.

Related entries

USER

Action

Set the default user number.

Parameters

One integer parameter.

Notes

The user number must be in the range 0 to 15. Any other parameter will cause an error and the default user will remain unchanged. When AMSDOS is initialized the default user number is set to 0.

Related entries

Appendix

I : MISSING

II : MISSING

III : MISSING

IV : Functions keys and Expansion Strings

Function keys are more fully explained in section 3, and in section 3.7 in particular. The following table specifies the default string for each expansion token and which key the token is associated with by default.

TokenValueDefault StringDefault Key
0 #80 0 Function key 0.
1 #81 1 Function key 1.
2 #82 2 Function key 2.
3 #83 3 Function key 3.
4 #84 4 Function key 4.
5 #85 5 Function key 5.
6 #86 6 Function key 6.
7 #87 7 Function key 7.
8 #88 8 Function key 8.
9 #89 9 Function key 9.
10 #8A . Function key full stop.
11 #8B ø Function key enter
12 #8C RUN”ø Function key enter with control
13..31 #8D..#9F None.

Tokens 13..31 are all set to empty strings and none of them are defaulted to associate with a key.
ø stands for carriage return (character #0D)

V : Inks and Colours

A full discussion of inks and colours can be found in section 6.2. This appendix lists the colours that are available and the default settings for the inks.

There are 27 colours available. The Screen Pack refers to these colours by a grey scale number so that colour 0 is the darkest and colour 26 is the brightest. The hardware requires these grey scales to be translated into the hardware code for the colour. It is unlikely that the user will ever need to deal with the hardware numbers, they are merely given for information.

The user can set the colours in which the 16 inks and the border are displayed.

27 colours palette
Grey ScaleColourHW Number
1 Blue 4
2 Bright blue 21
3 Red 28
4 Magenta 24
5 Mauve 29
6 Bright red 12
7 Purple 5
8 Bright Magenta 13
9 Green 22
10 Cyan 6
11 Sky blue 23
12 Yellow 30
13 White 0
14 Pastel blue 31
15 Orange 14
16 Pink 7
17 Pastel magenta 15
18 Bright green 18
19 Sea green 2
20 Bright cyan 19
21 Lime 26
22 Pastel green 25
23 Pastel cyan 27
24 Bright yellow 10
25 Pastel yellow 3
26 Bright white 11
Default settings
InkColourColour numbers
Border Blue 1/1
0 Blue 1/1
1 Bright yellow 24/24
2 Bright cyan 20/20
3 Bright red 6/6
4 Bright white 26/26
5 Black 0/0
6 Bright blue 2/2
7 Bright magenta 8/8
8 Cyan 10/10
9 Yellow 12/12
10 Pastel blue 14/14
11 Pink 16/16
12 Bright Green 18/18
13 Pastel green 22/22
14 Flashing blue/bright yellow 1/24
15 Flashing sky blue/pink 11/16

VI : Missing

I'm looking for a copy of this appendix.

VII : Text VDU Control Codes

Character values in the range 0-31 sent to the main Text VDU output routine (TXT OUTPUT) do not produce a character on the screen, but are interpreted as control codes. These codes may affect the meaning of one or more of the following characters, which are the code's parameters.

All control codes work on the currently selected stream unless otherwise indicated. For instance, setting the pen, code 15, sets the text pen ink for the currently selected stream whilst setting the colour of an ink, code 28, will affect all streams (and the Graphics VDU).

Certain codes force the current position (the cursor position) to a legal position inside the current window before they are obeyed. This is explained in more detail in section 4.5. The cursor may be left in an illegal position.

The following table specifies the default actions for the control codes. By changing entries in the control code table the action of these codes can be altered as desired. See section 4.7 for a full description.

CodeNameParamsAction
0NUL0In V1.1 firmware: Force the cursor to a legal position(see TXTVALIDATE).
In V1.0 firmware: No effect.
1SOH1Print the character given by the parameter (see TXT WR CHAR). This allows characters 0..31 to be printed.
2STX0Disable the cursor blob (see TXT CUR DISABLE).
Reverses the effect of ETX (code 3).
3ETX0Enable the cursor blob (see TXT CUR ENABLE).
Reverses the effect of STX (code 2).
4EOT1Set the screen mode given by the parameter (see SCR SET MODE). The parameter is taken MOD 4 and the value 3 is ignored:
0 sets mode 0 (160 x 200).
1 sets mode 1 (320 x 200).
2 sets mode 2 (640 x 200).
5ENQ1Print the character given by the parameter using the Graphics VDU as if the graphic character write mode was active (see TXT SET GRAPHIC and GRA WR CHAR).
6ACK0Enable the VDU (see TXT VDU ENABLE).
Reverses the effect of NAK (code 2 1).
7BEL0Makes a short bleep, sound. Note that this flushes the sound queues.
8BS0Make the current posit ion legal then move left one character.
9TAB0Make the current position legal then move right one character.
10LF0Make the current position legal then move down one line.
11VT0Make the current position legal then move up one line.
12FF0Clear the current window and move the current position to the top left corner (see TXT CLEAR WINDOW).
13CR0Make the current position legal and then move it to the left edge of the window on the current line (see TXT SET COLUMN).
14SO1Set the paper ink to the ink given by the parameter (see TXT SET PAPER). Parameter is taken MOD 16.
15SI1Set the pen ink to the ink given by the parameter (see TXT SET PEN). Parameter is taken MOD 16.
16DLE0Make the current position legal then clear it to the current paper ink.
17DC10Make the current position legal then clear from the left edge of the window to the current position inclusive. The affected cells are set to the current paper ink.
18DC20Make the current position legal then clear from it to the right edge of the window inclusive. The affected cells are set to the current paper ink.
19DC30Make the current position legal then clear from the start of the window to the current position inclusive. The affected cells are set to the current paper ink.
20DC40Make the current position legal then clear from it to the end of the window inclusive. The affected cells are set to the current paper ink.
21NAK0Disable the VDU (see TXT VDU DISABLE).
Reverses the effect of ACK (code 6).
22SYN1Set the character write mode from the parameter (see TXT SET BACK). The parameter is taken MOD 2 and:
0 sets opaque mode (the default mode).
1 sets transparent mode.
23ETB1Set the Graphics VDU write mode from the parameter (see SCR ACCESS). The parameter is taken MOD 4 and:
0 sets FORCE mode (the default mode).
1 sets XOR mode.
2 sets AND mode.
3 sets OR mode.
24CAN0Exchange the current pen and paper inks (see TXT INVERSE).
25EM9Set the matrix for a character (see TXT SET MATRIX). The first parameter specifies which character is to be set. The next 8 parameters are the matrix for the character (given top to bottom). If the character is not user definable then no action is taken.
26SUB4Set the limits of the text window (see TXT WIN ENABLE). The first two parameters specify the left and right columns of the window (the smaller is the left column); the last two parameters specify the top and bottom rows of the window (the smaller is the top row).
27ESC0No effect - available for user.
28FS3Set the colours in which to display an ink (see SCR SET INK). The first parameter is taken MOD 16 and specifies which ink is to be set, The second and third parameters are taken MOD 32 and specify the two colours for the ink.
29GS2Set the colours with which to display the border (see SCR SET BORDER). The two parameters are taken MOD 32 and specify the two colours for the border.
30RS0Move the current position to the top left corner of the window (see TXT SET CURSOR).
31US2Move the current position to a given position in the current window (see TXT SET CURSOR). The first parameter specifies the column to move to, the second parameter specifies the row to move to (row 1, column 1 is the top left corner of the window).

VIII : Missing

I'm looking for a copy of this appendix.

IX : The Prorammable Sound Generator

X : Kernel Block Layout

XI : The Alternate Register Set

XII : Missing

I'm looking for a copy of this appendix.

XIII : Hints, Tips and Workarounds

XIV : Printer Translation Table

A facility is provided whereby special characters which may appear on the screen and which are supported by the AMSTRAD DMP-1, will be printed even though the character codes for the screen and printer may be different. The majority of these symbols will only be available when the printer is switched to one of its foreign language modes.

For example, if a circumflex is to be printed then the character code for the screen would be &A0 but on the printer it is &5E, if a n &A0 was sent to the printer it would be translated into a &5E thus printing a circumflex. The following table shows all the default translation codes:

character Tran.Tran. US/UK France Germany Spain
#A0 Circumflex ˆ #5E Circumflex ˆ Circumflex ˆ Circumflex ˆ Circumflex ˆ
#A1 Acute ' #5C Backslash / C cedilla ç UC O umlaut Ö UC N tidle Ñ
#A2 Umlaut ¨ #7B Open curly { E acute É LC A umlaut Ä Umlaut ¨
#A3 Pound £ #23 Hash/pound #/£ Hash # Hash # Hash #
#A6 Section § #40 At @ A grave À Section § At @
#AB Plus/minus ± #7C Vertical bar | U grave Ù LC O umlaut ö LC N tilde ñ
#AC Division ÷ #7D Close curly } E grave È LC U umlaut ü Close curly }
#AD Not ¬ #7E Tilde ~ Umlaut ¨ Sharfes S ß Tilde ~
#AE Inverted ¡ #5D Close square ] Section § UC U umlaut Ü Inverted ¡
#AF Inverted ¿ #5B Open square [ degree ° UC A umlaut Ä Inverted ¿

The default translation table only translates the additional characters in the character set (#A0… #AF). It does not translate any of the standard ASCII characters or the graphics characters.

documentations/firmware/soft968/start.txt · Last modified: 2009/10/28 02:29 by grim