Exchange of experience - the procedure output window frame.

Adventurer #08
     (C) Ivan Roshchin, Moscow, 1998


     Bring to your attention a little
(44 bytes), but very useful procedure
OPEN_W, which depicts the on-screen window frame. It is easy to 
modify, specifying any of the characters for the image frame

and fill the window.

     When it is invoked in the register pair DE
need to specify the coordinates of the upper-left
angle frame, the register B - height, C the width of the window 
(in characters): 



             ^

             | E

          D v

        <---> ^

                           |

                           |

                 Window | B

                           |

                           |

                           |

                           v

             <----------->

                   C



     When using this procedure
your program must be present and
how to print a single character. It is assumed that it is 
called PRSYM and it is called in the code of the battery

printable character, and in DE - coordinates
Print (D = X, E = Y). After finishing work
procedures PRSYM registers should not be changed.

     Text of procedure PRSYM not presented here. In the end, if 
you need to withdraw a window and something in it to print, 
then the procedure of printing the symbol you should already be.


OPEN_W LD A, ""; the upper left corner of the

        LD L, ""; upper right corner of the

        CALL OPEN_W2
OPEN_W1 LD A, ""; vertical frame border

        LD H, ""; this character filled

                      ; Window

        LD L, A

        CALL OPEN_W3

        DJNZ OPEN_W1

        LD A, ""; the lower left corner of the

        LD L, ""; the lower right corner of the
OPEN_W2 LD H, ""; horizontal border frame
OPEN_W3 PUSH DE

        CALL PRSYM

        INC D

        LD A, H

        LD H, C
OPEN_W4 CALL PRSYM

        INC D

        DEC H

        JR NZ, OPEN_W4

        LD A, L

        CALL PRSYM

        POP DE

        INC E

        RET


               *