Prev: B740 Up: Map Next: B8EA
B798: Draw a sprite
Used by the routines at 633B, 638C, 641D, 6490, 6715, 6831, 6BC4, 6C3C, 6CA1, 6E45, 6E73, 6ED7, 6F0A, 6F8B and 6FE8.
Input
A Attribute
C Sprite ID
D Y co-ordinate
E X co-ordinate
B798 LD B,$03
B79A PUSH AF
B79B PUSH BC
B79C PUSH DE
B79D CALL $B8FA
B7A0 LD A,$08
B7A2 CP E
B7A3 JP Z,$B872
B7A6 PUSH HL
B7A7 PUSH DE
B7A8 CALL $B8EA
B7AB EX DE,HL
B7AC LD ($B7FF),HL
B7AF POP DE
B7B0 LD A,E
B7B1 ADD A,L
B7B2 LD L,A
B7B3 LD ($B828),HL
B7B6 LD A,$08
B7B8 ADD A,L
B7B9 LD L,A
B7BA LD ($B84F),HL
B7BD LD A,E
B7BE LD ($B80C),A
B7C1 LD A,$08
B7C3 SUB E
B7C4 LD ($B85B),A
B7C7 POP HL
B7C8 POP DE
B7C9 LD A,E
B7CA ADD A,L
B7CB LD L,A
B7CC LD ($B7FC),HL
B7CF SRL D
B7D1 SRL D
B7D3 SRL D
B7D5 SLA D
B7D7 SLA D
B7D9 SLA D
B7DB LD A,D
B7DC ADD A,$08
B7DE LD D,A
B7DF PUSH DE
B7E0 CALL $B8FA
B7E3 POP DE
B7E4 LD A,E
B7E5 ADD A,L
B7E6 LD L,A
B7E7 LD ($B825),HL
B7EA LD A,$08
B7EC ADD A,D
B7ED LD D,A
B7EE PUSH DE
B7EF CALL $B8FA
B7F2 POP DE
B7F3 LD A,E
B7F4 ADD A,L
B7F5 LD L,A
B7F6 LD ($B84C),HL
B7F9 POP BC
B7FA POP AF
B7FB LD HL,$0000
B7FE LD DE,$0000
B801 PUSH BC
B802 PUSH HL
B803 CALL $B928
B806 LD (HL),A
B807 POP HL
B808 PUSH AF
B809 PUSH HL
B80A PUSH DE
B80B LD C,$00
B80D LD A,(DE)
B80E XOR (HL)
B80F LD (HL),A
B810 INC DE
B811 INC H
B812 DEC C
B813 JR NZ,$B80D
B815 POP DE
B816 LD A,$10
B818 ADC A,E
B819 JR NC,$B81C
B81B INC D
B81C LD E,A
B81D POP HL
B81E INC HL
B81F POP AF
B820 DJNZ $B802
B822 POP BC
B823 PUSH BC
B824 LD HL,$0000
B827 LD DE,$0000
B82A PUSH HL
B82B CALL $B928
B82E LD (HL),A
B82F POP HL
B830 PUSH AF
B831 PUSH HL
B832 PUSH DE
B833 LD C,$08
B835 LD A,(DE)
B836 XOR (HL)
B837 LD (HL),A
B838 INC H
B839 INC DE
B83A DEC C
B83B JR NZ,$B835
B83D POP DE
B83E LD A,$10
B840 ADC A,E
B841 JR NC,$B844
B843 INC D
B844 LD E,A
B845 POP HL
B846 INC HL
B847 POP AF
B848 DJNZ $B82A
B84A POP BC
B84B LD HL,$0000
B84E LD DE,$0000
B851 PUSH HL
B852 CALL $B928
B855 LD (HL),A
B856 POP HL
B857 PUSH AF
B858 PUSH HL
B859 PUSH DE
B85A LD C,$00
B85C LD A,(DE)
B85D XOR (HL)
B85E LD (HL),A
B85F INC H
B860 INC DE
B861 DEC C
B862 JR NZ,$B85C
B864 POP DE
B865 LD A,$10
B867 ADC A,E
B868 JR NC,$B86B
B86A INC D
B86B LD E,A
B86C POP HL
B86D INC HL
B86E POP AF
B86F DJNZ $B851
B871 RET
B872 POP DE
B873 LD A,E
B874 ADD A,L
B875 LD L,A
B876 LD ($B89B),HL
B879 LD A,D
B87A ADD A,$08
B87C LD D,A
B87D PUSH DE
B87E CALL $B8FA
B881 POP DE
B882 LD A,E
B883 ADD A,L
B884 LD L,A
B885 LD ($B8CB),HL
B888 POP BC
B889 CALL $B8EA
B88C LD ($B8B0),DE
B890 LD A,E
B891 ADD A,$08
B893 LD E,A
B894 LD ($B8CE),DE
B898 POP AF
B899 PUSH BC
B89A LD HL,$0000
B89D PUSH HL
B89E CALL $B928
B8A1 LD DE,$0020
B8A4 LD C,B
B8A5 LD (HL),A
B8A6 ADD HL,DE
B8A7 LD (HL),A
B8A8 SBC HL,DE
B8AA INC HL
B8AB DEC C
B8AC JR NZ,$B8A5
B8AE POP HL
B8AF LD DE,$0000
B8B2 PUSH HL
B8B3 PUSH DE
B8B4 LD C,$08
B8B6 LD A,(DE)
B8B7 XOR (HL)
B8B8 LD (HL),A
B8B9 INC H
B8BA INC DE
B8BB DEC C
B8BC JR NZ,$B8B6
B8BE POP DE
B8BF LD A,E
B8C0 ADC A,$10
B8C2 JR NC,$B8C5
B8C4 INC D
B8C5 LD E,A
B8C6 POP HL
B8C7 INC HL
B8C8 DJNZ $B8B2
B8CA LD HL,$0000
B8CD LD DE,$0000
B8D0 POP BC
B8D1 PUSH HL
B8D2 PUSH DE
B8D3 LD C,$08
B8D5 LD A,(DE)
B8D6 XOR (HL)
B8D7 LD (HL),A
B8D8 INC H
B8D9 INC DE
B8DA DEC C
B8DB JR NZ,$B8D5
B8DD POP DE
B8DE LD A,E
B8DF ADC A,$10
B8E1 JR NC,$B8E4
B8E3 INC D
B8E4 LD E,A
B8E5 POP HL
B8E6 INC HL
B8E7 DJNZ $B8D1
B8E9 RET
Prev: B740 Up: Map Next: B8EA