From 79201198a1e58c010a54f4437b5a701ec05ef288 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 10 Mar 2021 20:08:36 -0600 Subject: [PATCH] Fix a bug in memset. If the upper byte of the int argument was nonzero, it could write the wrong value (the OR of the upper and lower bytes). It should convert the value to unsigned char, i.e. just use the lower byte. --- string.asm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/string.asm b/string.asm index 13933a2..91cd8b2 100644 --- a/string.asm +++ b/string.asm @@ -482,21 +482,19 @@ rtl equ 1 return address ph4 p save the pointer + short M lda val form a 2 byte value - xba - ora val - sta val + sta val+1 lda len if there are an odd # of bytes then lsr A bcc lb1 - short M set 1 byte now - lda val + lda val set 1 byte now sta [p] long M dec len inc4 p -lb1 anop endif +lb1 long M endif lda val set len bytes ldx len+2 set full banks