JOYCE internals

Here follows a number of test routines, which were developed in the course of the time while working with the Joyce. Base for some of the tools was the early contact with Amstrad and some informations I got from Cliff Lawson.
A first hint:1
On most of the (X)BIOS versions of the JOYCE known to me the address of the XBIOS (or of the BIOS funktion USERF) will be found at FC5A. However at least one system is known to me where this address differs. Therefore I recommend in principle the following initialization routine:
OS	equ	0000h
USERF	equ	30

XBIOSINIT:
	ld	hl,(OS+1)	; Load BIOS base address
	ld	de,3*(USERF-1)
	add	hl,de		; Calculate address for USERF
	ld	(XBIOS+1),hl	; Then store it
	ret
;
XBIOS:
	jp	$-$
After initialization XBIOS may now be called with:
	call	XBIOS
	dw	FUNCTION

Joyce keyboard and screen

What actually happens, if a key is pressed, which is then displayed on the screen?
  1. If a key is pressed the keyboard controller sends the number of the key pressed as well as the state of the key to the CPU.
  2. The CPU uses both values as an index into a translation table and determines the corresponding character value.
  3. This value will be used now as an index into the character matrix.
  4. The CPU calculates the appropriate place on the screen and copies eight bytes from the character matrix to this place.
Direct intervention.
  1. The key code may be read with a XBIOS function (KM KT GET - 00DAh).
  2. The translation tables depend on the OS version.
  3. The character matrix has a fixed address (B800h).
  4. The screen location may be calculated using the ROLLER RAM (From base address B600h).
Practical examples2.
Readout the keyboard.
In those days I would like to program an editor, servicing the keyboard I/O on the level of the XBIOS. Pressing a function key (eg. STOP, AUSBL) should call a corresponding service routine. In the other case the current ASCII value should be calculated by key number and state.
Look here for a Z80 test tool monitoring a lot of informations when pressing a key.

Saving the keyboard setting.
A tool saving the entire assignment of the keyboard into a file. This tools finds the address of the translation table by knowledge of the OS version.
Look here for the program.

A look inside the Roller RAM.
The screen of the Joyce is as well known optimally appropriate for a text display. The individual lines are administrated in the so called Roller RAM. For the computation of the real video addresses I found two different methods.
Look here for the tool showing both methods work correctly.

Determine a character by a given matrix.
Sometimes you want to know which character ist stored at a dedicated place in the video memory. The Joyce stores characters as a matrix so a tool recognising the matrix must be used.
Look here for his tool calculating an ASCII character (' ' up to '~') from the matrix. It also recognises attributes, eg. invers video, underlined.

1. The PCW machine must fulfill the following conditions:
  1. Z80 CPU
  2. CP/M version 3.x
  3. Banked CP/M version
  1. COMMON address C000H
  2. eXtended BIOS
  3. Machine type PCW
The present tool does test it. If all single tests are passed successfully, the tool checks for an additional serial interface.
2. Beneath many publications regarding graphics for the JOYCE another interesting driver may be found for BasiCode . The listing implies among other things machine code for manipulating the screen. See here for the assembler listing.