ti_eeprom.asm


1
;Use AVR's EEprom as text storage
2
3
.include "../includes/1200def.inc"
4
.DEVICE AT90S1200
5
6
.def eeprom_address = r16
7
;.include "TI_PROT.ASM"
8
9
10
11
.org 0x0000
12
reset:
13
  ldi eeprom_address,0x00
14
  rcall send_string
15
loop:  
16
  rjmp loop;
17
   
18
;Sends a FF terminated stringfrom eeprom
19
; to the calc
20
send_string:
21
  
22
  out EEAR,eeprom_address
23
  sbi EECR,EERE    ;initiate transfer
24
  in ti_reg,EEDR  ;get transferred byte
25
  cpi ti_reg,0xFF  ;test if byte is zerobyte
26
  breq zero_byte  ;if so, jump
27
  rcall ti_put    ;transfer byte to calc
28
  inc eeprom_address
29
  rjmp send_string  ;enter recursion
30
  
31
  zero_byte:
32
    ret;
33
34
 
35
.include "TI_PROT.ASM"
36
37
.org FLASHEND+1 ;EEPROM!
38
; NOTE: .db lines must contain even number of bytes 
39
; (i.e. whole words)
40
  .db 'H','i','!',13
41
  .db 'T','h','i','s',32,'T','e','x','t',32
42
  .db 'c','o','m','e','s',32
43
  .db 'f','r','o','m',32,'E','E','P','R','O','M',13,0xFF,0xFF