X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=test_src%2Fcli-hexdump.S;h=d071a0031126720a1d83597c2edf2c1de2413e05;hp=89767093fe4846ab040db29c1fdb1489168414e5;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=302f07c97444e2f5f5560dc2fd9af58d4b591d45 diff --git a/test_src/cli-hexdump.S b/test_src/cli-hexdump.S index 8976709..d071a00 100644 --- a/test_src/cli-hexdump.S +++ b/test_src/cli-hexdump.S @@ -1,7 +1,7 @@ /* cli-hexdump.S */ /* This file is part of the AVR-Huffman. - Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -127,7 +127,7 @@ cli_hexdump2: rjmp 1b /******************************************************************************/ -/* void cli_hexdump_block(const void* data, uint16_t length, uint8_t indent, uint8_t width) +/* void cli_hexdump_block(const void *data, uint16_t length, uint8_t indent, uint8_t width) * param data: r24:r25 * param length: r22:r23 * param indent: r20 @@ -142,11 +142,9 @@ LENG_1 = 17 .global cli_hexdump_block cli_hexdump_block: - tst r22 - brne 1f - tst r23 - brne 1f - ret + movw r26, r22 + adiw r26, 0 + breq simple_ret 1: push WIDTH push INDENT @@ -160,16 +158,16 @@ cli_hexdump_block: movw DATA_0, r24 movw LENG_0, r22 2: - clr r25 +; clr r25 ldi r24, '\r' rcall cli_putc - clr r25 +; clr r25 ldi r24, '\n' rcall cli_putc mov r4, INDENT tst r4 breq 4f -3: clr r25 +3:; clr r25 ldi r24, ' ' rcall cli_putc dec r4 @@ -181,8 +179,7 @@ cli_hexdump_block: tst LENG_1 brne 7f cp WIDTH, LENG_0 - breq 6f - brmi 7f + brlo 7f mov r22, LENG_0 6: inc r4 7: @@ -190,7 +187,7 @@ cli_hexdump_block: add DATA_0, WIDTH adc DATA_1, r1 sub LENG_0, WIDTH - sbc LENG_0, r1 + sbc LENG_1, r1 tst r4 breq 2b pop r4 @@ -200,6 +197,7 @@ cli_hexdump_block: pop DATA_0 pop INDENT pop WIDTH +simple_ret: ret