Prev: 36499 Up: Map Next: 36573
36543: Draw a line from (C, B) to (E, D)
Used by the routines at 28766 and 36573.
Input
B y-coordinate of start of line
C x-coordinate of start of line
D y-coordinate of end of line
E x-coordinate of end of line
36543 LD (23677),DE Load contents of DE into coordinate storage (start point of line)
36547 LD A,B Subtract y-coordinate of start of line from y-coordinate of end of line...
36548 SUB D ...to get delta-y
36549 LD D,1 Set direction of vertical change to +1 (upward)
36551 JR NC,36557 If delta-y is positive (i.e. upward) then skip ahead to 36557
36553 CPL Multiply delta-y by -1 (downward) to get absolute magnitude...
36554 INC A ...
36555 LD D,255 Set direction of vertical change to -1 (downward)
36557 LD B,A Load B with magnitude of difference in y-coordinate between start and end of line
36558 LD A,C Subtract x-coordinate of start of line from y-coordinate of end of line...
36559 SUB E ...to get delta-x
36560 LD E,1 Set direction of horizontal change to +1 (rightward)
36562 JR NC,36568 If delta-x is positive (i.e. rightward) then skip ahead to 36568
36564 CPL Multiply delta-x by -1 (leftward) to get absolute magnitude...
36565 INC A ...
36566 LD E,255 Set direction of vertical change to -1 (leftward)
36568 LD C,A Load C with magnitude of difference in x-coordinate between start and end of line
36569 CALL 9402 Draw the line (ROM routine)
36572 RET Return
Prev: 36499 Up: Map Next: 36573