Deja Vu #04
31 марта 1998 |
|
CODING - the procedure "plasma balls".
SoundTrack: "F.T." BY SEC70R/SSG 4 DEJAVU # 3 __________________________________________ (C) Kolotov Sergei, SerzhSoft, 01.03.98. __________________________________________ PLASMA BALLS Not everything - sun, that rises ... Remember VIBRATIONS?! Well, the demo with the Enlight-96, which is still almost won the first place. Today we examine one of the two attribute effects, which were presented in this paper. How it all might have guessed from the title, we will talk about plasma balls. Let me remind you looked like this steep for the time effect. On a black screen fly two attribute colored ball, which upon application each other form new colors, vzaimoslivayutsya. As any two protein clot. In that distant time, the attribute effects are just beginning to "unwind", and plasma is then just started its triumphal procession ... One of the original ideas that have been applied in "Vibration" was that that on the screen before displaying the attributes of the schedule was filled with rare "mesh" that softens the colors and the picture is not so like "a bunch of colored squares. It should be noted that this effect with the balls still in my opinion, one of the best attribute effects. Moreover, plasma-it is hard to like this, on the move had called! The effect produced on me so bright the impression that I, without hesitation, he climbed inside the demo to look at the "cool code. Hmm ... "A king is naked!" Cheats were not written on this too ruleznom level that one would expect! "Not so cool as he is painted!" - I thought, and downloaded the ZX-ASM - "What are we, Siberians, worse?". :-) I took, and wrote his variant of this effect. And what do you think? Happened only 428 bytes suprotiv 1105! But turn to the description of the algorithm ... First, we led the special buffer under the shadow screen size of 64 * 64 = 4096 bytes. In this "shadow businesses" normal attribute the screen will correspond to a rectangle 32 * 24, located in the center. Output and clean, we'll only this rectangle, while the balls are drawn around the shadow screen. Second. Balls are derived as follows: take byte color balls and added to the byte in the shadow screen. The result is placed there too. The idea: Why we do not create a special realtime-procedure, which draws on the tricky balls. A it happens like this: 1. Register HL points to the upper left Drawn angle of the ball in the shadow screen 2. Ball derive along the lines of 3. Null bytes are simply skip 4. Blue color output of the command INC (HL) 5. Red - the two INC (HL) 6. Magenta - LD A, B: ADD A, (HL): LD (HL), A 7. Green - LD A, C: --//- 8. Blue - LD A, D: --//- 9. Yellow - LD A, E: --//- 10. All other colors (white and non-zero PAPER'om) we deduce about this way (simplified): INC E LD A, E: ADD A, (HL): LD (HL), A ... LD A, E: ADD A, (HL): LD (HL), A ... DEC E 11. Before calling the procedure set registers BC = # 0304, DE = # 0506 Third. Compliance procedures output images with shadow screen to the real and clearing all the same "shadow businesses." First - 16 times POP HL: LD (...), HL, and then - too 16 times, but PUSH DE, pre-setting DE = # 0000. By the way! Indeed, this effect works in 48 kbps! And sync "on beam" it is not need - time to all computers. It will be shown on the assembler listing with a few comments. All their program I am writing to ZX-ASM'e. But since Many have respect for other assemblers, the annex you will find a listing for the effect in a simple text format (end of line - # 0D, # 0A). When you load the same in his ZX-ASM you can simply click Import and then have to compile the program ... Adherents of other assemblers will have to sweat a little with conversion if necessary translation software available. Take a look closer to listing program. Initially, we allow interrupts. It is necessary to execute the command processor HALT, which waits for interrupts, and this case, waiting for the start of the beam Monitor building a picture on the kinescope. This is followed by the initialization procedure call. But since procedures follow one the other, then you can leave just one CALL, and subsequent to remove, as commands RET in all procedures, except the last. (For readability and debugging better not delete, and mark it as comment.) INITSCR procedure clears the screen, making and fills it with black graphics "mesh" of the points for a smooth transition of colors. INITBLS procedure initializes the table of coordinates and velocities of the balls. In total, we have a 4 "stack" variables to 5 bytes (Two balls in two coordinates). Rate of change of the coordinates are copied from the table BLS_DAT. MK_OUTC procedure is programmed in realtime and creates a combined procedure for rapid display an image on screen is real and cleaning of the shadow. (OUTCLR2) Procedure MK_PUTB initially in the buffer draws top half colored ball using a "floating overflow borders. "Then you draw a part is mirrored, and get a ball. Then, using the received image fast realtime-generated procedure O pen on the shadow screen. (PUTBALL) In the main loop program, we wait until beginning of the beam (HALT), then we deduce image with a shadow screen and clear it (CALL OUT_CLR). The next step the new coordinates are counting beads and paint their shadow on the screen (PUT_BLS). Cycle is interrupted by pressing SPACE, after which we return to a place call (BASIC, assembler ...). Well you probably already can not wait download the assembler, so time for me to call it a day ... Hope you enjoyed it ... With all the suggestions, concerns, suggestions, please contact: 641800, Kurgan region., G.Shadrinsk, st. Karl Liebknecht, 27, kv.1. Kolotova Sergei Sergeyevich. All of your letters carefully considered and, if possible, I try to answer them. With best wishes Serzh.
Other articles:
Similar articles:
В этот день... 21 November