From 162e5032918c4caab1a2d4875c4ae2b0598c02c2 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 2 Jul 2019 15:54:07 -0400 Subject: [PATCH] sms/vdp: properly protect AF on PutC --- kernel/sms/vdp.asm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/sms/vdp.asm b/kernel/sms/vdp.asm index 8e59dba..deef471 100644 --- a/kernel/sms/vdp.asm +++ b/kernel/sms/vdp.asm @@ -133,6 +133,8 @@ vdpPutC: cp ASCII_BS jr z, vdpBS + push af + ; ... but first, let's convert it. call vdpConv @@ -140,20 +142,21 @@ vdpPutC: call vdpSpitC ; Move cursor. The screen is 32x24 - ex af, af' ld a, (VDP_ROW) cp 31 jr z, .incline ; We just need to increase row inc a ld (VDP_ROW), a - ex af, af' ; bring back orig A + + pop af ret .incline: ; increase line and start anew - ex af, af' ; bring back orig A call vdpCR - jr vdpLF + call vdpLF + pop af + ret vdpCR: call vdpClrPos