Fixing the JSW48 block graphics bug ----------------------------------- J.G.Harston - mdfs.net/Software/JSW The block graphics bug occurs when a room definition is converted to the block graphics characters to draw on the screen. JSW uses the attributes of the characters to search for the character bitmap in the room definition. However, instead of checking the attribute bytes by stepping by 9 from bitmap to bitmap, all bytes are checked, including the character matrix bitmaps. Consequently, if an attribute matches a bitmap byte before the actual attribute then the eight bytes from that point onwards will be used as the character matrix, regardless of where they occur. This patch fixes this bug so that only the character attribute bytes are checked in the room definition. Original code: Change to: L8D4B: LD C,&00 L8D4B: 1E 00 LD E,&00 ; Start at screen address 0 L8D4D: LD E,C L8D4D: DD 7E 00 LD A,(IX+0) ; Get current attribute LD A,(IX+&00) 21 97 80 LD HL,BACKGROUND-9 ; Start at the background attribute LD HL,BACKGROUND 01 09 00 LD BC,9 ; Nine bytes per block LD BC,&0036 L8D56: 09 ADD HL,BC ; Step to next block CPIR BE CP (HL) ; Does attribute byte match? LD C,E 20 FC JR NZ,L8D56 ; Check next block LD B,&08 LD B,&08 ; Eight pixel-lines L8D5C: LD D,&00 L8D5C: LD D,&00 ; High byte of screen bitmap address L8D5E: LD A,(HL) L8D5E: 23 INC HL ; Point to bitmap LD (DE),A 7E LD A,(HL) ; Get a character byte INC HL 12 LD (DE),A ; Store into screen buffer INC D INC D ; Move to next pixel-line DJNZ L8D5E DJNZ L8D5E ; Loop for eight pixel-lines INC IX INC IX ; Move to next attribute INC C 1C INC E ; Move to next screen address JP NZ,L8D4D JP NZ,L8D4D ; Loop for 256 attributes RET RET This can be applied with the following hex patch file: :0F8D4B001E00DD7E0021978001090009BE20FC7D :098D5E00237E121410FADD231C1F :0000000000