home *** CD-ROM | disk | FTP | other *** search
- \\ WATCHER.SEQ Watch window for debugger by Tom Zimmer
-
- Created at the suggestion of Jerry Boutelle
-
- Links into the debugger through the words: .WATCH, .WATCHER & SETWATCH
- to provide a way to have a small area of memory watched while you step
- through a program.
-
- {
-
- only forth also definitions hidden also
-
- 0 value watch_address
-
- : %.watch ( -- )
- watch_address 0= ?exit \ if not watching, leave
- savecursor >attrib3
- save> base hex \ dump is in HEX
- save> dumpseg ?cs: dumpseg ! \ dump code segment
- 0 split-l# at eeol \ clear the watch line
- 0 split-l# 1- at \ move to watch line-1
- watch_address dln
- restore> dumpseg
- restore> base \ restore the base
- restcursor ;
-
- ' %.watch is .watcher
-
- watchon \ enable watchpoints in the debugger
-
- 0 value depth_save
-
- 32 array stibbuf
-
- : watch_cmd ( -- f1 )
- tib 31 expect span @ #tib ! >in off
- bl word skip'c' ?uppercase
- c@ 0= dup ?exit drop \ leave if empty input
- here 1+ c@ ''' <>
- if here find
- if !csp execute
- sp@ csp @ =
- if !> watch_address true
- else sp0 @ sp! \ clear stack
- 0 0 0 0
- beep false
- then
- else %number nip
- if !> watch_address true
- else drop false
- then
- then
- else here count 1 /string here place
- bl here count + c! \ add trailing blank
- here find
- if !> watch_address true
- else drop beep false
- then
- then ;
-
- : %setwatch ( -- )
- savecursor
- depth dup !> depth_save
- begin dup 0>
- while 1- swap >r
- repeat drop 0 0 0 0 \ some dummy parameters
- 0 split-l# at >attrib3
- ." Enter watch WORD, 'WORD or address [0=remove]:"
- stibbuf save!> 'tib
- save> #tib #tib off
- save> >in
- at? 2>r
- begin 2r@ at eeol 2r@ at
- watch_cmd
- until 2r> 2drop
- restore> >in
- restore> #tib
- restore> 'tib
- depth 0 ?do drop loop \ clear dummy parameters
- begin depth_save 0> \ recover stack contents
- while r> -1 +!> depth_save
- repeat
- restcursor ;
-
- ' %setwatch is setwatch
-
- }
-
-
-