VolksForth/msdos/tools.fb

1 line
13 KiB
Plaintext
Raw Normal View History

\ ks 22 dez 87 Some simple tools for debugging. A state-of-the-art, interactive single step tracer and a couple of tools for decompiling and dumping \ Programming-Tools word set cas 19july2020 Onlyforth \needs Assembler 2 loadfrom asm.fb Vocabulary Tools Tools also definitions 1 11 +thru Onlyforth .( Tools loaded ) cr \ trace - next ks 11 jun 87 | Variable nest? nest? off Label tracenext 0 # nest? #) byte cmp 0= ?[ $5555 # I cmp here 2- >label (ip >= ?[ [[ swap lods A W xchg W ) jmp ]? $5555 # I cmp here 2- >label ip) CS ?] ][ 0 # nest? #) byte mov ]? $5555 # W mov here 2- >label >tracing W ) jmp end-code | (ip Constant <ip | ip) Constant ip> | : (debug ( addr -- ) dup <ip ! BEGIN 1+ dup @ ['] unnest = UNTIL 2+ ip> ! ; \ install Tracer ks 11 jun 87 Label (do-trace next-link # W mov D push $E9 # A- mov tracenext 1+ # C mov [[ W ) W mov W W or 0= not ?[[ A- -4 W D) mov C D mov W D sub D -3 W D) mov ]]? D pop ret end-code Code do-trace (do-trace # call Next end-code ' end-trace Alias end-trace | Code (step (do-trace # call R ) I mov R inc R inc lods A W xchg W ) jmp | Create: nextstep (step ;