Prev: 44504 Up: Map Next: 44801
44696: Set Object Attributes
Works out the area of attribute cells that is covered by the sprite that has just been drawn, as a width and height in cells, and fills it with the attribute at 44803 by calling FillAttributes.
SetObjectAttributes 44696 LD A,(41432) The rows of the sprite.
44699 DEC A Step A back.
44700 RET M Return if the sign flag is set.
44701 LD D,A D=A.
44702 LD HL,(41429) Fetch the word at 41429 into HL.
44705 LD A,(23593) The width of the sprite in bytes.
44708 LD B,A B=A.
44709 LD A,(41722) The sprite reaches past the right of the screen.
44712 AND A Jump to SetObjectAttributes_Width if A is zero.
44713 JR Z,SetObjectAttributes_Width
44715 LD A,L A=L.
44716 ADD A,B A gains B.
44717 SUB 164 Subtract 164 from A.
44719 LD L,8 L=8.
44721 JR SetObjectAttributes_Cells Jump to SetObjectAttributes_Cells.
SetObjectAttributes_Width 44723 LD A,L A=L.
44724 CP 8 Jump to SetObjectAttributes_Right if A is 8 or more.
44726 JR NC,SetObjectAttributes_Right
44728 ADD A,8 Add 8 to A.
44730 LD L,A L=A.
44731 LD A,B A=B.
44732 SUB 8 Subtract 8 from A.
44734 LD B,A B=A.
SetObjectAttributes_Right 44735 LD A,L A=L.
44736 ADD A,23 Add 23 to A.
44738 ADD A,B A gains B.
44739 JR NC,SetObjectAttributes_Aligned Jump to SetObjectAttributes_Aligned if the carry flag is clear.
44741 LD A,238 A=238.
44743 SUB L Subtract L from A.
44744 JR SetObjectAttributes_Cells Jump to SetObjectAttributes_Cells.
SetObjectAttributes_Aligned 44746 LD A,L A=L.
44747 AND %00000111 Keep the bits of A that are set in 7.
44749 JR Z,SetObjectAttributes_Sum Jump to SetObjectAttributes_Sum if the zero flag is set.
44751 LD A,B A=B.
44752 ADD A,8 Add 8 to A.
44754 LD B,A B=A.
This entry point is used by the routine at DrawShot.
SetObjectAttributes_Sum 44755 LD A,L A=L.
44756 ADD A,B A gains B.
44757 SUB L Subtract L from A.
SetObjectAttributes_Cells 44758 SRL A Shift A right.
44760 SRL A Shift A right.
44762 SRL A Shift A right.
44764 LD (44801),A Update the attribute area.
44767 DEC A Step A back.
44768 RET M Return if the sign flag is set.
This entry point is used by the routine at SetPairAttributes.
SetObjectAttributes_Height 44769 LD A,H A=H.
44770 SUB D Subtract D from A.
44771 SUB 7 Subtract 7 from A.
44773 LD E,A E=A.
44774 CP 23 Jump to SetObjectAttributes_Rows if A is 23 or more.
44776 JR NC,SetObjectAttributes_Rows
44778 LD E,23 E=23.
SetObjectAttributes_Rows 44780 LD A,H A=H.
44781 OR %00000111 Set the bits of A that are set in 7.
44783 SUB E Subtract E from A.
44784 SRL A Shift A right.
44786 SRL A Shift A right.
44788 SRL A Shift A right.
44790 LD (44802),A The height of the attribute area.
44793 DEC A Step A back.
44794 RET M Return if the sign flag is set.
44795 LD DE,44801 The attribute area.
44798 JP FillAttributes Jump to FillAttributes.
Prev: 44504 Up: Map Next: 44801