Programming - displaying the window and menu text.

Speccy #01
────────────────────────────────
  OUTPUT WINDOW AND MENU TEXT    
────────────────────────────────
                  Velichutin N.V.
                  --------------
                                
 The one who does the development
programs knows what is good and
she looks professional
a program where there are beautiful menus
with frame and shadow.               
                                
 I offer for your consideration
the subroutine I'm using
I've been learning for two years now.             
                                
 The subroutine completely changes
shared, i.e. code block is possible
upload to any address and
run it at the download address-
ki.                             
                                
                                
                                
 As everyone who programs knows
meets at the assembly, which is half-
completely relocatable programs
make it a little more difficult and profitable
They look confused, because... exclude
reading such commands from programs
like  CALL NN, JP NN, LD (NN),A
etc., storing variables
only in registers or on the stack
does not allow you to do it for real
mu structured program.But
use code block like this
The programs are a pleasure. All
the work comes down to loading it
block to any free address
su, placement of input parameters
from the main program and that's it!    
                                
 Input parameters (text address
window display coordinates, width and
window height, background and ink color)
are passed to the beginning of the program and
                                
                                
are calculated as follows
                                
 addr - program download address
 addr+7 -  low byte of the address
           text placement    
 addr+8 -  high byte of the address
           text placement    
 addr+10- window output coordinate
          in Y (0 - top of screen)
addr+12- output coordinatewindows
          along X (0 - left side 
 screen)               
 addr+14- window height in sign
          places                
 addr+16- window width in sign
          places                
 addr+18- ink color           
 addr+20- background color             
                                
 Program text:               
                                
ORG 55000                 
                                
                                
 LD A,2 enable
     CALL 5633 channel "S"
     LD IX,54500 address
                          text
     LD H,5 coord. in Y
     LD L,6 coord. by X
     LD D,14 height
     LD E.8 width
     LD B,7 ink color
     LD C,1 background color
     PUSH HL                    
PUSH IX                    
PUSH BC                    
 LD A,17 installation
     RST #0010 colors
     LD A,C background
     RST #0010                 
 LD A,19 increased
     RST #0010 brightness
     LD A,1                   
RST #0010                 
LD A,22                  
                                
                                
 RST #0010 installation
     LD A,H coordinates
     RST #0010 output
     LD A,L windows
     RST #0010                 
 LD B, E window width
A1 LD A,32 print cycle
     RST #0010 top
     DJNZ A1 row window
     LD В,D window height
A2 PUSH sun cycle
     LD A,22 print
     RST #0010 windows
     INC H with output
     LD A,H side
     RST #0010 transparent
     LD A,L shadows
     RST #0010                 
     LD   A,17                  
     RST  #0010                 
     LD   A,C                   
     RST  #0010                 
                                
                                
     LD   A,19                  
     RST  #0010                 
     LD   A,1                   
     RST  #0010                 
     LD   A,21                  
     RST  #0010                 
     LD   A,0                   
     RST  #0010                 
     LD   В,Е                   
A3   LD   A,32       цикл печати
     RST  #0010            одной
     DJNZ A3              строки
     LD   A,17                  
     RST  #0010                 
     LD   A,0                   
     RST  #0010                 
     LD   A,16                  
     RST  #0010                 
     LD   A,1                   
     RST  #0010                 
     LD   A,19                  
     RST  #0010                 
                                
                                
     LD   A,0                   
     RST  #0010                 
     LD   A,21                  
     RST  #0010                 
     LD   A,1                   
     RST  #0010                 
     LD   A,32       печать тени
     RST#0010 in one line
     POP sun refund for
     DJNZ A2 print. track. p.
     LD A,22                  
 RST #0010 installations
     LD A,H for
     INC A print
     RST #0010 bottom
     LD A,L shadows
     INC A                     
RST #0010                 
LD B,E                   
A4 LD A,32 print cycle
     RST #0010 bottom
     DJNZ A4 shadows
                                
                                
LD A,17                  
 RST #0010 recovery
     LD A,C colors
     RST #0010 background
     LD A,19 increased
     RST #0010 brightness
     LD A,1                   
RST #0010                 
POR BC                    
 LD A,16 and colors
     RST #0010 ink
     LDA,В                   
     RST  #0010                 
     LD   A,H                   
     LD   В,7                   
A5   ADD  A,H          умножение
     DJNZ A5             на 8  и
     PUSH HL                    
     LD   H,A         вычисление
     LD   A,169       координаты
     SBC  A,H          угла меню
     РОР  HL                по Y
                                
                                
     LD   В,A                   
     PUSH ВС                    
     LD   A,L                   
     LD   В,7                   
A6   ADD  A,L           такие же
     DJNZ A6          вычисления
     INC  A           координаты
     РОР  ВС                по X
     LD   C,A                   
     LD   H,В                   
     LD   L,Ccalculations
     LD B,7 width
     LD A,D frames
A7 ADD A,D                   
DJNZ A7                    
ADD A,5                   
LD D,A                   
LD B,7                   
 LD A, E calculations
A8 ADD A,E height
     DJNZ A8 frames
     SBC A,3                   
                                
                                
LD E,A                   
LD B,D                   
A9 PUSH Sun drawing
     LD B,H one
     LD C,L lines
     PUSH DE frames
     PUSH HL using
     CALL 8933 subroutine
     POP HL ROM
     POP DE                    
INC H                     
POR BC                    
     DJNZ A9                    
     LD   В,Е                   
A10  PUSH ВС               то же
     LD   В,H              самое
     LD   C,L         для другой
     PUSH DE             стороны
     PUSH HL                    
     CALL 8933                  
     РОР  HL                    
     РОР  DE                    
                                
                                
     INC  L                     
     РОР  ВС                    
     DJNZ A10                   
     LD   В,D                   
A11  PUSH ВС              третья
     LD   В,H            сторона
     LD   C,L                   
     PUSH DE                    
     PUSH HL                    
     CALL8933                  
     РОР  HL                    
     РОР  DE                    
     DEC  H                     
     РОР  ВС                    
     DJNZ A11                   
     LD   В,Е                   
A12  PUSH ВС           четвертая
     LD   В,H            сторона
     LD   C,L              рамки
     PUSH DE                    
     PUSH HL                    
     CALL 8933                  
                                
                                
     РОР  HL                    
     РОР  DE                    
     DEC  L                     
     РОР  ВС                    
     DJNZ A12 POP IX restoration
     POP HL coordinates
     INC H upper
     INC L window corner
     LD A,22 for output
     RST #0010 text
     LD A,H                   
RST #0010                 
LD A,L                   
RST #0010                 
B1 LD A,(IX+1) take symbol
     CP 163 if its code
     JR NC,B2 more than 163
     CP 1 if greater than 1
     JR NC, B3 if less then
     RET output
B3 RST #0010                 
                                
                                
INC IX                    
JR B1                    
B2 INC H cycle
     LD A,22 print
     RST #0010 text
     LD A,H messages
     RST #0010                 
LD A,L                   
RST#0010                 
INC IX                    
JR B1                    
                                
 The program code block has
length 288 bytes.                 
 You can shorten the length
program by excluding lines from it
                                
LD A,19                   
RST #0010                  
LD A,1                    
RST #0010                  
 ...                        
                                
                                
LD A,19                   
RST #0010                  
LD A,0                    
RST #0010                  
                                
 in this case the brightness of the color
the windows and shadows will be the same.
                                
The text format is as follows:       
line text - graph. symbol U -
-line feed, 0 end of text.
 To your question, why is this so?      
I will answer. I wanted it that way.          
 If you don't like it, you can
change this part of the program.   
 For example:                      
                                
SR 13                     
JR Z,B2                   
SR 255                    
 RET Z                      
                                
                                
                                
────────────────────────────────
                                
                                
 In the application you will find codes
blocks of these programs. techt - code block of the first     
 programs.              
 windows - second code block  
 programs.              
                                

Share your thoughts about the article