ATTINY COMPILER

HI EVERYONE!
here is my request for help, i know it may seem a bit strange but i need someones' help :wink:

i'm programming an attiny2313 using arduino. i have an already written assembly program, but unfortunately at the moment i cannot have access to a compiler...

could someone please be so kind to compile for me the .asm file and send me back the .hex??

here are the specifics :

ATTINY2313

EXTERNAL CLOCK 10MHZ INTERNALLY DIVIDED BY 8

FUSES:
LOW 0X4F
HIGH 0XDB

please ignore comments in the program as they are referred to another clock speed.

hoping that someone can help me,
thanks!

i cannot attach .asm file so i'll write the code instead :wink:

.include "../include/tn2313def.inc"

.def	temp = R16
.def	temp2 = R17
.def	count = R18
.def	curchar = R19
.def	char = R20

;===============================================================================

.dseg
	RAM_String: .byte 20

;===============================================================================

.cseg
.org 0x000
	rjmp	reset
	
;===============================================================================

.equ	CharsPerLine = 18 ;maximum number of chars per line
.equ	NumChars = 14 ;number of possible chars
firstchar:
	.db "E+x:#*STMC= -%"
regularchar:
	.db "#0123456789-,."
	
;===============================================================================

reset:
	;set stackpointer to end of RAM
	ldi	temp, RAMEND
	out	SPL, temp
	
	;initialize ports
	ldi	temp, 0x46
	out	DDRD, temp
	ldi	temp, 0x3B
	out	PORTD, temp
	
	;enable UART
	ldi	temp, 1<<TXEN | 1<<RXEN
	out	UCSRB, temp
	ldi	temp, 7 ;9600 Baud @ 0.9216 MHz
	out	UBRRL, temp
	
	;initialize registers
	ldi	YL, RAM_String
	ldi	count, 0
	
loop:
	;get char from UART
	rcall	getc
	cpi	temp, 0x08 ;<Backspace> => delete last char from buffer
	breq	uart_bs
	cpi	temp, 0x0a ;<LF> => print line
	breq	print
	cpi	temp, 0x0d ;<CR> => print line
	breq	print
	cpi	temp, 0x20 ;other control char => ignore
	brlo	loop
	cpi	count, 18
	brsh	loop ;overflow => discard char
	;regular ASCII char: save to buffer
	st	Y+, temp
	inc	count
	rjmp	loop
	
uart_bs:
	;backspace
	cpi	count, 0
	breq	loop
	dec	count
	sbiw	YH:YL, 1
	rjmp	loop

print:
	;print string
	ldi	temp, 0 ;add end marker
	st	Y, temp
	ldi	YL, RAM_String
	rcall	print_string
	;send confirmation to UART
	ldi	temp, 'P'
	rcall	putc
	;reset registers
	ldi	count, 0
	ldi	YL, RAM_String
	rjmp	loop

;===============================================================================

getc:
	;receive char from UART
	sbis	UCSRA, RXC
	rjmp	getc
	in	temp, UDR
	ret
	
;--------------------

putc:
	sbis	UCSRA, UDRE
	rjmp	putc
	out	UDR, temp
	ret

;===============================================================================
	
print_string:
	;print string at YH:YL
	sbi	PORTD, 2 ;enable motor
	clr	count
print_string_length:
	;find length of string and move RAM pointer to end of string
	ld	temp, Y+
	cpi	temp, 0
	breq	print_string_start
	inc	count
	cpi	count, CharsPerLine+1 ;print only the first CharsPerLine chars
	brlo	print_string_length
print_string_start:
	;initialize for first char (rightmost, using 'firstchar' charset)
	cpi	count, 0
	breq	print_string_empty
	ldi	ZL, LOW(firstchar*2)
	ldi	ZH, HIGH(firstchar*2)
	sbiw	YH:YL, 1
	rcall	wait_round
print_string_char:
	;find char in printer charset table
	ld	temp, -Y
	ldi	char, -1
print_string_char_loop:
	inc	char
	cpi	char, NumChars ;char not found => non-printable char
	brsh	print_string_char_invalid
	lpm	temp2, Z+
	cp	temp2, temp
	brne	print_string_char_loop
print_string_char_print:
	;wait until print wheel is at correct position
	cp	char, curchar
	breq	print_string_char_now
	brsh	PC+3
	rcall	wait_round
	rjmp	print_string_char_print
	rcall	wait_start
	rcall	wait_end
	rjmp	print_string_char_print
print_string_char_now:
	;print char
	rcall	wait_start
	sbi	PORTD, 6 ;enable magnet
	rcall	wait_end
	cpi	count, 1 ;last char => line feed
	brne	PC+2
	rcall	wait_start
	cbi	PORTD, 6 ;disable magnet
	rcall	wait_end
	;initialize for next char (using 'regularchar' charset)
	ldi	ZL, LOW(regularchar*2)
	ldi	ZH, HIGH(regularchar*2)
	dec	count
	brne	print_string_char
	ldi	temp, 128 ;keep motor running for ~100ms to finish line feed
	ldi	temp2, 0
print_string_motorwait:
	dec	temp2
	brne	print_string_motorwait
	dec	temp
	brne	print_string_motorwait
	cbi	PORTD, 2 ;disable motor
	ret
	
print_string_empty:
	;empty string: print a space char to get a line feed
	ldi	count, 1
	sbiw	YH:YL, 1
	ldi	temp, ' '
	st	Y+, temp
	ldi	temp, 0
	st	Y+, temp
	rjmp	print_string_start
	
print_string_char_invalid:
	;char not in charset for current column: print first charset entry
	ldi	char, 0
	rjmp	print_string_char_print
	
;-------------------

wait_start:
	;wait for printer "char start" singal
	sbis	PIND, 3
	rjmp	PC-1
	rcall	shortdelay
	sbic	PIND, 3
	rjmp	PC-1
	rcall	shortdelay
	inc	curchar
	ret

wait_end:
	;wait for printer "char end" signal
	sbic	PIND, 4
	rjmp	PC-1
	rcall	shortdelay
	sbis	PIND, 4
	rjmp	PC-1
	rcall	shortdelay
	ret

wait_round:
	;wait for printer "round start" signal
	sbis	PIND, 5
	rjmp	PC-1
	rcall	shortdelay
	sbic	PIND, 5
	rjmp	PC-1
	rcall	shortdelay
	ldi	curchar, 0
	ret

shortdelay:
	;short delay for debouncing
	ldi	temp, 50
shortdelay_loop:
	dec	temp
	brne	shortdelay_loop
	ret