3 This file is part of the AVR-Huffman.
4 Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "avr-asm-macros.S"
22 #define CMDLIST_ENTRY_SIZE 8
24 /******************************************************************************/
25 /* uint16_t max_cmd_length(PGM_VOID_P cmdlist){
29 str = (char*)pgm_read_word(cmdlist);
30 cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
38 * param cmdlist: r24:r25
42 .global max_cmd_length
65 adiw r30, CMDLIST_ENTRY_SIZE-2
72 /******************************************************************************/
79 breq print_echo_status
85 breq print_echo_status
133 .asciz "\r\necho is o"
135 /******************************************************************************/
136 /* int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist)
138 * param maxcmdlength: r22:r23
139 * param cmdlist: r20:r21
159 .global search_and_call
185 2: rjmp snc_auto_help
195 rcall firstword_length
202 ldi r22, lo8(exit_str)
203 ldi r23, hi8(exit_str)
213 ldi r24, lo8(nocommand_str)
214 ldi r25, hi8(nocommand_str)
223 adiw r28, CMDLIST_ENTRY_SIZE
236 breq 4f ;snc_return_2
256 .asciz "\r\ncommand not found, try 'help'"
258 /******************************************************************************/
259 /* void cli_option_listing(char* buffer, PGM_VOID_P cmdlist)
260 * param buffer: r24:r25
261 * param cmdlist: r22:r23
271 .global cli_option_listing
293 adiw r28, CMDLIST_ENTRY_SIZE
297 ldi r24, lo8(itemprefix_str)
298 ldi r25, hi8(itemprefix_str)
304 ldi r24, lo8(prompt_str)
305 ldi r25, hi8(prompt_str)
318 /******************************************************************************/
319 /* void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist)
320 * param maxcmdlength: r24:r25
321 * param cmdlist: r22:r23
335 ldi r24, lo8(ahelphead_str)
336 ldi r25, hi8(ahelphead_str)
358 4: ldi r24, lo8(sep_str)
359 ldi r25, hi8(sep_str)
361 ldi r22, lo8(none_str)
362 ldi r23, hi8(none_str)
369 ldi r22, lo8(yes_str)
370 ldi r23, hi8(yes_str)
373 ldi r24, lo8(sep2_str)
374 ldi r25, hi8(sep2_str)
379 rcall cli_hexdump_byte
382 rcall cli_hexdump_byte
389 adiw r28, CMDLIST_ENTRY_SIZE-4
396 .asciz "\r\n[auto help] available commands:\r\n <command> - <params> - <address>\r\n"