Speccy #06
31 августа 1996 |
|
Programming - the effect of page turning the text on the sine.
PROGRAMMING Vladimir Kuznetsov HaLLo! With your regular correspondent heading "Programming". During the summer there are many great events (collapsed "Omega H.C.", successfully gathering demomeykerov "Enlight'96" with its attendant consequences from there, I I got me "Amiga 1200" and dob) and accumulated a lot of ideas. C one of which I now share with You. Around since 1994 can be found in various intruhah, demonstrashkah and t.p.effekt page turning text sinusu.Ya'm sure someone of you tried to replicate this effect (Without breaking the original), but nothing failed because conventional methods are not suitable for this purpose. K this problem should be approached outside the box, which we now do. But to start let us agree on the allocation of memory: # FFFF Second page of text # F000 # EFFF The first page of text # E000 Addresses can be taken and others, but These are chosen in order to save memory. The principle effect is very simple: 1. Propechatyvaem first page (You will need to be make its own procedure fool printing character); 2. Deduce it to the screen; 3. Pauses; 4. Propechatyvaem second page; 5. Deduce it to the screen; 6. Pauses; 7. Repeat from the beginning. We are only interested Output buffer points to the screen. This can be done several ways. For example LDIR'om or stack, and more effective in this case is a very original method: PUT_B: LD (P_EXIT +1), SP LD SP, HL POP HL LD (# 4800), HL POP HL LD (# 4802), HL POP HL LD (# 4804), HL ..... POP HL LD (# 57FE), HL P_EXIT: LD SP, 0 RET Brilliant! We killed immediately with 2 rabbits: copied buffer (to copy a single byte wasted only 13 cycles!) and spit on the nonlinearity of the screen! But another problem arises, for the copy procedure is required in exactly 2 times more memory than inferred buffer. It follows conclusion: if you write so much "Genius" program, which is not can afford the extra bytes, this method is not for you. No need to fill "kopirovalku manually. You may notice that "kopirovalka consists of repetitive commands, therefore, I advise you to write for such cases installer (a procedure that will create what you need). Now we only need to enter "Kopirovalki" in the register pair HL file start address sprite, and everything else it does itself. To change the screen to calculate a table of values of the cosine formula: X = INT (64 +63.5 * COS (I * PI/64)), where X - result I - option (FOR I = 0 TO 127) Correspond to the first page values for I = [0 63], and the second page - I = [64, 127]. I have simplified his task by using ready-sprite (disappear procedures for printing characters control over the position of the pointer in a buffer and a pause between the pages). The result is a image viewer 256 lines. Not to be unfounded, I prepared a program that demonstrates the 2 images the size of 256x256 pixels. Switching images is done by pressing press ENTER, and the output of the demonstration on SPACE.YA Attached you will find the text programs for TASM (do not forget download Russian font TASM.FNT to read my comments) and image files ROSE.DAT and CHER. DAT (sprites size 8192 bytes) P.S. Images (256x256), I took from the graphical redadaktora Personal Paint 6.4 (Amiga) and there to convert them into 2 colors. i'LL B BaCK SPeCiaL 4 u, Mr.Key
Other articles:
Similar articles:
В этот день... 21 November