Prev: 58395 Up: Map Next: 58507
58396: Fill Strip With Pattern
Used by the routines at EndSegment and FillSlopeEdge.
Fills a strip of screen bytes with a pattern of two bytes, going up two pixel rows at a time, and then moves along to the next column of the strip by the amount in ColumnStep. The strip is not drawn where the column is within one character of the edge of the screen, and its height is reduced where it would go past the bottom of the screen or above the top of the terrain.
Input
B' Number of columns
C' Number of pairs of pixel rows
DE Pattern: the first byte in D and the second in E
HL' Screen address of the bottom of the first column
FillStripWithPattern 58396 EXX Switch to the alternate registers.
58397 LD B,C B=C.
58398 LD A,L A=L.
58399 AND %00011111 Keep the bits of A that are set in 31.
58401 DEC A Step A back.
58402 CP 28 Jump to FillStripWithPattern_Skip if A is 28 or more.
58404 JR NC,FillStripWithPattern_Skip
58406 LD A,(52804) The segment row.
58409 CP 184 Jump to FillStripWithPattern_Height if A is less than 184.
58411 JR C,FillStripWithPattern_Height
58413 JR Z,FillStripWithPattern_Height Jump to FillStripWithPattern_Height if the zero flag is set.
58415 SUB 183 Subtract 183 from A.
58417 SRL A Shift A right.
58419 NEG Negate A.
58421 ADD A,B A gains B.
58422 LD B,A B=A.
58423 LD H,87 H=87.
58425 LD A,L A=L.
58426 AND %00011111 Keep the bits of A that are set in 31.
58428 OR %11000000 Set the bits of A that are set in 192.
58430 LD L,A L=A.
58431 JP FillStripWithPattern_Draw Jump to FillStripWithPattern_Draw.
FillStripWithPattern_Height 58434 LD B,A B=A.
58435 LD A,(52826) The vertical step copy.
58438 NEG Negate A.
58440 ADD A,B A gains B.
58441 SUB 24 Subtract 24 from A.
58443 LD B,C B=C.
58444 JR NC,FillStripWithPattern_Draw Jump to FillStripWithPattern_Draw if the carry flag is clear.
58446 CPL Invert A.
58447 SRL A Shift A right.
58449 NEG Negate A.
58451 ADD A,B A gains B.
58452 LD B,A B=A.
FillStripWithPattern_Draw 58453 LD A,(52804) The segment row.
58456 SLA C Shift C left.
58458 SUB C Subtract C from A.
58459 SRL C Shift C right.
58461 LD (52804),A Update the segment row.
FillStripWithPattern_Rows 58464 LD (HL),D Write D where HL points.
58465 DEC H Step H back.
58466 LD (HL),E Write E where HL points.
58467 CALL MoveUpARow Call MoveUpARow.
58470 DJNZ FillStripWithPattern_Rows Decrease B and jump to FillStripWithPattern_Rows until none remain.
58472 LD A,(52790) The column step.
58475 ADD A,L A gains L.
58476 LD L,A L=A.
58477 EXX Switch to the alternate registers.
58478 DJNZ FillStripWithPattern Decrease B and jump to FillStripWithPattern until none remain.
58480 RET Return.
FillStripWithPattern_Skip 58481 LD A,(52804) The segment row.
58484 SLA B Shift B left.
58486 SUB B Subtract B from A.
58487 SRL B Shift B right.
58489 LD (52804),A Update the segment row.
58492 LD A,(52790) The column step.
58495 ADD A,L A gains L.
58496 LD L,A L=A.
FillStripWithPattern_SkipRows 58497 DEC H Step H back.
58498 CALL MoveUpARow Call MoveUpARow.
58501 DJNZ FillStripWithPattern_SkipRows Decrease B and jump to FillStripWithPattern_SkipRows until none remain.
58503 EXX Switch to the alternate registers.
58504 DJNZ FillStripWithPattern Decrease B and jump to FillStripWithPattern until none remain.
58506 RET Return.
Prev: 58395 Up: Map Next: 58507