Skip to main content
2 of 9
added 221 characters in body
tofro
  • 37k
  • 4
  • 94
  • 183

You can perform a warm start by coding a

  rst  0      or
  jmp  0

This re-initializes the system and re-loads the transient part of the CCP (which obviously must be present on the logged-in disk). If you do that, you can consider the memory occupied by that transient part "yours" and use it for your program.

If you left the original stack intact that was present when your program was first executed, you can restore that stack pointer and simply return to the CCP

; end of program, return to CCP
LHLD OLDSP    ; restore initial stack pointer 
              ; (must have been saved before)
SPHL
RET           ; to the CCP

This saves the end user waiting for a warm start (which normally really isn't long). It does, however, limit your program's available memory (not really significantly, but on CP/M, every byte might count), because you need to preserve the CCP's environment (code and stack) while your program is running.

Smaller utilities typically used the latter way, while bigger, memory-hungry programs used the first approach.

tofro
  • 37k
  • 4
  • 94
  • 183