Ideas - Effects on chunk tables. Mega-fast 8x8 symbol printing.

Plutonium #14

+===-----=================------=================---------=====+
|                      Ideas!!!                                |
+++++==========================================================+
++++++                                                          
++++++ +++++ ++++ +++
++ B этом разделе мы будем собирать и освешaть все материалы,sent by code in the form of separate solutions, pieces of code, effective Comrade etc. But it shouldn’t be just any rotten screen manifestations (if it rules, then we’ll take it), and similar stupid effects, and the program Responsive and actual code... The thing is that after watching dem, peeing a little myself, I I still realized that so many effects have already been invented that if If you add library of these procedures, then it will last many meters... Yes, and I’m tired of hiding my procedures from others, developing boots and etc. Of course, we can say that for beginner coders this may be harmful, because there will be a temptation to “fight” from here ideas and developments but, on the other hand they need something is studying, but the printed publications have long since fallen asleep... in place!!! So... Utak, because this section is published for the first time, I decide to write a few examples myself... (c) Lynx/XPLOS!VE 1. Effects on chunk tables. Perhaps this has already been covered in magazines like Demo og Die, code-oriented, but I still dare to write about these all long-known effects. Typically, all effects on graphics stored in this form (a In this form, graphics are stored on almost all other platforms. max, for excluding all sorts of microsh), are implemented with the help so-called image filters by which the each point of the chunk table. For example, everyone famous, almost everywhere present. The Soften dart filter, popularly referred to as Blur, actually is analyzed according to the following table (3x3) : 0 , 1 , 0 1 , 2 , 1 0 , 1 , 0 which means that this point (which is in the center tables) will be processed using this filter! Nothing to explain I will, it’s better to give a few examples right away, you’ll get the idea. All operations are performed on a standard (64x48) chunk table here... ;Chunky Effects!!! ;(c)Lynx ;------------------------------------------------ ;1.Soften ;010 caf ;121 3x3 bed ;010 ghl ;------------------------------------------------- BLUR LD IX,DATA LD BC,#E00 IXEL LD А,(IX-64);Берем верхнюю точку (a) ADD А,(IX-1);складываем с точкой b ADD А,(IX+0);2 раза с данной точкой ADD А,(IX+0);(е) ADD А,(IX+1);и один раз с d ADD А,(IX+64);и с h SRL А;Делим результат на 4... SRL А ;для гaсяшего блурa добавьте еше одну команду SRL А CP #11 JR C,IX_1 LD А,#0F IX_1 LD(IX),А INC IX DEC BC LD А,B OR C JR NZ,IXEL RET ;----------------------------------------------------- ;Alpha Blur ;101;020 3х3 ;101 ;----------------------------------------------------- BLUR2 LD IX,DATA LD BC,#E00 IXEL2 LD А,(IX-65) ADD А,(IX-63) ADD А,(IX+0) ADD А,(IX+0) ADD А,(IX+65) ADD А,(IX+63) SRL А SRL А CP #11 JR C,IX_3 LD А,#0F IX_3 LD (IX),А INC IX DEC BC LD А,B OR C JR NZ,IXEL2 RET ;-------------------------------------------------- ;Edge detect ;0 -1 0 ;-1 4 -1 3х3 ;0 -1 0 ;-------------------------------------------------- EDGE LD IX,DATA LD BC,#C00 ED_1 LDА,(IX-65) SUB (IX-64) SUB (IX-1) LD E,4 EDA_1 ADD А,(IX+0) DEC E JR NZ,EDA_1 SUB (IX+1)SUB (IX+64) SRL А SRL А SRL А CP #11 JR C,DEB_1 XOR А DEB_1 LD (IX),АINC IX DEC BC LD А,B OR C JR NZ,ED_1 RET ;------------------------------------------------------------ ;Dither ;3 0 0 0 0 ;0 0 0 0 0 ;0 0 0 0 0 5x5 ;0 0 0 0 0 ;3 0 0 0 0 ;------------------------------------------------------------ DITHER LD IX,DATA LD BC,#C00 DIT_1 PUSH IX DEC IX DEC IX DEC IX LD А,(IX-127) POP IX ADD А,А ADD А,А PUSH IX INC IX INC IX INC IX ADD А,(IX+127) ADD А,(IX+127) ADD А,(IX+127) POP IX SRL А SRL А SRL А LD (IX),А INC IX DEC BC LD А,B OR C JR NZ,DIT_1 RET ---------------------------------------------------------------- 2. Mega-fast 8x8 symbol printing. Well, as you know, sometimes you need to print some element size 8x8. For such small sizes you can use stack, but this is somehow `unaesthetic` ;), because algorithmically you are not good. Well, we will consider this method too, but for now we will consider the method so in which the font is stored as a third of the screen with a logical even address (when the low byte is 0). With this storage search for the symbol corresponding to the code of its image is extremely easy chen - it just won’t happen!. ORG #6000 LOADCODE "FONT" ORG #6800 prn CP #21 JR C,pr_1 LD L,А;на входе в А код символа LD Н,#60; в DE адрес в экране; !ASSM 8;раскрыли цикл LD А,(HL) LD (DE),А INC Н INC D !CONT RET pr_1 XOR А !ASSM 8;печатаем пустое место ;) LD (DE),А INC D !CONT RET Here. Immeasurably quickly. U speed increased when printing all sorts of spaces! And now let's look at the method when a character is printed using stack. Now the character set is stored as standard! ORG #6000 LOADCODE "FONT" ORG #6800 prn CP #21 JR C,pr_1 RL А RL А RL А LD L,А;на входе в А код символа LD Н,#60; в DE адрес в экране; LD (BYTE),SP EX HL,SP !ASSM 4;раскрыли цикл POP HL LD А,Н LD (DE),А INC D LD А,L INC D !CONT RET pr_1 XOR А !ASSM 8;печатаем пустое место ;) LD (DE),А INC D !CONT RET Вот так вот! Bыберaйте, какую хотите, но учтите, что вторая процедура почти не оптимизирована! * * *

Share your thoughts about the article