; definice pro nas typ procesoru
.include "m169def.inc"
; podprogramy pro praci s displejem
.org 0x1000
.include "print.inc"
; Zacatek programu - po resetu
.org 0
jmp start
; Zacatek programu - hlavni program
.org 0x100
srcstr:
.db "LOREM IPSUM DOLOR SIT AMET", 0
start:
; Inicializace zasobniku
ldi r16, 0xFF
out SPL, r16
ldi r16, 0x04
out SPH, r16
; Inicializace displeje
call init_disp
; *** ZDE muzeme psat nase instrukce
;ldi r16, 'A' ; znak
;ldi r17, 2 ; pozice (zacinaji od 2)
;call show_char ; zobraz znak
;Nacteni adresy do Z
ldi r30, low(2*srcstr)
ldi r31, high(2*srcstr)
ldi r22, 0
ldi r23, 0
ldi r24, 0
ldi r25, 0
ldi r26, 0
ldi r27, 0
xd:
mov r22, r23
mov r23, r24
mov r24, r25
mov r25, r26
mov r26, r27
lpm r27, Z+
mov r16, r22
ldi r17, 2
call show_char
mov r16, r23
ldi r17, 3
call show_char
mov r16, r24
ldi r17, 4
call show_char
mov r16, r25
ldi r17, 5
call show_char
mov r16, r26
ldi r17, 6
call show_char
mov r16, r27
ldi r17, 7
call show_char
;pockej 125 000 cyklu
ldi r21, 50
xd1:
ldi r20, 50
xd2:
ldi r19, 50
xd3:
dec r19
brne xd3
dec r20
brne xd2
dec r21
brne xd1
;xd nebo start?!
cpi r27, 0
brne xd
ldi r28, 5
xd4:
mov r22, r23
mov r23, r24
mov r24, r25
mov r25, r26
mov r26, r27
ldi r27, 0
mov r16, r22
ldi r17, 2
call show_char
mov r16, r23
ldi r17, 3
call show_char
mov r16, r24
ldi r17, 4
call show_char
mov r16, r25
ldi r17, 5
call show_char
mov r16, r26
ldi r17, 6
call show_char
mov r16, r27
ldi r17, 7
call show_char
;pockej 125 000 cyklu
ldi r21, 50
xd5:
ldi r20, 50
xd6:
ldi r19, 50
xd7:
dec r19
brne xd7
dec r20
brne xd6
dec r21
brne xd5
dec r28
brne xd4
rjmp start
; Zastavime program - nekonecna smycka
rjmp PC