Prev: 55696 Up: Map Next: 56102
55720: Draw Vertical Edge
Used by the routine at FinishSegment.
Draws the edge of the terrain when the world is scrolling vertically, for the steps of a segment that have been counted in StepsDrawn. A strip across the segment is filled with either a chequered pattern (21930) or blank (zero), depending on whether the vertical speed in VerticalSpeed and the direction are the same, using FillTwoEdgeRows or FillFourEdgeRows. The routine finally carries on with FinishSegment_Colour. Purpose not yet known for the details of the positions.
DrawVerticalEdge 55720 LD IY,56137 The fill four edge rows.
55724 LD A,(52799) The vertical distance.
55727 CP 4 Jump to DrawVerticalEdge_Pattern if A is 4.
55729 JR Z,DrawVerticalEdge_Pattern
55731 LD IY,56129 The fill two edge rows.
DrawVerticalEdge_Pattern 55735 LD DE,0 DE=0.
55738 LD A,(52410) The vertical scroll speed.
55741 LD B,A B=A.
55742 LD A,(23605) The upside-down segment flag.
55745 XOR B Flip the bits of A that are set in B.
55746 BIT 7,A Jump to DrawVerticalEdge_Address if bit 7 of A is clear.
55748 JR Z,DrawVerticalEdge_Address
55750 LD DE,21930 DE=21930.
DrawVerticalEdge_Address 55753 LD HL,(52821) Fetch the word at StartColumn into HL.
55756 LD A,(52825) The horizontal step copy.
55759 AND A Jump to DrawVerticalEdge_Rows if A is not zero.
55760 JR NZ,DrawVerticalEdge_Rows
55762 LD A,(58395) The slope direction.
55765 CP 1 Jump to DrawVerticalEdge_Count if A is 1.
55767 JR Z,DrawVerticalEdge_Count
55769 LD A,L A=L.
55770 ADD A,7 Add 7 to A.
55772 LD L,A L=A.
DrawVerticalEdge_Count 55773 LD A,(52820) The steps already drawn.
55776 LD B,A B=A.
55777 XOR A Clear A.
DrawVerticalEdge_Rows2 55778 ADD A,16 Add 16 to A.
55780 DJNZ DrawVerticalEdge_Rows2 Decrease B and jump to DrawVerticalEdge_Rows2 until none remain.
55782 LD (52826),A Update the vertical step copy.
55785 LD A,1 A=1.
55787 LD (52820),A Update the steps already drawn.
55790 LD DE,21930 DE=21930.
55793 LD A,(58395) The slope direction.
55796 LD B,A B=A.
55797 LD A,(52411) The horizontal scroll speed.
55800 AND A Jump to DrawVerticalEdge_Rows if A is zero.
55801 JR Z,DrawVerticalEdge_Rows
55803 XOR B Flip the bits of A that are set in B.
55804 BIT 7,A Jump to FinishSegment_Colour if bit 7 of A is set.
55806 JP NZ,FinishSegment_Colour
DrawVerticalEdge_Rows 55809 LD A,(52410) The vertical scroll speed.
55812 BIT 7,A Test bit 7 of A.
55814 LD A,(52799) The vertical distance.
55817 JR NZ,DrawVerticalEdge_Row Jump to DrawVerticalEdge_Row if the zero flag is clear.
55819 LD A,(52826) The vertical step copy.
55822 NEG Negate A.
DrawVerticalEdge_Row 55824 ADD A,H A gains H.
55825 LD H,A H=A.
55826 LD (52804),A Update the segment row.
55829 LD (47757),HL The edge position.
55832 LD A,(52791) The vertical step.
55835 AND A Jump to DrawVerticalEdge_Sloped if A is not zero.
55836 JR NZ,DrawVerticalEdge_Sloped
55838 LD A,(52411) The horizontal scroll speed.
55841 NEG Negate A.
55843 ADD A,L A gains L.
55844 LD L,A L=A.
55845 LD A,(52820) The steps already drawn.
55848 LD B,A B=A.
55849 LD A,1 A=1.
55851 LD (52820),A Update the steps already drawn.
55854 LD A,(55389) The edge flag.
55857 AND A Jump to DrawVerticalEdge_Width if A is zero.
55858 JR Z,DrawVerticalEdge_Width
55860 LD A,(23604) The segment end shape.
55863 AND %01111111 Keep the bits of A that are set in 127.
55865 CP 19 Jump to DrawVerticalEdge_Width if A is not 19.
55867 JR NZ,DrawVerticalEdge_Width
55869 LD A,E A=E.
55870 AND A Jump to DrawVerticalEdge_Width if A is zero.
55871 JR Z,DrawVerticalEdge_Width
55873 LD A,1 A=1.
55875 JR DrawVerticalEdge_Columns Jump to DrawVerticalEdge_Columns.
DrawVerticalEdge_Width 55877 LD A,1 A=1.
DrawVerticalEdge_Cells 55879 ADD A,3 Add 3 to A.
55881 DJNZ DrawVerticalEdge_Cells Decrease B and jump to DrawVerticalEdge_Cells until none remain.
DrawVerticalEdge_Columns 55883 LD (23588),A Update the column step size.
55886 DEC A Step A back.
55887 LD (33668),A The extra columns of the edge.
DrawVerticalEdge_Sloped 55890 LD A,(52825) The horizontal step copy.
55893 AND A Jump to DrawVerticalEdge_Start if A is zero.
55894 JP Z,DrawVerticalEdge_Start
55897 LD A,(IX+1) Read offset 1 of IX.
55900 AND A Jump to DrawVerticalEdge_Start if A is not zero.
55901 JR NZ,DrawVerticalEdge_Start
55903 LD A,E A=E.
55904 AND A Jump to DrawVerticalEdge_Move if A is zero.
55905 JR Z,DrawVerticalEdge_Move
55907 LD A,(23602) The last contact flags.
55910 AND A Jump to DrawVerticalEdge_Move if A is zero.
55911 JR Z,DrawVerticalEdge_Move
55913 LD A,H A=H.
55914 CP 31 Jump to DrawVerticalEdge_Flags if A is 31 or more.
55916 JR NC,DrawVerticalEdge_Flags
DrawVerticalEdge_Move 55918 LD A,(52411) The horizontal scroll speed.
55921 NEG Negate A.
55923 ADD A,L A gains L.
55924 LD L,A L=A.
DrawVerticalEdge_Flags 55925 LD A,(23602) The last contact flags.
55928 AND A Jump to DrawVerticalEdge_Start if A is zero.
55929 JR Z,DrawVerticalEdge_Start
55931 CP 1 Jump to DrawVerticalEdge_Same if A is 1.
55933 JR Z,DrawVerticalEdge_Same
55935 LD A,(58395) The slope direction.
55938 CP 1 Jump to DrawVerticalEdge_Align if A is 1.
55940 JR Z,DrawVerticalEdge_Align
DrawVerticalEdge_Reverse 55942 NEG Negate A.
55944 LD (58395),A Update the slope direction.
55947 JR DrawVerticalEdge_Align Jump to DrawVerticalEdge_Align.
DrawVerticalEdge_Same 55949 LD A,(58395) The slope direction.
55952 CP 1 Jump to DrawVerticalEdge_Reverse if A is 1.
55954 JR Z,DrawVerticalEdge_Reverse
DrawVerticalEdge_Align 55956 LD A,L A=L.
55957 AND %00000111 Keep the bits of A that are set in 7.
55959 JR Z,DrawVerticalEdge_Start Jump to DrawVerticalEdge_Start if the zero flag is set.
55961 LD A,(23588) The column step size.
55964 INC A Advance A.
55965 LD (23588),A Update the column step size.
DrawVerticalEdge_Start 55968 LD A,(52791) The vertical step.
55971 AND A Call AdjustTerrainSlope if A is zero.
55972 CALL Z,AdjustTerrainSlope
55975 LD B,0 Clear B.
55977 LD A,L A=L.
55978 LD (23580),A Update the screen column.
55981 CP 240 Jump to DrawVerticalEdge_Screen if A is less than 240.
55983 JR C,DrawVerticalEdge_Screen
55985 LD L,B L=B.
55986 INC B Advance B.
DrawVerticalEdge_Screen 55987 CALL GetScreenAddress Call GetScreenAddress.
55990 LD A,L A=L.
55991 SUB B Subtract B from A.
55992 LD L,A L=A.
55993 LD A,(23588) The column step size.
55996 LD C,A C=A.
55997 LD A,(52825) The horizontal step copy.
56000 AND A Jump to DrawVerticalEdge_Fill if A is zero.
56001 JP Z,DrawVerticalEdge_Fill
56004 LD A,(52791) The vertical step.
56007 AND A Jump to DrawVerticalEdge_Flat if A is zero.
56008 JR Z,DrawVerticalEdge_Flat
56010 LD A,(IX+1) Read offset 1 of IX.
56013 AND A Jump to DrawVerticalEdge_Slope if A is zero.
56014 JP Z,DrawVerticalEdge_Slope
56017 LD A,(23580) The screen column.
56020 AND %00000111 Keep the bits of A that are set in 7.
56022 JP NZ,DrawVerticalEdge_Slope Jump to DrawVerticalEdge_Slope if the zero flag is clear.
56025 LD A,(52411) The horizontal scroll speed.
56028 AND A Jump to DrawVerticalEdge_Draw if A is zero.
56029 JR Z,DrawVerticalEdge_Draw
56031 LD B,A B=A.
56032 LD A,(52410) The vertical scroll speed.
56035 XOR B Flip the bits of A that are set in B.
56036 LD B,A B=A.
56037 LD A,(58395) The slope direction.
56040 XOR B Flip the bits of A that are set in B.
56041 BIT 7,A Jump to DrawVerticalEdge_Draw if bit 7 of A is clear.
56043 JR Z,DrawVerticalEdge_Draw
56045 DEC L Step L back.
56046 LD A,(52411) The horizontal scroll speed.
56049 BIT 7,A Jump to DrawVerticalEdge_Draw if bit 7 of A is clear.
56051 JR Z,DrawVerticalEdge_Draw
56053 INC L Advance L.
56054 INC L Advance L.
DrawVerticalEdge_Draw 56055 JP DrawVerticalEdge_Fill Jump to DrawVerticalEdge_Fill.
DrawVerticalEdge_Flat 56058 LD A,(IX+1) Read offset 1 of IX.
56061 AND A Call AdjustEdgeAddress if A is zero.
56062 CALL Z,AdjustEdgeAddress
56065 JR DrawVerticalEdge_Fill Jump to DrawVerticalEdge_Fill.
DrawVerticalEdge_Slope 56067 LD A,(52791) The vertical step.
56070 AND A Jump to DrawVerticalEdge_Fill if A is zero.
56071 JR Z,DrawVerticalEdge_Fill
56073 LD A,(58395) The slope direction.
56076 CP 1 Compare A with 1.
56078 LD A,(52410) The vertical scroll speed.
56081 JR NZ,DrawVerticalEdge_Check Jump to DrawVerticalEdge_Check if the zero flag is clear.
56083 NEG Negate A.
DrawVerticalEdge_Check 56085 BIT 7,A Jump to DrawVerticalEdge_Fill if bit 7 of A is clear.
56087 JR Z,DrawVerticalEdge_Fill
56089 INC L Advance L.
DrawVerticalEdge_Fill 56090 EXX Switch to the alternate registers.
56091 LD A,(52820) The steps already drawn.
56094 LD B,A B=A.
56095 CALL CallEdgePainter Call CallEdgePainter.
56098 EXX Switch to the alternate registers.
56099 JP FinishSegment_Colour Jump to FinishSegment_Colour.
Prev: 55696 Up: Map Next: 56102