; Print and Debug functions
;
-; Copyright (C) 2010 Leo C.
+; Copyright (C) 2010-2013 Leo C.
;
; This file is part of avrcpm.
;
; 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
+printspace:
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:
+ ldi temp,' '
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.
+;-----------------------------------------------------------------------
+; Prints 16 bytes RAM, pointed to by Z in hex.
+
+#if 0
+
+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 printspace
+dbg_hdl1:
+ cpi temp2,8
+ brne PC+2
+ rcall printspace
+
+ rcall printspace
+ ld temp,z+
+ rcall printhex
+ dec temp2
+ brne dbg_hdl1
+ sbiw z,16
+
+ rcall printspace
+ rcall 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 printspace
+ pop temp
+ pop temp2
+ ret
+#endif
+
;-----------------------------------------------------------------------
; Print a line with the 8080/Z80 registers