Prev: B803 Up: Map Next: B99C
B82E: Set next position for moving objects
Used by the routine at AF5D.
B82E LD L,(IX+$07) UDG height
B831 LD H,(IX+$08) UDG width
B834 LD ($A400),HL Remember this
B837 LD C,(IX+$06)
B83A BIT 6,C
B83C CALL NZ,$B99C
B83F LD L,(IX+$0C)
B842 LD H,(IX+$0D)
B845 BIT 2,C
B847 JR Z,$B88B
B849 DEC (IX+$19)
B84C JR NZ,$B88B
B84E LD A,(IX+$18)
B851 LD (IX+$19),A
B854 DEC (IX+$0F)
B857 JR NZ,$B875
B859 LD A,(IX+$0E)
B85C LD (IX+$0F),A
B85F BIT 3,C
B861 JR NZ,$B86B
B863 LD L,(IX+$0A)
B866 LD H,(IX+$0B)
B869 JR $B885
B86B DEC (IX+$0F)
B86E LD A,C
B86F XOR $10
B871 LD C,A
B872 LD (IX+$06),A
B875 LD E,(IX+$1D)
B878 LD D,(IX+$1E)
B87B BIT 4,C
B87D JR NZ,$B882
B87F ADD HL,DE
B880 JR $B885
B882 AND A
B883 SBC HL,DE
B885 LD (IX+$0C),L
B888 LD (IX+$0D),H
B88B BIT 0,C
B88D JR Z,$B896
B88F LD E,(IX+$1F)
B892 LD D,(IX+$20)
B895 ADD HL,DE
B896 PUSH HL
B897 LD L,(IX+$10)
B89A LD H,(IX+$11)
B89D LD E,(IX+$00)
B8A0 LD D,(IX+$01)
B8A3 BIT 1,C
B8A5 JR Z,$B8AC
B8A7 DEC (IX+$1B)
B8AA JR Z,$B8B2
B8AC LD A,(IX+$13)
B8AF JP $B93B
B8B2 LD A,(IX+$1A)
B8B5 LD (IX+$1B),A
B8B8 LD B,(IX+$12)
B8BB BIT 7,C
B8BD JR Z,$B8F4
B8BF BIT 0,C
B8C1 JR Z,$B8D7
B8C3 LD A,D
B8C4 DEC D
B8C5 AND $07
B8C7 JR NZ,$B8D3
B8C9 LD A,E
B8CA SUB $20
B8CC LD E,A
B8CD JR C,$B8D3
B8CF LD A,D
B8D0 ADD A,$08
B8D2 LD D,A
B8D3 DJNZ $B8C3
B8D5 JR $B8E9
B8D7 INC D
B8D8 LD A,D
B8D9 AND $07
B8DB JR NZ,$B8E7
B8DD LD A,E
B8DE ADD A,$20
B8E0 LD E,A
B8E1 JR C,$B8E7
B8E3 LD A,D
B8E4 SUB $08
B8E6 LD D,A
B8E7 DJNZ $B8D7
B8E9 LD (IX+$00),E
B8EC LD (IX+$01),D
B8EF LD A,(IX+$13)
B8F2 JR $B93B
B8F4 BIT 0,C
B8F6 LD A,(IX+$13)
B8F9 LD C,(IX+$14)
B8FC JR Z,$B91E
B8FE SCF
B8FF ADC A,A
B900 DJNZ $B8FE
B902 JR NC,$B917
B904 XOR A
B905 LD B,(IX+$12)
B908 SCF
B909 ADC A,A
B90A DJNZ $B908
B90C LD L,(IX+$16)
B90F LD H,(IX+$17)
B912 DEC E
B913 LD (IX+$00),E
B916 AND A
B917 LD B,(IX+$15)
B91A SBC HL,BC
B91C JR $B932
B91E SRL A
B920 DJNZ $B91E
B922 LD B,(IX+$15)
B925 JR NZ,$B931
B927 DEC A
B928 LD HL,$0000
B92B INC E
B92C LD (IX+$00),E
B92F JR $B932
B931 ADD HL,BC
B932 LD (IX+$10),L
B935 LD (IX+$11),H
B938 LD (IX+$13),A
B93B POP BC
B93C ADD HL,BC
B93D EX DE,HL
B93E LD C,A
B93F PUSH HL
B940 LD A,(IX+$06)
B943 AND $22
B945 CP $20
B947 JR NZ,$B94F
B949 SET 6,(IX+$06)
B94D JR $B952
B94F CALL $B7CC
B952 POP DE
B953 LD A,D
B954 RRA
B955 RRA
B956 RRA
B957 AND $03
B959 ADD A,$A0
B95B LD D,A
B95C LD A,(IX+$06)
B95F BIT 1,A
B961 RET Z
B962 BIT 0,A
B964 JR Z,$B972
B966 LD L,(IX+$02)
B969 LD H,(IX+$03)
B96C AND A
B96D SBC HL,DE
B96F CCF
B970 JR $B97B
B972 LD L,(IX+$04)
B975 LD H,(IX+$05)
B978 SCF
B979 SBC HL,DE
B97B RET NC
B97C LD L,A
B97D RLA
B97E JR C,$B986
B980 LD A,(IX+$13)
B983 INC A
B984 JR $B98B
B986 LD A,(IX+$01)
B989 AND $07
B98B RET NZ
B98C LD A,L
B98D BIT 5,A
B98F JR Z,$B996
B991 RES 1,(IX+$06)
B995 RET
B996 XOR $01
B998 LD (IX+$06),A
B99B RET
Prev: B803 Up: Map Next: B99C