From 7c23e5a9efb11966ecac969438ab8b952c802db8 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 16 Jun 2019 19:29:58 -0400 Subject: [PATCH] acia: protect DE during aciaInt I don't know why I haven't noticed it wasn't protected. It must have been behind many random problems I've been having... --- kernel/acia.asm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kernel/acia.asm b/kernel/acia.asm index fe48208..2cede2f 100644 --- a/kernel/acia.asm +++ b/kernel/acia.asm @@ -77,17 +77,19 @@ aciaInt: cp l jr z, .end ; Equal? buffer is full - ; Alrighty, buffer not full. let's write. - ld de, ACIA_BUF - ; A already contains our write index, add it to DE - call addDE - ; increase our buf ptr while we still have it in A - call aciaIncIndex - ld (ACIA_BUFWRIDX), a - - ; And finally, fetch the value and write it. - in a, (ACIA_IO) - ld (de), a + push de ; <| + ; Alrighty, buffer not full|. let's write. + ld de, ACIA_BUF ; | + ; A already contains our wr|ite index, add it to DE + call addDE ; | + ; increase our buf ptr whil|e we still have it in A + call aciaIncIndex ; | + ld (ACIA_BUFWRIDX), a ; + ; | + ; And finally, fetch the va|lue and write it. + in a, (ACIA_IO) ; | + ld (de), a ; | + pop de ; <| .end: pop hl