Prev: 50586 Up: Map Next: 50758
50729: Clip Span
Works out how much of a span is in view. Purpose not yet known.
ClipSpan 50729 LD H,0 H is 0.
50731 LD A,L L moves into A.
50732 SUB E Subtract E.
50733 JR C,ClipSpan_Skip Jump to 50747 if the carry flag is set.
50735 LD H,A A moves into H.
50736 SUB B Subtract B.
50737 RET NC Return if the carry flag is reset.
50738 LD L,E E moves into L.
50739 NEG Negate A.
50741 LD B,A A moves into B.
50742 CP C Compare A with C.
50743 RET C Return if the carry flag is set.
50744 LD B,C C moves into B.
ClipSpan_Loop 50745 SCF Set the carry flag.
50746 RET Return.
ClipSpan_Skip 50747 ADD A,C Plus C.
50748 RET NC Return if the carry flag is reset.
50749 JR Z,ClipSpan_Skip2 Jump to 50756 if the zero flag is set.
50751 CP B Compare A with B.
50752 JR NC,ClipSpan_Loop Jump to 50745 if the carry flag is reset.
50754 LD B,A A moves into B.
50755 RET Return.
ClipSpan_Skip2 50756 XOR A Set A to zero.
50757 RET Return.
Prev: 50586 Up: Map Next: 50758