Prev: 969A Up: Map Next: 99AF
9955: Reverses the image of a bitmap.
Used by the routines at Bg_CalcAndDraw, Stage_Draw and People_Main.
Input
L Bitmap index.
Output
Bitmap_Reverse 9955 LD H,$00 Convert index into bitmap info address.
9957 ADD HL,HL
9958 ADD HL,HL
9959 LD DE,Bitmap_PtrTable
995C ADD HL,DE
995D LD E,(HL) Get bitmap address.
995E INC HL
995F LD D,(HL)
9960 INC HL
9961 LD A,(HL) Bitmap height.
9962 AND $7F
9964 LD C,A
9965 INC HL
9966 LD A,(HL) Bitmap width, toggling reverse bit.
9967 XOR $80
9969 LD (HL),A
996A AND $7F
996C LD L,A
996D LD H,$00
996F LD (Bitmap_temp),HL
9972 SRL A Store parity of width.
9974 ADC A,$00
9976 LD ($5BE2),A
Bitmap_Reverse_0 9979 LD B,$08
Bitmap_Reverse_1 997B PUSH BC
997C LD HL,(Bitmap_temp)
997F ADD HL,DE
9980 PUSH HL
9981 LD A,($5BE2)
9984 LD B,A
9985 AND A
Bitmap_Reverse_2 9986 DEC HL
9987 LD A,(DE)
9988 LD C,(HL)
9989 RLA
998A RR C
998C RLA
998D RR C
998F RLA
9990 RR C
9992 RLA
9993 RR C
9995 RLA
9996 RR C
9998 RLA
9999 RR C
999B RLA
999C RR C
999E RLA
999F RR C
99A1 RLA
99A2 LD (DE),A
99A3 LD (HL),C
99A4 INC DE
99A5 DJNZ Bitmap_Reverse_2
99A7 POP DE
99A8 POP BC
99A9 DJNZ Bitmap_Reverse_1
99AB DEC C
99AC JR NZ,Bitmap_Reverse_0
99AE RET
Prev: 969A Up: Map Next: 99AF