latch equ 0a0h write equ 0a1h read equ 0a2h org 0d000h init: di ld a,0fh out (latch),a in a,(read) ld (store),a rdmsg: ld hl,msg ld bc,18 loop: push bc call outb pop bc dec bc ld a,c or b inc hl jr nz,loop ld a,(store) out (write),a ei ret outb: ld a,(store) and 0f3h ld e,a ld a,(hl) ld d,a and 3 rlca rlca add a,e or 20h out (write),a call wait ld a,e and 0dfh out (write),a call wait ld a,d and 0ch add a,e or 20h out (write),a call wait ld a,e and 0dfh out (write),a call wait ld a,d rrca rrca ld d,a and 0ch add a,e or 20h out (write),a call wait ld a,e and 0dfh out (write),a call wait ld a,d rrca rrca and 0ch add a,e or 20h out (write),a call wait ld a,e and 0dfh out (write),a call wait ret wait: ld b,70 wloop: dec b xor a or b jr nz,wloop ret store: defs 1 msg: defm 'Hello! ATMEGA328P' defb 0ah