Printer for one character with 64 per line.

ZXNet echo conference «code.zx»

From Oleg Grigoriev To All 10 February 1999

Hi, All! In order to increase generally useful traffic, I am posting a subject. Inte- I wonder if anyone can speed it up significantly. :) Tables for 128 kilos are not welcome. :) In a - symbol, in de - coordinates. === cut === LD H,FONT_64[ LD L,A SRL D LD C,#0F JR NC,$+#06 LD C,#F0 SET 3,H LD A,E AND #18 OR#40 LD B,A LD A,E AND #07 RRCA RRCA RRCA ADD A,D LD E,A LD D,B LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A INC H INC D LD A,(DE) AND C OR(HL)LD(DE),A INC H INC D LD A,(DE) AND C OR(HL) LD(DE),A RET === cut === The font has a size of 4 kilos and is located at a very beautiful address (3 low-order nibbles are zero). Naturally, when printing on blank print screen is converted to ld a,(de):or (hl):ld (de),a. And when printing in pairs in ld a,(bc):or (hl):ld (de),a. I’m interested in something else: is it possible to fundamentally accelerate nie? :) I don't think so. :) WBR, Oleg. np: Mundanus Imperium'97 "Ode To The Nightsky"

From Dmitry Lomov To Oleg Grigoriev 11 February 1999

Hi, Oleg! OG> In order to increase generally useful traffic, I am posting a subject. Inter OG> I wonder if anyone can significantly speed it up. :) Why is it needed, tell me? I'm like a known pervert areas of printing characters in different formats, I look with a shudder for such procedures ;-) in this case - only in pairs! otherwise there will be no brakes... the font pump can be made in a stack, it will be a little faster (by 2 clock cycle/byte). type POP HL LD A,(DE):AND C:OR L:LD (DE),A:INC D LD A,(DE):AND C:OR H:LD (DE),A:INC D It's a thankless task to optimize something like this :) OG> I’m interested in something else: is it possible to fundamentally accelerate- OG> nie? :) I don't think so. :) hehe, it’s always possible, it’s just needed for a specific task find a solution. there are no global solutions, and there is no such common task - symbol printing. there are specific tasks: terminal, texteditor, textviewer, creeping line... All the best. Dmitry. ..LD..X-TRADE..

From Ivan Mak To Oleg Grigoriev 12 February 1999

Greetings, Oleg! On the day Oleg Grigoriev wrote to All: OG> In order to increase generally useful traffic, I am posting a subject. Inter OG> I wonder if anyone can significantly speed it up. :) [skip code] OG> I’m interested in something else: is it possible to fundamentally accelerate- OG> nie? :) I don't think so. :) Have you tried printing with the RRD and RLD commands? And when printing lines, type one character at the end of the printed line space if the line ended with an odd character. So, by the way, a 2K character generator is all you need... And one more thing. In HL it is better to keep the address of a familiar place right away and in the process printing, increase it by one after every two characters. And the calculation of the address do when setting the print position. Then all calculated RRCA, AND/OR will disappear. If you need to find out the print position, a reverse conversion is done. This is faster because the position setting and position reading functions are called much less frequently than print functions. Two consecutive characters must be printed 'as if' in one place. The print position must be from an even number, the length of the printed line must also be be even. In odd situations, special treatment is needed... ;HL - print position - DIRECT ADDRESS ON THE SCREEN! ;A - symbol;AF' - even/odd sign flag, for even A=0, for odd A=1, ;the flag is calculated by the program for setting the print position. PRINT_SYM LD D,ZG_ADRESS/256 LD E,A LD C,H LD A,(DE) ───┐ 8 times.. RLD │ INC D │ INC H │ .... │ LD A,(DE) │ RLD │ │ ──┘ LD H,C EX AF,AF' XOR 1 JR NZ,NO_INC_L INC L JR NZ,LL2 LD A,H ADD A,8 LD H,A CP#60 JR NZ,LL2 LD H,#40 LL2 XOR A NO_INC_L EX AF,AF' RET Wow! The Protoss are attacking my Zerlings! It's time to get going. Ivan. - Divorce the scheme, big and small...

From Dmitry Grigoryev To Oleg Grigoriev 14 February 1999

Привет, Oleg! Сpеда 10 Февpаля 1999 19:20, Oleg Grigoriev (500:812/10.13) wrote to All: OG> LD H,FONT_64[ OG> LD L,A OG> SRL D OG> LD C,#0F OG> JR NC,$+#06 OG> LD C,#F0 OG> SET 3,H 38-48 тактов ld l,a srl d jr nc,$+9 ld h,font_64[+8 ld c,#f0 jp $+7 ld h,font_64[ ld c,#0f 38-43 OG> LD A,E OG> AND #18 OG> OR #40 OG> LD B,A OG> LD A,E OG> AND #07 OG> RRCA OG> RRCA OG> RRCA OG> ADD A,D OG> LD E,A OG> LD D,B 57 Здесь, все таки, лучше таблицу адресов верт. координат в 24*2=48 байт: ld b,tab[ sla e ld c,e ld a,(bc) add a,dinc c ld e,a ld a,(bc) ld d,a 49 beats (it could probably be faster, but I’m too lazy to think ;) Total - 10.5 cycles per symbol have already been licked ;) OG> LD A,(DE) OG> AND C OG>OR (HL) OG>LD (DE),A OG>INC H OG>INC D OG> The font has a size of 4 kilos and is located at a very beautiful address OG> (3 low-order nibbles are zero). You forgot to add that the font is in screen format and is divided into two phases. Here's the first one The feature is a really nice move! For the first time, by the way, used in Online ;) OG> Naturally, when printing to a blank screen, the printer is converted to OG> ld a,(de):or (hl):ld (de),a. Uh-huh. Why print on dirty? 56 clock cycles per symbol are not lying around ;) OG> And when printing in pairs in ld a,(bc):or (hl):ld (de),a. How is it "in pairs"? OG> I’m interested in something else: is it possible to fundamentally accelerate- OG> nie? :) I don't think so. :) Never say that :) Although, now let them try ;) In general, alwayssome restrictions can be introduced (but the problem must be considered more in general - like "print page") - refuse coordinates, in no case print space, enter several tabs, abandon pseudographics and print 6-7 lines from eight, etc. Color printing has its own characteristics - you can, for example, wash string with attributes... It’s a good idea to free at least one register, at least for the procedure print strings, for constants. Don't forget about alternatives... OG> WBR, Oleg. Best regards, Dmitry (OLDMAN). 500:095/100.1@ZXNet oldman@i-connect.ru

From Dmitry Grigoryev To Ivan Mak 16 February 1999

Hello Ivan! Friday 12 February 1999 02:47, Ivan Mak (2:5030/529.24) wrote to Oleg Grigoriev: IM> Have you tried printing with the RRD and RLD commands? Have you tried ldir? Interesting too ;) IM> And when printing lines, one character at the end of the printed line IM> type a space if the line ended with an odd character. Yes, IM> by the way, a 2K character generator is all you need... Uh-huh. Only the text will increase by about half the number of lines. Or the check will have to be inserted into the procedure. And just print each line with an odd number of characters will increase unnecessarily. I'm keeping quiet about the fact that normal withdrawal method It’s faster not to type a space, but to recalculate the screen address using several commands. IM> And one more thing. In HL it is better to keep the address of the acquaintance and in You see, Ivan... It’s a no-brainer which is better... But the conditions of the problem were as follows: printing an 8x4 character at an _arbitrary_ screen position specified by _coordinates_... IM> PRINT_SYM IM> LD D,ZG_ADRESS/256 IM> LD E,A IM> LD C,H IM> LD A,(DE) ───┐ 8 times.. IM> RLD │ IM> INC D │ IM> INC H │ IM> .... │ IM> LD A,(DE) │ IM> RLD │ IM> │ IM> ──┘ The naked eye can see that ld a,(de);rld = 25 tacts, ld a,(de); and c; or(hl); ld (de), a = 25 tacts (or 21 when printing to an empty line, which is always done in a real application). Where's the winnings? IM> LD H,C IM> EX AF,AF' IM>XOR 1 IM> JR NZ,NO_INC_L IM>INC L IM> JR NZ,LL2 IM> LD A,H IM> ADD A,8 IM> LD H,A IM> CP #60 #58? And this “batva” is of no use at all - normal people line a line with a special character finish, rather than filling the screen all the way, and even with the transition to the top line ;) IM> JR NZ,LL2 IM> LD H,#40 IM> LL2 XOR A NO_INC_L IM> EX AF,AF' IM> RET Ok. In pairs, so in pairs (online and SPF I also printed in pairs ;) Change conditions, so change... hl - screen address de - text address * print a line from scratch * print_left: ld b,font_left/256 ld a,(de) inc de cp #21 jr c,controls ldc,a begin 7 ld a,(bc) ld(hl),a inc b inc h end ld a,(bc) ld(hl),a print_right: ld b,font_right/256 ld a,(de) inc de cp #21 jr c,controls ldc,a begin 7 ld a,(bc) or(hl) ld(hl),a inc b inc h end ld a,(bc) or(hl) ld(hl),a inc l jp print_left controls: cp #20 jr nz,tab ld a,b cp font_left jr z,print_right inc l jp print_left tab: cp #09 ret nz ld a,l and #03 add a,#04 ld l,a jp print_left Well, then do it yourself ;) Do it faster with RLD ;) IM> Wow! The Protoss are attacking my Zerlings! It's time to get going. Ivan. Best regards, Dmitry (OLDMAN). 500:095/100.1@ZXNet oldman@i-connect.ru

From Oleg Grigoriev To Dmitry Grigoryev 22 February 1999

Let your enemies, Dmitry, die without sons! 14-02-99 at 14:23:42 Dmitry Grigoryev ═> Oleg Grigoriev: [my code] DG> ld l,a DG> srl d DG> jr nc,$+9 DG> ld h,font_64[+8 DG> ld c,#f0 DG> jp $+7 DG> ld h,font_64[ DG> ld c,#0f DG> 38-43 [my code] DG> 57 DG> Here, after all, it is better to have a table of addresses vert. coordinates in 24*2=48 bytes: DG> ld b,tab[ DG> sla e DG> ld c,e DG> ld a,(bc) DG> add a,d DG> inc c DG> ld e,a DG> ld a,(bc) DG> ld d,a DG> 49 tacts Hehe... Register C is busy under the mask... EX DE,HL ;4 LD A,H ;4 LD H,TABL[ ;7 /8 SLA L ;8OR (HL) ;7 /8 INC L;4 LD H,(HL) ;7 /8 LD L,A ;4 EX DE,HL ;4 ;49[52] Now it's 49. DG> (it’s probably faster, but I’m too lazy to think ;) DG> Total - 10.5 cycles per symbol have already been licked ;) Yep... :) OG>> The font has a size of 4 kilos and is located at a very beautiful address OG>> (3 low-order nibbles are zero). DG> You forgot to add that the font is in screen format and is divided into two phases. Hm... It seemed to me that this was clear from the code. However, there everything is clear from the code. :) DG> Here is the first one DG> feature is a really beautiful move! The second one is also okay. :) By the way, I came up with it myself and, I remember, I cursed for a long time when I read about it in some newspaper. a long time ago it was... :) DG> For the first time, by the way, used in DG> Online ;) Perhaps... Although it seemed to me that zxword appeared un- how much earlier. :) OG>> Naturally, when printing to a blank screen, the printer is converted to OG>> ld a,(de):or (hl):ld (de),a. DG> Uh-huh. Why print on dirty? 56 cycles per character on the road not DG> lying around ;) The new printer has a little more. OG>> And when printing in pairs in ld a,(bc):or (hl):ld (de),a. DG> How is it “in pairs”? Two characters at a time. Something like this: LD B,FONT_64[ LD H,FONT_64[+#08 LD C,(IX+#00) LD L,(IX+#01) ... LD A,(BC):OR (HL):LD (DE),A INC B,H,D ... OG>> I’m interested in something else: is it possible to fundamentally accelerate- OG>> tion? :) I don't think so. :) DG> Never say that :) Hehe... There was a smiley face there. Just so that no one be provoked. :) DG> Although, now let them try ;) A little lower. DG> In general, you can always DG> introduce some restrictions (but the problem needs to be considered more DG> in general - like "print page") - refuse coordinates, under no circumstances DG> do not print space Yes, naturally. But in this case the task was set precisely like printing one character. DG> enter some tabs, discard pseudographics and print 6-7 DG> lines of eight, etc. This is the last thing I hate to endure. Me, as a well-known pervert, puppy (c) in the field of drawing fonts, crippled ones are terribly annoying symbols. ;The procedure for printing one character using a mask with 64 in a line. ;IN: [DE] - COORDS ; [A] - CHAR ; LD L,A ;4 SRL D ;8 JR NC,$+#09 ;7 /8 |12 LD H,FONT_64[+#08 ;7 /8 LD C,#F0 ;7 /8 JP $+#07 ;10 LD H,FONT_64[ ;7 /8 LD C,#0F ;7 /8 ;38[40]/43[46] EX DE,HL ;4 LD A,H ;4 LD H,TABL[ ;7 /8 SLA L ;8 OR (HL) ;7 /8 INC L;4 LD H,(HL) ;7 /8 LD L,A ;4 EX DE,HL ;4 ;49[52] ;87[92]/92[98] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 INC H ;4 INC D ;4 ;36[40] LD A,(DE) ;7 /8 AND C ;7 /8 OR (HL) ;7 /8 LD (DE),A ;7 /8 ;28[32] RET ;10 ;377[414]/382[420] ;Place the 64-х and the other. ;IN: [DE] - COORDS ; [A] - CHAR ; LD L,A ;4 SRL D ;8 LD H,FONT_64[ ;7 /8 JR NC,$+#04 ;7 /8|12 LD H,FONT_64[+#08 ;7 /8 ;31[32]/33[36] EX DE,HL ;4 LD A,H ;4 LD H,TABL[ ;7 /8 ALS L ;8 OR (HL) ;7 /8 INC L ;4 LD H,(HL) ;7 /8 LD L,A ;4 ;45[48] ;76[80]/78[84] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 INC H ;4 INC D ;4 ;29[32] LD A,(DE) ;7 /8 OR (HL) ;7 /8 LD (HL),A ;7 /8 ;21[24] RET ;10 ;310[338]/312[342] WBR, Oleg.