Adventurer #09
30 апреля 1999 |
|
Exchange of experience - spinner - izvraschalka (Zoom Rotator).
(C) SerzhSoft Spinner-IZVRASCHALKA Not so bad traits his baby! As you may have guessed from the title, in This article is about something the rotary. The article was conceived as a sequel to "Plasma balls" from Deja Vu # 04 and "floating attributes" of Deja Vu # 03, so I advise all those who have not read these articles, especially review with them and then to study this ... The fourth issue we discussed a of the best effects Homel demos VIBRATIONS (RUSH). Enlight-96 on this trekmochka created a furor and preliminary results of a vote taken even the first place, ahead of ILLUSION. This contributed to a couple of attribute a lot of effects, which at that time only pervootkryvalis ... One of them, "Plasma balls, we have already considered, and now it's time to move on to the best the effect of Enlight-96 - to attribute spinner, iskazhalke, priblizhalke, udalyalke, smeschalke ... shorter - izvraschalke called "RUSH-1996". It is no wonder that in its review of all known glory Mednonogov then wrote: "It's worth seeing! All fallen! " Looks, of course, the effect is simply slaughter, but that's if you start to dig in Codes wanting to figure out - how it all Working ... Yes ... There's the devil himself a leg break! Guys (IMP or BACA?), Seems much in a hurry (or lazy: -)) ... As a natural result - obscure, Yes and the amount hoo! I had all kodit from the start, and what came out - now see ... Firstly, I was inexpressibly surprised that is, that the inscription "RUSH 1996" is actually a fucking picture! Why? It is much easier this label printing, the more so if it can be easily changed without having to download to this ART-STUDIO! Secondly, I still wondering - what function is computed plate trajectory. That I managed to learn, so this is the length of the plate - (# 0800) and plot functions. And the function itself to guess - I did not found free time - who knows - write ... Sam schedule on a reduced scale is shown in the figure and watch it you can, using the program from artless in BASIC. Before its launch, download the file rtr_data at 32,768 and look nazdorove. Total in the table 1024 double-byte numbers of type integer (-32768 ... 32767), which take values from -433 To 780. Thus, the amplitude of 433 780 +1 = 1214. Thus, the program: 10 LET o = 176/1214 * 433 1920 PLOT 0, INT o: DRAW 255, 0 30 FOR i = 0 TO 1023 40 LET l = PEEK (32768 + i * 2) 50 LET h = PEEK (32768 + i * 2 +1) 60 LET hl = l + h * 256 70 IF hl> 32767 THEN LET hl = hl-65536 80 LET y = 176/1214 * hl + o 1990 PLOT INT (i / 4), INT y 100 NEXT i And now proceed to consider the effect. I debugged the program for ZX-ASM 's, so the entire listing before a 40-digit format. Source can be found in the annex, but it contains no file for the ZX-ASM 'a, a simple text strings, ending code 13 (# 0D). This is done to you able without interference to throw the program in one assembler, which is more convenient. In the ZX-ASM 's the same, you just run Import and then compile ... You already know that this effect used 2048-byte plate trajectory. Listing she loaded team INSERT "rtr_data", but when debugging I asked her a little differently ... To speed up the compilation, I disassemble the STS 'om all the plate in an assembly format, resulting in speed compile / run / debug the program increased significantly. I advise you also to do with their little boxes, sprites, massivchikami etc. The effect is written in traditional style 90 years - "realtime programming". FX divided into three main parts: 1. The main program. Produced initialization procedure calls that precede effect, and procedures deinitialisation Folding FX. Here "sits" cycle display of the effect ... 2. Initialization procedure, effect. Clear the screen, the generation of the necessary tables data, fast procedures ... 3. Procedures actually produce the very effect. Usually cause a very realtaymovye speed super-procedure written to the limit Speccy. In this case, the parent program cause such an initialization procedure: 1. INITSCR - reset the curb, clear the screen and fills it with the pixels in a checkerboard pattern for the subsequent more smooth transition of shades of colors when the effect. Initialized both Spectrum Screen: Zero (# 4000 .. # 5AFF or # C000 .. # DAFF on page 5) and first (# C000 .. # DAFF on page 7). 2. MK_RTBL - how to move podgruzhennoy plate motion in the segment Data at # 6000. nameplate must stand at a multiple of # 0100 (256). That is, low byte address should be zero. In principle, know if certain functions, on which construction plate, you can Generate it in real-time, missed only 200 .. 300 bytes and thus saving more than half of kilobytes! 3. MK_RTRL - in a segment realtimekodov Creates fast calculation procedure and displays one line attributes effect - RTRLINE. 4. MK_RSCR - generation procedure rotate the picture with an inscription to FX'a. Creates a background image, then printed shadow of the inscriptions, and only then - the very title. It can be overridden - enough change the assembler line: MESSAGE DB "SERZH 1998" # 00 But remember that the length of the inscription can not exceed 10 characters and must end code # 00 and include only standard characters with codes from # 20 to # 7F. You can also try poizmenyat special constants generated images: SHADOWX and SHADOWY - the shift of the shadow regarding the inscription; INK_CLR and SHD_CLR - Color characters and shade, respectively; BGROUND-core background color - defines the main color "rainbow" under picture. Next, the program goes to the head cycle Implementation of the effect - is procedure call RTRATTR, repeating until until you press SPACE. The effect begins with a smooth "Opening screen" - like climbing up the curtain. All this time and further We are seeing a rotation movement and distortion of the generated images with the inscription, displayed in LOW RESOLUTION (ie, attributes) ... The procedure is actually RTRATTR six interrelated logical parts: 1. Handling two screens. Conclusion has already is a calculated image at the visible screen and the calculation of the new image in the active screen. Detail the concept is dealt with in Deja Vu # 03 (article, "Demos kodit I want" and "Floating attributes"). The only difference is that in this case Zero screen is not connected by address # C000, there is always a page with 7 first screen ... And as the program she "guessed" exactly where it is must display the rendered (a calculated) picture ... 2. Next is the manager of various Parts of the effect. Indeed, in the present FX'e different forms of movement, which are switched at one time. Referred to as a piece of code once and is responsible for switching those parts for which data are taken from Table PARTTBL. In it for each sub-part is given by 5 bytes: the first is responsible for part time work, and the remaining are different rate constants / iskazhaemosti pictures while driving. Can poizmenyat these constants in one direction or other side and look what happens ... In the original code VIBRATIONS this piece of code was replaced by direct entering the corresponding constants in program that took untold number of extra bytes and difficult debugging! I would like to ask the guys from RUSH: "Why is it so difficult?!" 3. After the manager often is the calculation of the current coordinates Y and X, the output window effect. Immediately from the table the motion displacement coordinates are taken and recorded in the registers, DE and DE ', which are used later in the main loop output window. 4. Here the calculated value of the visible window, which can range from # 00 (can not see anything) to # 18 (Box matches the size of the screen). If the window size is 0, then immediately jump to step 6. 5. The main loop output window. Depending on its size, the required number of times The calculation procedure is called realtaymovaya single line image - RTRLINE. The procedure returns to the label RT_RTR team JP, since the command RET isolzovat impossible due to the fact that the stack we have points to the current address of the output to the screen (the image is formed teams PUSH BC). In the main loop is also produced "Trimming" for each image line initial coordinates Y and X and their displacement in Depending on the current values of speed / iskazhaemosti ... 6. Next is a fragment of code responsible for cleaning up the remainder of the screen, not included in the "window effect". Zeroed register pair DE, and using commands PUSH DE clears. Upon completion of the stack RTRATTR restored, and we return to main loop effect. When you press SPACE this cycle is interrupted and the following happens ... Team INC A, addressable Tagged LNS_ADD, changes to the DEC A. Thus We vklyuschaem "closing the curtains." Next, # 1A just call the procedure RTRATTR, which now roll the screen. Then restore the value of the register HL '= # 2758 for the correct function in BASIC, which perform ... RAMPAGE procedure produces the correct address to the port # 7FFD, retaining while a copy of the recorded value of the port register A in the system variable BANK_M. Changing the constant, you can specify CHARS address their own, not ROM 'Shnogh character set. Constant RTR_SCR matters # E000 and should not be changed. It indicates the beginning of the generated images. AND The thing that should be "circular" X and Y coordinates to derive a shifted or rotated images. With the X coordinate any difficulties arise, because it is responsible for the low byte of the picture. And if, for example, the X coordinate equal to 255, add 1, then we get X = 0. C igrekom harder. After all, he must always be within a picture, that is In our case, from Y0 to Y0 + YR (where Y0 - starting address of a picture, and YR - its height). If Y0 = # E0 and YR = # 1F is very simple enough after the team calculate the coordinates of Y give a command OR # E0, then we will always be "cool" in the range of # E000 to # FFFF. Others address values are no longer "fit." In principle, could increase the vertical image size, position it to address # C000, there is but we have been sitting "the first graphic "screen, so that nothing leave. Or would have had to add a bunch of commands to switch the pages of memory back and forth during the calculation and display ... Uhh! Enough to ship! If anything else is unclear, the farther you have to sort out themselves. Then you should to help no comments that are present in the listing effect. And I think I'll call it a day ... Do not forget to write reviews of articles that you read. I already beginning to end with confidence that all this is someone who needs ... And difficult to guess what is interesting to readers! :-) Write about what effect you want to read next? Good luck! With best wishes, Serzh.
Other articles:
Similar articles:
В этот день... 21 November