ceda-code-experiments/main.asm
2023-09-25 21:03:24 +02:00

77 lines
1022 B
NASM

org 0x1000
prhex = $c174
putchar = $c45e
putstr = $c01b
PUBLIC _main
_main:
in a,($81)
set 0,a
out ($81),a
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
delay_loop:
dec de
ld a,d
or e
jr nz,delay_loop
pop de
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