Manic Miner: Routine at 37125

| Routines

37125: Move the conveyor in the current cavern

Used by the routine at 34574.
37125 | LD HL,(32880) | Pick up the address of the conveyor's location in the screen buffer at 28672 from 32880
37128 | LD E,L | Copy this address to DE
37129 | LD D,H
37130 | LD A,(32882) | Pick up the length of the conveyor from 32882
37133 | LD B,A | B will count the conveyor tiles
37134 | LD A,(32879) | Pick up the direction of the conveyor from 32879
37137 | OR A | Is the conveyor moving right?
37138 | JR NZ,37159 | Jump if so
The conveyor is moving left.
37140 | LD A,(HL) | Copy the first pixel row of the conveyor tile to A
37141 | RLC A | Rotate it left twice
37143 | RLC A
37145 | INC H | Point HL at the third pixel row of the conveyor tile
37146 | INC H
37147 | LD C,(HL) | Copy this pixel row to C
37148 | RRC C | Rotate it right twice
37150 | RRC C
37152 | LD (DE),A | Update the first and third pixel rows of every conveyor tile in the screen buffer at 28672
37153 | LD (HL),C
37154 | INC L
37155 | INC E
37156 | DJNZ 37152
37158 | RET |
The conveyor is moving right.
37159 | LD A,(HL) | Copy the first pixel row of the conveyor tile to A
37160 | RRC A | Rotate it right twice
37162 | RRC A
37164 | INC H | Point HL at the third pixel row of the conveyor tile
37165 | INC H
37166 | LD C,(HL) | Copy this pixel row to C
37167 | RLC C | Rotate it left twice
37169 | RLC C
37171 | JR 37152 | Jump back to update the first and third pixel rows of every conveyor tile