diff --git a/main.asm b/main.asm index f183ab2..89dfd46 100644 --- a/main.asm +++ b/main.asm @@ -2,29 +2,52 @@ prhex = $c174 putchar = $c45e +putstr = $c01b PUBLIC _main _main: - ld hl,$0000 + in a,($81) + set 0,a + out ($81),a -main_loop: - ld a,$0e - out ($a0),a - ld a,h - out ($a1),a - - ld a,$0f - out ($a0),a - ld a,l - out ($a1),a - - call delay - inc hl - jp main_loop + ld a,($42) + ld ($d0a0),a jp ASMPC + ld a,$40 + ld ($d77f),a + + ld hl,613 +main_loop: + push hl + call putstr + BYTE "abc" + BYTE "\0" + pop hl + dec hl + ld a,l + or h + jp nz,main_loop + +back: + call uart_rx + cp $61 + jp z,log + ld c,a + call putchar + jp back + + jp ASMPC + +log: + ld a,($ffd5) + call prhex + ld a,($ffd4) + call prhex + jp back + delay: push de ld de,$0000 @@ -35,4 +58,19 @@ delay_loop: jr nz,delay_loop pop de - ret \ No newline at end of file + ret + +uart_rx: + in a,($b1) + and $01 + jr z,uart_rx + in a,($b0) + ret + +uart_tx: + in a,($b1) + and $04 + jr z,uart_tx + ld a,c + out ($b0),a + ret