Traditionally there are two reserved BIOS functions, RESERVE1(31) and RESERVE2(32), I've claimed the first as virtual syscalls that the emulator will handle.
They can be called like so:
; Set the function-number to call in HL
ld hl, 0x00
; Invoke the BIOS function
ld a, 31
out (0xff), a
We've implemented a small number of custom BIOS calls, documented below.
Test to see if the code is running under cpmulator, the return value is split into two parts:
- Registers are set to specific values:
- H ->
S
- L ->
K
- A ->
X
- H ->
- The DMA buffer is filled with a text-banner, null-terminated.
- If C == 0xFF return the value of the Ctrl-C count in A.
- IF C != 0xFF set the Ctrl-C count to be C.
Example:
;: get the value
LD HL, 0x01
LD C, 0xFF
LD A, 31
OUT (0xFF), A
;; Now A has the result
;; Set the value to 4
LD HL, 0x01
LD C, 0x04
LD A, 31
OUT (0xFF), A
Demonstrated in samples/ctrlc.z80.
On entry DE points to a text-string, terminated by NULL, which represents the name of the console output driver to use.
If DE is 0x0000 then the DMA area is filled with the name of the current driver, NULL-terminated.
Demonstrated in samples/console.z80
On entry DE points to a text-string, terminated by NULL, which represents the name of the CCP to use.
If DE is 0x0000 then the DMA area is filled with the name of the currently active CCP, NULL-terminated.
Demonstrated in samples/ccp.z80
- Removed. Obsolete.
- Returns the height of the terminal in H.
- Returns the width of the terminal in L.
- If C is 0x01 debug-mode is enabled.
- If C is 0x00 debug-mode is disabled.
- If C is 0xFF debug-mode is queried.
- 0x00 means it is not active.
- 0x01 means it is enabled.
Debug mode shows a summary of syscalls, and their results. It is faster than using the logfile and it is useful to be able to toggle it at runtime.
Demonstrated in samples/debug.z80