From c9024ce25a2855c775daad0405b488c10513c984 Mon Sep 17 00:00:00 2001 From: giomba Date: Mon, 25 Sep 2023 21:03:24 +0200 Subject: [PATCH] Stuff. --- main.asm | 70 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 16 deletions(-) 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