Platform Cambridge z88 - z88dk/z88dk GitHub Wiki

Z88 Platform

Classic library support (+z88)

  • Native console output
  • Native console input
  • ANSI vt100 engine
  • Generic console
    • Redefinable font
    • UDG support
    • Paper colour
    • Ink colour
    • Inverse attribute
    • Bold attribute
    • Underline attribute
  • Lores graphics
  • Hires graphics
  • PSG sound
    • ETracker (SAA tracker)
    • PSG Lib (SN76489)
    • Arkos2 Player (AY)
    • WYZ Player (AY)
    • Vortex tracker (AY)
  • One bit sound (on the keyboard speaker)
  • Inkey driver
  • Hardware joystick
  • File I/O
  • Far heap
  • Interrupts
  • RS232

Introduction

The z88 operating system, OZ, provides a lot of functionality for programmers which permit multiple applications to co-exist and conserve resources (i.e. memory) as necessary. z88dk aims to hide away a lot of the details and provide a relatively simple solution to developing of applications.

For details of the functionality OZ exposes, it's advisable to read the Z88 Developer Notes. The notes describe a lot of detail that is skipped over here.

Screen handling

Due to a combination of factors: the unusual size of the z88 display, the nature of the OZ operating system, displaying text and graphics on the z88 is slightly different to other machines:

  • Both text and graphics can be presented at the same time using different areas of the screen.
  • Text can either be displayed using the z88 firmware or in the graphical area.

The easiest way to leverage this duality is to use --generic-console, this supports the following screen modes:

  • Mode 0: z88 native text window with a 94x8 text display
  • Mode 1: z88 native text window (54x8) and a 256x64 graphical display
  • Mode 2: A 512x64 graphical display and a very small text window

The --generic-console driver determines whether to print in the text window or graphics based on CRT_FONT being defined. This can be configured using the command line --pragma-redirect:CRT_FONT=.... or using console_ioctl() and IOCTL_GENCON_SET_FONT32.

Note, the function fputc_cons_native() defined in <stdio.h> always prints using the firmware printer.

You can call z88_disable_cursor() to remove the blinking cursor from the text display.

Lower level support

Alternatively, if you wish to handle all the window management yourself, the graphics display can be opened using the following code:

 struct window gfx; /* Window structure */

 gfx.graph = 1;
 gfx.width = 255;
 gfx.number = '4';

 /* Open map with width 256 on window #4 */
 window(&gfx);

512px wide graphics display

A 512px wide graphics display can be created with the following code:

 struct window gfx; /* Window structure */

 gfx.graph = 2;
 window(&gfx);

Maths Library

The z88's floating point routines are supported, to use them, add -lmz to the command line when compiling with sccz80.

BBC Basic Target

By default, z88dk generates binaries that can be LOADed into the BBC Basic application and run. Using this target is the easiest way to get an application up and running on a real z88.

Command Line

zcc +z88 .....

Z88 Application Target

Z88dk can be used to create a z88 Applications that can be run from the Main Menu. When using emulators this is by far the easiest way to developer. All application types: good, bad and ugly can be constructed. When creating applications, the farheap is available.

You have to add this section to the top of your code (replace "Hello World" with your application name):

 #if defined(__Z88__)	
      #include <arch/z88/dor.h>

      #define HELP1 "Hello World"
      #define HELP2 ""
      #define HELP3 ""
      #define HELP4 ""
      #define HELP5 ""
      #define HELP6 ""
      #define APP_INFO "HelloWorld app"
      #define APP_KEY 'H'
      #define APP_NAME "HelloWorld"
      #define APP_TYPE AT_Bad

      #include <arch/z88/application.h>
 #endif

Command Line

zcc +z88 -subtype=app -create-app ...

The output of this command will be a .epr file (suitable for insertion into Emulators) and .63 (.62, .61, .60) files representing the individual banks.

To generate files suitable for Installation with OZ4.5+ and OZ5 use -subtype=installer. Both 4 and 5 installer files will be created, (.app, .apX for OZ4.x and .a5p for OZ5).

Z88 Packages

Only useful for OZ3.x and OZ4.0

Z88dk can create Packages (shared libraries) that allow code to be shared between applications. ZSock was built using this technique to provide TCP/IP services for the z88.

Command Line

As for applications, i.e.:

zcc +z88 -create-app -subtype=app app.c

Z88 Shell Target

The z88 shell is a unix-like shell providing command line file manipulation on the z88. Naturally, z88dk supports generating applications that can be run from the command line.

Command Line

zcc +z88 -subtype=z88shell -create-app cmd.c

The above command line will create commands that run under the Forth shell written by Garry Lancaster for OZ3. For the shell built into OZ5 use the following commands:

zcc +z88 -subtype=z88shell5 -create-app cmd.c

ZSock Devices

ZSock devices can be compiled with z88dk, these are raw binary blobs that sit at address 8192 and cannot use a stdio resources.

Command Line

zcc +z88 -subtype=zsockdev

z88net library

Command Line

zcc +z88 -clib=net

Emulator Notes

OZvm

https://cambridgez88.jira.com/wiki/spaces/OZVM/

At the bottom of the keyboard window, you first have to change "Slot 0" to 128K RAM, otherwise you will get a message that an expanded machine is required. Then click "Slot 1", change the type to "EPROM", click "Load Images" and select the .epr file containing your program. After clicking "Yes", your program will show up in the "Applications" window at the bottom of the list.

Currently (as of Release 1.3.0), sound is not implemented yet.

Zesarux

Zesarux also supports the z88. However usage is not as user friendly as OZvm.

MAME

https://www.mamedev.org/

Attach the .epr file as Cartridge 1. From the command line, this can be done using the -cart1 option. Your program will show up in the "Applications" window at the bottom of the list.

Currently (as of Release 0.282), in screen mode 2 the lower half of the screen is filled with characters, this is an emulator issue. Use OZvm for testing programs using screen mode 2.

Links

Compiled Z88dk demos in 'Z88 forever'

Gunther Strube / Interlogic - z80asm and more

⚠️ **GitHub.com Fallback** ⚠️