Page 1 of 1

improve debug to accpet new lines

Posted: Mon May 31, 2004 4:06 am
by Dreglor
it would be nice to have debug accept new line charaters

Posted: Mon May 31, 2004 9:26 am
by fweil
Dreglor,

I would like also such a feature : splitted strings and an hexdump output ...

Here is what I am using until it exists :

Code: Select all

;
; HexDump for debugger
;
Procedure DebugSplittedString(String.s, Length.l)
  For i = 1 To Len(String)
    Debug Str(i) + " : " + Mid(String, i, Length)
    i + Length - 1
  Next
EndProcedure

Procedure HexDump(Address.l, Length.l, Width.l)
  Debug "***** HexDump : " + Hex(Address) + " rendering " + Hex(Length) + " bytes"
  *Buffer = AllocateMemory(Length)
  CopyMemory(Address, *Buffer, Length)
  For i = 0 To Length - 1
    If PeekB(*Buffer + i) < ' '
        PokeB(*Buffer + i, ' ')
    EndIf
  Next
  For i = 0 To Length - 1
    a$ = ""
    For j = i To i + Width - 1
      a$ = a$ + RSet(Hex(PeekB(Address + j) & $FF), 2, "0") + " "
    Next
    Debug RSet(Hex(Address + i), 8, "0") + " | " + a$ + " - " + PeekS(*Buffer + i, Width)
    i + Width - 1
  Next
EndProcedure

  ;
  ; Generate a randomly filled string
  ;
  a$ = "The quick brown fox jumps over the lazy dog ... "
  a$ = a$ + a$
  a$ = a$ + a$

  Debug a$
  
  HexDump(@a$, Len(a$), 32)
  
  DebugSplittedString(a$, 40)
  
End