]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avrcpm/avr/utils.asm
* This code is experimental and may destroy data on disk images!
[avrcpm.git] / avrcpm / avr / utils.asm
index 5a6efefc980c01e990586682b47c22c4920ffa0d..4d8122a763904b996116998ae1e71e5f58130a64 100644 (file)
@@ -111,6 +111,57 @@ printhexn_isno:
        pop temp
        ret
 
+
+; Prints a single space
+
+dbg_printspace:
+       ldi     temp,' '
+       rjmp    uartputc
+
+; Prints 16 bytes pointed to by Z in hex.
+
+dbg_hexdump_line:                      ;Address in z
+       push    temp2
+       push    temp
+       printnewline
+       movw    temp,z                  ;Print address
+       rcall   printhexw
+       ldi     temp2,16                ;16 byte per line
+       rcall   dbg_printspace
+dbg_hdl1:
+       cpi     temp2,8
+       brne    PC+2
+       rcall   dbg_printspace
+       
+       rcall   dbg_printspace
+       ld      temp,z+
+       rcall   printhex
+       dec     temp2
+       brne    dbg_hdl1
+       sbiw    z,16
+       
+       rcall   dbg_printspace
+       rcall   dbg_printspace
+       ldi     temp2,16
+dbg_hdl2:
+       ld      temp,z+
+       cpi     temp,' '
+       brlo    dbg_hdpd
+       cpi     temp,0x7F
+       brlo    dbg_hdp
+dbg_hdpd:
+       ldi     temp,'.'
+dbg_hdp:
+       rcall   uartputc
+       dec     temp2
+       brne    dbg_hdl2
+       sbiw    z,16
+       rcall   dbg_printspace
+       pop     temp
+       pop     temp2
+       ret
+       
+
 ;Prints the zero-terminated string following the call statement. 
 
 printstr: