@@ -867,30 +867,34 @@ def draw_sprite(self):
867
867
868
868
if num_bytes == 0 :
869
869
if self .bitplane == 3 :
870
- self .draw_extended (x_pos , y_pos , 1 )
871
- self .draw_extended (x_pos , y_pos , 2 )
870
+ self .draw_extended (x_pos , y_pos , 1 , index = self . index )
871
+ self .draw_extended (x_pos , y_pos , 2 , index = self . index + 32 )
872
872
else :
873
873
self .draw_extended (x_pos , y_pos , self .bitplane )
874
874
self .last_op = f"DRAWEX"
875
875
else :
876
876
if self .bitplane == 3 :
877
- self .draw_normal (x_pos , y_pos , num_bytes , 1 )
878
- self .draw_normal (x_pos , y_pos , num_bytes , 2 )
877
+ self .draw_normal (x_pos , y_pos , num_bytes , 1 , index = self . index )
878
+ self .draw_normal (x_pos , y_pos , num_bytes , 2 , index = self . index + num_bytes )
879
879
else :
880
880
self .draw_normal (x_pos , y_pos , num_bytes , self .bitplane )
881
881
self .last_op = f"DRAW V{ x_source :01X} , V{ y_source :01X} "
882
882
883
- def draw_normal (self , x_pos , y_pos , num_bytes , bitplane ):
883
+ def draw_normal (self , x_pos , y_pos , num_bytes , bitplane , index = None ):
884
884
"""
885
885
Draws a sprite on the screen while in NORMAL mode.
886
886
887
887
:param x_pos: the X position of the sprite
888
888
:param y_pos: the Y position of the sprite
889
889
:param num_bytes: the number of bytes to draw
890
890
:param bitplane: the bitplane to draw to
891
+ :param index: the memory index in memory where byte the pattern is stored
891
892
"""
893
+ if not index :
894
+ index = self .index
895
+
892
896
for y_index in range (num_bytes ):
893
- color_byte = self .memory [self . index + y_index ]
897
+ color_byte = self .memory [index + y_index ]
894
898
y_coord = y_pos + y_index
895
899
if not self .clip_quirks or (self .clip_quirks and y_coord < self .screen .get_height ()):
896
900
y_coord = y_coord % self .screen .get_height ()
@@ -906,7 +910,7 @@ def draw_normal(self, x_pos, y_pos, num_bytes, bitplane):
906
910
mask = mask >> 1
907
911
self .screen .update ()
908
912
909
- def draw_extended (self , x_pos , y_pos , bitplane ):
913
+ def draw_extended (self , x_pos , y_pos , bitplane , index = None ):
910
914
"""
911
915
Draws a sprite on the screen while in EXTENDED mode. Sprites in this
912
916
mode are assumed to be 16x16 pixels. This means that two bytes will
@@ -916,10 +920,14 @@ def draw_extended(self, x_pos, y_pos, bitplane):
916
920
:param x_pos: the X position of the sprite
917
921
:param y_pos: the Y position of the sprite
918
922
:param bitplane: the bitplane to draw to
923
+ :param index: the memory index in memory where byte the pattern is stored
919
924
"""
925
+ if not index :
926
+ index = self .index
927
+
920
928
for y_index in range (16 ):
921
929
for x_byte in range (2 ):
922
- color_byte = self .memory [self . index + (y_index * 2 ) + x_byte ]
930
+ color_byte = self .memory [index + (y_index * 2 ) + x_byte ]
923
931
y_coord = y_pos + y_index
924
932
if y_coord < self .screen .get_height ():
925
933
y_coord = y_coord % self .screen .get_height ()
0 commit comments