Personal Computer News


Lost Z80 Machine Code Found Again

Categories: Letter

 
Author: Rosemary Oakeshott
Published in Personal Computer News #076

Lost Z80 Machine Code Found Again

The tip for finding where your machine code is located (Microwaves, issue 73) will fail if it is interrupted between the two DEC SPS. To correct it you just prepare the stack pointer before the CALL.

LD, HL, -2
ADD HL, SP
CALL RET; call any RET
LD SP, HL
POP HL; address of LD SP,HL to HL

If interrupts are enabled and there is no hurry the CALL RET can be replaced by HALT, thus making the same routine independent of ROM.

  • If your machine code is called from Basic its address will almost certainly be in one of the registers. On the Spectrum it will be in BC.
  • The Spectrum has the following routine at 1FC6H:

POP HL
RET Z
JP (HL)

CALL 1FCH6H, with Z reset, will return the address of your next instruction in HL.

Rosemary Oakeshott, Romset, Hants

Rosemary Oakeshott