So, say this is my sprite routine, which causes messed up pixels:
Put_Sprite_Overwrite:
; A = x coordinate
; L = y coordinate
; B = number of rows
;
; IX = address of sprite
LD H, 0
LD D, H
LD E, L
ADD HL, HL
ADD HL, DE
ADD HL, HL
ADD HL, HL
LD E, A
SRL E
SRL E
SRL E
ADD HL, DE
LD DE, plotsscreen
ADD HL, DE
AND 7
JR Z, _AlignedOverwrite
LD C, A
PUSH HL
LD A, 12
LD HL, Sprite_Width
SUB (HL)
LD D,0
LD E, A
POP HL
_RowLoopOverwrite:
PUSH BC
;Stores width into B, which will be decreased 1 by 1 until one row is complete
LD A, (Sprite_Width)
LD B, A
_ColumnLoopOverwrite:
PUSH BC
LD B, C
LD C, (IX)
XOR A
_ShiftLoopOverwrite:
SRL C
RRA
DJNZ _ShiftLoopOverwrite
INC HL
LD (HL), A
DEC HL
LD A, C
LD (HL), A
POP BC
INC HL
INC IX
DJNZ _ColumnLoopOverwrite
ADD HL, DE
POP BC
DJNZ _RowLoopOverwrite
RET
_AlignedOverwrite:
PUSH HL
LD A, 12
LD HL, Sprite_Width
SUB (HL)
LD D,0
LD E, A
POP HL
_PutLoopOverwrite:
PUSH BC
LD A, (Sprite_Width)
LD B, A
_PutLoopOverwrite2:
LD A, (IX)
LD (HL), A
INC IX
INC HL
DJNZ _PutLoopOverwrite2
_PutLoopOverwriteAdd:
POP BC
;ADD HL, DE
;DJNZ _PutLoop
ADD HL, DE
DJNZ _PutLoopOverwrite
RET
What do I plug in for "xor b, and c, xor b"?