Coding - Fast printing with a six-pixel font.

Murzilka #07
                                        
             QUICK PRINTING             
         SIX PIXEL FONT         
                                        
                                        
 This article has already been published in
newspaper "Paragraph", but after reading the latest ESMI
it seemed to me that it was read a little -
gie.                                    
   So, quick print.  I'll say right away
that further discussion will not be about the
universal procedures, but about printing specifically
lines (not individual characters), optimized
speed-based (to the detriment, by the way,
ty, memory).                           
   To speed up the output, let’s create a
the new font still has three characters, the characters in which
will be located, respectively, with
offset at 2, 4 and 6 pixels from the left
edges. To avoid wasting lines when printing
time to calculate the address of the required sim-
It's better to create fonts this way
so that the image of the first character
lay in bytes with addresses: font,
font+#1OO, font+#2OO, ... , font+#7OO,
image of the 2nd in bytes with addresses:
font+#ОО1, font+#1О1, font+#2О1, ... ,
font+#7О1, where font is the address of the font in pa-
mint, a multiple of 256. Thus, for you-
to enter the address of the symbol, you will need to enter
carry the high byte ad- into the high register
resa font, and put the code in the minor one
symbol. Forexplanations of all the above -
I’ll give you an example of a subroutine, formulated
configuring the corresponding fonts:          
                                        
INS FON LD DE,SH6O ;     forming the font
 CALL INSF 1;     with offset O 
 LD A,#OF,(IFF 1),A              
        LD (IFF 1+1),A                  
        LD DE,SNbZ ;       -- / --   
 CALL INSF 1;      with offset 2
 LD DE,SH61 ;        -- / --   
 CALL INSF 2;      with offset 6
 LD A,О,(IFF 2),A                
        LD DE,SH62 ;          -- / --   
 CALL INSF 2;      with offset 4
 RET                             
                                        
INSF 2 LD IX,font                      
        LD E,#2O; code of the 1st character       
                  (space)              
 LD C,224; we believe that in total  
;font 224 characters                    
SF2 1 PUSH DE                         
        LD В,4                          
SF2 Z CALL SF2 2                      
        LD A,L,(DE),A:INC D;why      
                             done    
 LD A,Н,(DE),A:INC D; exactly like that 
 CALL SF2 2 ; you can pro- 
LD A,H,(DE),A:INC D;read below
 LD A,L,(DE),A:INC D;            
        DJNZ SF2 Z                      
SF2 ZV POP DE                          
        INC E,IX                        
        DEC C:JR NZ,SF2 1               
        RET                             
SF2 2 LD Н,(IX+О),L,О:INC IX          
.2 AND A:RL N,L                    
IFF 2 RET                             
.2 AND A:RL N,L                    
 RET                             
                                        
INSF 1 LD HL,font                      
        LD E,#2O,C,224                  
SF1 1 PUSH DE                         
        LD V,8                          
SF1 2 LD A,(HL):INC HL                
IFF 1 NOP:NOP                         
        LD (DE),A:INC DDJNZ SF1 2                      
        POP DE                          
        INC E,HL                        
        DEC C:JR NZ,SF1 1               
        RET                             
                                        
 Here font is the address of the original normal
font;  SH6O, SH61, SH62, SНbЗ - addresses
generated fonts must be multiples
256. In INSF 2, fonts are formed according to
measure twice as much as in INSF 1 due to
because when the image is shifted
character 4 and 6 pixels to the right it is
goes beyond the boundaries of one byte. Moreover, in
INSF 2 font is formed in this way:
that the 2nd, Tea, bai and 8th lines depict
The names of each character are stored in reverse
in order, i.e. the right byte comes first,
then left (to understand that I’m here
I wanted to say it's better to look at it yourself
this procedure and everything will immediately become clear).
In this form it will be more convenient to display
string of characters.                        
                                        
   Now directly about the printing itself
tee.  The main idea: when printing six-pixel
Fours are considered in gray font
characters that fit very well -
are three bytes wide. Therefore
you need to display characters not separately
from each other, and at the same time print on the
wound all four at once. In this case
a lot of unnecessary things disappearcommands, type LD
A,(DE), LD (DE),A, which are needed when
serial output (for example,
to output the 2nd character of the four you need
take an image from the screen already
printed 1st, combine it with
2nd, put it back on the screen. Same
most with Zim and Chym). To output simultaneously
we need to have all four
current addresses:                          
                                        
 text address - let's say it's in DE';    
   address on the screen where it is displayed      
   line - DE;                         
   address of the 1st character - BC;              
   address of the 2nd character - HL;              
   the address of the symbol is HL';            
   address of the symbol - BC';             
                                        
 Let's sketch the output procedure
whole line:                            
                                        
LIN 1 LD V,SH6O[;     enter the older ones 
LD Н,SH61[;     address bytes in 
 EXX                  
LD Н,SH62[;     corresponding 
 LD В,СНбЗ[;     registers        
 LD A,(DE):INC DE; code 1st       
;                  four symbol     
        ...                             
;    here one should put a pro-  
; checking for various control codes,  
; like: end of line, color, etc.     
; I think everyone can do this themselves   
 EXX:LD C,A:EXX;   already available in BC 
;                         address         
 LD A,(DE):INC DE; 2nd character    
        ...                             
        EXX:LD L,A:EXX;   2nd address     
        LD A,(DE):INC DE; Ziy           
        ...                             
 LD L,A;           and so on   
LD A,(DE):INC DE                
        ...                             
        LD C,A                          
                                        
        EXX                             
                                        
; now the output itself      
                                        
LDA,(BC):INC B; display the 1st    
 OR (HL):INC N ; (Zyu, Suyu, 7th)
 LD (DE),A:INC E; line on the left  
LD A,(HL):INC Н;to the right, i.e.  
 EXX ; as usual     
 OR (HL):INC N ;                
        EXX ;                
        LD (DE),A:INC E;                
        EXX ;                
        LD A,(BC):INC B;                
        OR (HL):INC H ;                
        EXX:LD (DE),A:                  
        INC D;                          
                                        
        EXX ;                
        LD A,(BC):INC B; display the 2nd    
 OR (HL):INC N ; (I smell, I buoy, 8th)
 EXX ; line to the right  
LD (DE),A:DEC E;to the left - for   
 EXX ; this process 
;                        fool           
LD A,(HL):INCN;INSF 2 we and    
                         made           
 EXX ; lali small 
 OR (HL):INC N ; perversion in form  
LD (DE),A:DEC E;mate fonts   
 LD A,(BC):INC B;                
        OR (HL):INC H ;                
        LD (DE),A:INC D;                
                                        
        ...                             
; repeat these two blocks three more times    
; to output all eight lines          
                                        
 LD A,D:SUB 8:LD D,A             
.Z INC E;                          
; move three bytes to the right and       
; restore the value of register D   
                                        
        ...                             
; a check could be made here
; whether the line goes off the screen and  
; etc.                                  
 JP LIN 1                        
                                        
 About color output, probably
not worth it - nothing complicatedthere is no
besides the special influence on the speed of
bots of the entire program did not render this conclusion -
wat.  There is still a lot not shown in the program
little things - the purpose of the article is to state only
an idea that anyone can implement
to your own.    Average speed
viewer written using
of this algorithm - 5-6 frames per revolution
New screen size 22*40 characters.
   I would like to note once again that the main
the idea is printing simultaneously (and not by
queue) of all four characters. Everything is os-
global: use 4 fonts, etc.
secondary.                          
                                        

Share your thoughts about the article