Prev: 43610 Up: Map Next: 43716
43611: Build View
Used by the routine at RunGame.
Builds the view buffer at ScreenBuffer from the position of the view in ViewPosition and 23780, one strip at a time in twelve passes.
build-view
BuildView 43611 LD HL,0 HL is 0.
43614 LD (23798),HL Store it in TurningRate.
43617 LD HL,(23778) Fetch the first value from ViewPosition.
43620 LD DE,(23780) Fetch the second value from 23780.
43624 PUSH HL Save the first value.
43625 ADD HL,DE Add the second value.
43626 LD BC,128 BC is 128.
43629 ADD HL,BC Add it.
43630 LD (23783),HL Store the result in ViewOriginSum.
43633 POP HL Retrieve the first value.
43634 SRL D Halve the second value...
43636 RR E ...with the carry going into E.
43638 SRL H Halve the first value...
43640 RR L ...with the carry going into L.
43642 AND A Subtract the second halved value from the first.
43643 SBC HL,DE
43645 LD (23790),HL Store the result in ViewOriginDifference.
43648 LD DE,65448 DE is 65448.
43651 CALL AdjustViewOrigin_Signed Call AdjustViewOrigin_Signed.
43654 LD HL,58833 Point HL at the first strip of the view buffer.
43657 LD (23739),HL Store it in StripAddress.
43660 LD B,12 Set the number of passes to 12.
BuildView_Pass 43662 PUSH BC Save the number of passes.
43663 LD HL,58833 Point HL at the first strip of the view buffer.
43666 LD DE,23 Set the size of a row to 23.
43669 LD B,128 Set the number of rows to 128.
43671 XOR A Set A to zero.
43672 LD (23792),A Store it in DrawingFlags.
43675 LD (43610),A Store it in RenderFlag.
BuildView_Clear 43678 LD (HL),A Clear a byte of the strip.
43679 INC HL Move onto the next byte.
43680 LD (HL),A Clear that byte.
43681 ADD HL,DE Move onto the next row.
43682 DJNZ BuildView_Clear Jump back until all of the rows have been cleared.
43684 LD HL,49377 HL is 49377.
43687 CALL DrawLevelObjects Call DrawLevelObjects.
43690 POP BC Restore the number of passes.
43691 DEC B Decrease it by one.
43692 RET Z Return if all of the passes have been done.
43693 EXX Switch to the alternate registers.
43694 CALL RemoveObjectEntities Call RemoveObjectEntities.
43697 LD DE,58811 Point DE at ScreenBuffer.
43700 LD HL,58813 Point HL at the second column of the view buffer.
43703 LD BC,3070 Set the number of bytes to 3070.
43706 LDIR Move the contents of the view buffer along by two bytes.
43708 LD E,8 E is 8.
43710 CALL AdjustViewOrigin Call AdjustViewOrigin.
43713 EXX Switch back to the normal registers.
43714 JR BuildView_Pass Jump back for the next pass.
Prev: 43610 Up: Map Next: 43716