ROM Calls for Sound, Interrupts, and Tape Operations

ZX Land #02

In the Second Part of the ROM Description

I will present:

  • calling the sound routine with a specified pitch and duration
  • handling maskable interrupts
  • reading the BREAK key
  • handling the LOAD and SAVE routines

The BEEPER routine is called with:

CALL #03B5

Input parameters:

  • In register HL, specify the pitch of the sound (middle C).
  • In register DE, specify the product of f*t, where:
    • f is the sound frequency
    • t is the sound duration

The maskable interrupt handler is called with RST 8, or with:

PUSH AF ;save
PUSH HL ;registers
LD HL,(FRAMES);
INC HL
LD (FRAMES),HL
LD A,H
OR L
JR NZ,KEYIN

INC (FRAMES3)
KEYIN
PUSH BC
PUSH DE
CALL #02BF;keyboard
POP DE;and update
POP BC;LAST K
POP AF
RET

This subroutine is called approximately every 20 ms. It is useful when working with interrupts under BASIC.

Tape-loading routines have been described in many publications. As a reminder, here is the basic information:

LOAD -
SAVE -
CALL #04C2

Input parameters:

  • Registers DE: length of the block to be loaded
  • Register IX: starting address of the block
  • Register A:
    • 0 means header
    • 255 means data block
  • Carry flag (LOAD only):
    • 1 — load into memory
    • 0 — verify

Output parameters:

  • Flags C and Z:
    • 0 1 — loading error
    • 0 0 — wrong file type
    • 1 1 — loading successful

Selected and described by:
WILL

Share your thoughts about the article