* back2ddt.asm Version 1 September 5, 1981
*
* Enables exiting from DDT via "G18" and returning via control-B.
*
* (C) 1981 by Roy Lipscomb, Logic Associates, Chicago
* Copying for non-profit distribution is permitted.
*
*
***********************************************************************
*
* This module is useful when debugging a program for which you
* have a .PRN file on disk. You can exit from DDT; display the
* .PRN listing; then return to DDT and the program being tested.
*
* Notes:
*
* 1) As supplied, BACK2DDT uses restart locations 3-6 (18h-37h).
*
* 2) The CCP must be protected from being overlaid. (This
* requirement is met if DDT is loaded via DDTX, a public-
* domain program by Ken Barbier available on many RCPM
* systems.)
*
* 3) The program being debugged will be preserved during
* CCP resident commands--ERA, DIR, TYPE, REN, or SAVE. Any
* other (transient) commands will overlay the program.
*
* 4) The CCP resets the dma to 80h, and alters 80h-ffh. Thus,
*
* a) Be sure you have nothing critical in this area
* (such as the program stack) when exiting with "G18".
*
* b) If your program uses a different dma, be sure to
* reset the dma after typing control-B.
*
* 5) Registers A, PSW, and PC are not restored by control-B.
*
********************************************************************
; change trap char, if so desired
trapchr equ 2 ;control-b means "back to ddt"
;do not change these
trubase equ 18h ;actual load point of trap
bdos equ 5
cindisp equ 10 ;displacement of conin addr in jmptable
display equ 2
cr equ 13
lf equ 10
poph equ 0e1h ;one of the test instructions
; "done" message
eom equ '$'
done db cr,lf,'Back2ddt version 1, Sept 81'
db cr,lf
db cr,lf,'After protecting the CCP and loading DDT,'
db cr,lf,'exit DDT via "G18" and return via control-B.'
db cr,lf,eom
notdone db cr,lf,'Back2ddt already loaded: no action',cr,lf,eom
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; exit from ddt (save important values) (takes 15 bytes)
ddtexit push b ;save registers
push d
push h
lhld 6 ;save ddt trap address
push h
lxi h,0 ;save stack pointer
dad sp
shld stksav-adjust
rst 0 ;reboot
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; if trapchr found, jmp to ddt; else return (takes 17 bytes)
trpentr call 0 ;perform conin (0 changed at run time)
cpi trapchr ;go to ddt?
rnz ;no, back to CCP