Architecture Notes

OZ 5.0 requires 512K of ROM and a minimum of 32K RAM. The ROM is divided in a core of 128K, an application space of 128K and a 256K file area.

This document describes the bank organisation and details their acronyms. Acronyms are followed by a _BNK suffix in OZ definition files.

The core

It contains the kernel, static structures, API calls.

Kernel calls are done by OS API, it fits in 3 banks.

  • KN0 stands for primary kernel bank
  • KN1 for secundary kernel bank
  • KN2 for auxiliary kernel bank

Actually, the core static structures are held in KN2 and contains fonts, keyboard maps, localized texts.

API calls are DC, GN and FP calls. DC stands for director/CLI, GN for general usage, FP for floating point. All API except OS 1 byte and FP calls have a space up to 32K. This new feature implemented in OZ 5.0 defines primary and secundary banks.

  • DC0 : primary DC bank
  • DC1 : secundary DC bank
  • GN0 : primary GN bank
  • GN1 : secundary GN bank

Actually, FP calls are held in GN1 bank (may change in the future).

Important convention

Primary banks are always bound to segment 3, secundary to segment 2.
Secundary bank number always follows its primary bank number.

KN1 = KN0 +1
DC1 = DC0 +1
GN1 = GN0 +1

OZ Memory segment configuration

Memory configuration during calls are described below :

Segment

HARD

Reset
SOFT

Reset
OS

1 byte
OS*

2 bytes
DC*
GN*
FP
S0L
$0000 - $1FFF
KN0L
R20L
R20L
R20L
R20L
R20L
R20L
S0H
$2000 - $3FFF
KN0H
R20H
Usr
Usr
Usr
Usr
Usr
S1
$4000 - $7FFF
KN0
Usr
Usr
Usr
Usr
Usr
Usr
S2
$8000 - $BFFF
KN0
KN2
Usr
KN1
DC1
GN1
Usr
S3
$C000 - $FFFF
KN0
KN0
KN0
KN0
DC0
GN0
FP

* = OZ push frame established

RAM

The system ram is a minimum of 2 banks designated by :

  • R20 main system bank, its lower part is always bound to S0L
  • R21 holds the MAT for :RAM.0 device and other filing system device DORs

When inserted, additionnal system ram banks are :

  • R40 holds the MAT for :RAM.1 device
  • R80 holds the MAT for :RAM.2 device
  • RC0 holds the MAT for :RAM.3 device

API

OZ API is addressed by RST 20h followed by 1 or 2 bytes identifier. The FP package is an exception due to register design constraints and uses RST 18h.

The 1 byte calls are always OS API. They are intend to provide a fast response (screen driver, handles, memory allocation...). OZ push frame is not invoked. Alternate register set is set on entry. An exchange instruction is required to read input values.

The 2 bytes calls always set up the OZ Push frame before entering the call. Direct register set and input value are exposed on entry. Those values can be reclaimed using pushframe index added to IY.

This clever design stands for all the OS 2 bytes, DC and GN calls.

OZ Push frame

On entry of all two bytes calls, IY holds a frame of 16 bytes pushed to the stack.

This frame contains environment : caller PC, previous segment 2 and 3 bindings, contents of AF, BC, DE, HL, IY registers.

Notice that IX is not preserved.

Exit is generaly performed by LSB = $03 of the API table in segment 3.

On exit, segment 2 and 3 are restored, thus any change of segment 2 has not to be restored by the call.

This powerful design gives a kind of temporary variable area for the call.

Elf code heavily rely on this stack frame.

Debug interface extend this push frame to all Z80 registers.

The applications

They are divided in crucial applications tight to the system :

  • Shell
  • Panel/PrinterEd
  • Filer
  • Clock/Calendar/Alarm

And optional ones which could be removed :

  • Pipedream
  • Diary
  • BBC Basic
  • Calculator
  • Terminal
  • Imp-Export
  • Eazylink
  • FlashStore

An additional MTH bank holds all the menu commands, help and system tokens.

Notice that Index belongs to the core, its code is mixed with DC API in DC0 bank.

The file area

The system file area is named :EPR.0 or :EPR.1 if OZ runs from slot 1. Its directory layout follows the unix convention, Shell commands stand in :EPR.x/bin/, man pages in :EPR.x/usr/man/, ...