; ; Copyright (C) 2008 Martin Furter ; ; This file is part of avr_xc3jtag ; ; avr_xc3jtag is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 3, or (at your option) ; any later version. ; ; avr_xc3jtag is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with avr_xc3jtag; see the file COPYING. If not, write to ; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ; ;============================================================================== .include "avr/atmega88.inc" .global usart2jtag_binary_data .type usart2jtag_binary_data, @function ; uint16_t usart2jtag_binary_data() usart2jtag_binary_data: ; register usage: ; r16 data register and scratch ; r17 data carry register and scratch ; r18 data carry register ; r19 last line flag ; r20 byte counter ; push registers onto stack push r16 push r17 push r18 push r19 push r20 ; clear last line flag clr r19 NEXT_LINE: ; wait for and read usart character lds r16, ADR_UCSR0A andi r16, 1< 26 subi r16, 71 cln ret G6B_DIGIT: ; '0' = 48 cpi r16, 48 brmi G6B_ERROR ; '9'+1 = 58 cpi r16, 58 brpl G6B_ERROR ; add 4: '0' -> 52 subi r16, -4 cln ret G6B_UNDERSCORE: ldi r16, 62 cln ret G6B_AT_SIGN: ldi r16, 63 cln ret .size usart2jtag_binary_data, .-usart2jtag_binary_data