Spectrum pages
Home -> Spectrum -> Sinclair LOGO robot interface

_____________________________________________________________________

Sinclair LOGO robot interface

The Sinclair implementation of LOGO includes some support for output using a physical turtle robot, or some other external device such as a high-resolution display. The manufacturer of the device would be expected to provide a driver, which the STARTROBOT command would load from cassette or microdrive.

The driver should be a normal CODE file, named ROBOT  BIN (that is, two spaces between 'ROBOT' and 'BIN'). It should begin with:

	DEFW	address	;Destination address for 'jumpblock'. This should be 
			;calculated such that the last byte of the driver is 
			;loaded at 0FDFFh. So, for example, you could use
			;		DEFW 0FE00h + jumpblock - driverend

jumpblock:
	JP	function0		;Initialise / reset
	JP	function1		;Forward
	...
	JP	function19
	...
	<driver code goes here>
	...
driverend:
	END

The jumpblock at the start of the driver has 20 entries, jumping to the 20 functions the driver should provide. In all cases, a return with A=0FFh leads to the error message "ROBOT PROBLEM" being displayed.

The functions will be called with JP (IX), so it would be possible to write the driver in a position-independent manner and use the passed value of IX to locate the driver code.

Function 0: Initialise / Reset

Called immediately after the driver is loaded. It will be entered with A=0. On return A should be 0 (robot not present), 1 (robot ready) or 0FFh (robot failed). On return, if L is nonzero the screen turtle will be disabled. If it is zero the screen turtle and robot will operate in parallel.

Function 1: Forward

Move the robot forward. HL gives the number of steps.

Function 2: Backward

Move the robot backward. HL gives the number of steps.

Function 3: Turn right

Turn clockwise. HL gives the angle in degrees.

Function 4: Turn left

Turn anticlockwise. HL gives the angle in degrees.

Function 5: Pen up

Lift the pen (so the turtle doesn't leave a trail).

Function 6: Pen down

Lower the pen (so the turtle leaves a solid trail).

Function 7: Pen reverse

If the output is to a device on which writing in XOR mode is possible, select it. This seems unlikely for a physical turtle, but you never know.

Function 8: Pen erase

Select erase pen (so the turtle blanks out anything it passes over).

Function 9: Set heading

Set the turtle direction as an absolute angle. HL gives the heading.

Function 10: Unknown

Does not appear to be called by Sinclair LOGO.

Function 11: Set pen colour.

Select the pen colour specified in HL.

Function 12: Set turtle position.

Move the turtle to the supplied coordinates. HL=X coordinate, DE=Y coordinate.

Function 13: Clear the display.

If the output is to a device which can be cleared, clear it.

Function 14: Get heading

Get the turtle's current heading. On return if A is nonzero then HL is treated as the heading in degrees. If the turtle does not track its heading then return A=0 and HL is ignored.

Function 15: Get position

Get the turtle's current position. On return if A is nonzero then HL is treated as the X coordinate, DE as the Y coordinate. If the turtle does not track its position then return A=0; DE and HL are ignored.

Function 16: Get pen colour

Get the turtle's current pen colour. On return if A is nonzero then HL is the active pen colour. If the turtle doesn't track current pen colour then return A=0 and HL is ignored.

Function 17: Set background colour.

Select the background colour specified in HL.

Function 18: Get background colour

Get the device's current background colour. On return if A is nonzero then HL is the active background colour. If the device doesn't track current background colour then return A=0 and HL is ignored.

Function 19: Beep

Play a beep. HL=duration, DE=frequency.

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

John Elliott 2026-10-14