X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/a17b9bbb1d4482a476629d3efdd20dc3ab01bc77..dd7aea8cf3e0f67cce1a9a2999404bfb5d05ffc5:/avrcpm/avr/utils.asm diff --git a/avrcpm/avr/utils.asm b/avrcpm/avr/utils.asm index 5a6efef..4d8122a 100644 --- a/avrcpm/avr/utils.asm +++ b/avrcpm/avr/utils.asm @@ -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: