Calling CORE functions on the Z80 Playground

When you start CP/M the following 4 .bin files are loaded into memory:
Core – A bunch of core routines, for leds, disks etc
BIOS – A stub of a BIOS
BDOS – The main part of CP/M
CCP – The interface of CP/M.

The location that the files are loaded into is dictated by the cpm.cfg file. You see these values when CP/M starts:

CORE F600
BIOS F400
BDOS EA00
CCP.BIN DE00

The CORE.BIN file contains various functions for accessing the hardware, such as switching on LEDs etc.

The Disk, User and Rom LEDs are connected to the 16550 Modem Control Register port. The ports are shown in one of the Monitor screens:

16C550C UART Ports     CH376S Module Ports
-------------------    -------------------
TX / RX           8    Data Port        16
Interrupt Enable  9    Command Port     17
Interrup Status  10
Line Control     11
Modem Control    12
Line Status      13
Modem Status     14
Scratch          15

So, to turn on the Disk LED (for example) there is a piece of code already loaded up in the CORE that looks like this:
disk_on:
; turn disk LED on
in a, (uart_MCR)
or %00000100
out (uart_MCR), a
ret

If you want to call any of the core functions from a .com file you can include the core_jump.asm file in your program. This is just a list of all the core routines, arranged as a jump-indirection table, just to make life easier. You’ll need to include port_numbers.asm and locations.asm too, which are just some EQUs. You can then toggle the disk light by calling CORE_disk_toggle.

3 thoughts on “Calling CORE functions on the Z80 Playground”

Leave a Reply

Your email address will not be published. Required fields are marked *