+
+; 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
+
+