From 0f4c3a2ae13a56652272654ac5f8acfbc824389c Mon Sep 17 00:00:00 2001
From: gamemasterplc <gamemasterplc@gmail.com>
Date: Tue, 8 Aug 2017 18:29:20 -0500
Subject: [PATCH 1/2] Fix 8 and 16 bit writes in codehandler

The codes would both overwrite where it should and 16400 bytes after where it should. The bug was caused by a usage of an incorrect register.
---
 Data/Sys/codehandler.bin | Bin 2856 -> 2856 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/Data/Sys/codehandler.bin b/Data/Sys/codehandler.bin
index ec58081cf2f2c4a67848c5443a25e90ecbfb7576..3246dc7d2788daeed14f27a47f9fc54ffddad467 100644
GIT binary patch
delta 69
zcmZ1>wnA)!B9qd}B#|11^=oPvSl0M3FzQ%pGBA2DFv!$&ChOHf<R&{ad9gv6li|$G
IkC|LK0MVHhO8@`>

delta 69
zcmZ1>wnA)!B9l^Ql1L51@-;OKENgri7<DW)85lhn7-VWXllAH#a+95zyx5@3$#CZ8
I$4ssq0KQ=qs{jB1


From e2d126144e72385ea182d0bd7e1183a6786d001d Mon Sep 17 00:00:00 2001
From: gamemasterplc <gamemasterplc@gmail.com>
Date: Thu, 10 Aug 2017 07:05:05 -0500
Subject: [PATCH 2/2] Fix 8 and 16 bit writes in codehandler (Source)

---
 docs/codehandler.s | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/docs/codehandler.s b/docs/codehandler.s
index 011ff21f34..9536b0d064 100644
--- a/docs/codehandler.s
+++ b/docs/codehandler.s
@@ -204,15 +204,15 @@ _write:
 _write816:
 	beq	cr4,+32			#lf r5 = 1 then 16 bits write
 	stbx	r4,r9,r12		#write byte
-	add r20, r9, r12
-	icbi r0, r20
+	add r21, r9, r12
+	icbi r0, r21
 	sync
 	isync
 	addi	r9,r9,1
 	b	+28
 	sthx	r4,r9,r12		#write halfword
-	add r20, r9, r12 #Get Real Memory Offset
-	icbi r0, r20 #Invalidate Icache around real memory offset
+	add r21, r9, r12 #Get Real Memory Offset
+	icbi r0, r21 #Invalidate Icache around real memory offset
 	sync
 	isync
 	addi	r9,r9,2
@@ -238,8 +238,8 @@ _write_string:				#endianess ?
 	blt-	_skip_and_align		#lf r9 < 0 then exit
 	lbzx	r5,r9,r15
 	stbx	r5,r9,r12		#loop until all the data has been written
-	add r20, r9, r12 #Get Real Memory Offset
-	icbi r0, r20 #Invalidate Icache around real memory offset
+	add r21, r9, r12 #Get Real Memory Offset
+	icbi r0, r21 #Invalidate Icache around real memory offset
 	sync
 	isync
 	b	_stb
@@ -269,8 +269,8 @@ _loop_serial:
 	b	+8
 
 	stwx	r4,r9,r12		#write serial word (CT04,T>=2)
-	add r20, r9, r12 #Get Real Memory Offset
-	icbi r0, r20 #Invalidate Icache around real memory offset
+	add r21, r9, r12 #Get Real Memory Offset
+	icbi r0, r21 #Invalidate Icache around real memory offset
 	sync
 	isync
 	add	r4,r4,r11		#value +=VVVVVVVV