ZX Forum #04
19 ноября 1997 |
|
screen effects - Running a string of R-Type.
Ground effect In search of original effects turn to what is already created. Indeed, there is no need reinvent the wheel. For examples not far to seek. Game programs - it is such storehouse of ideas that we can take and any "untwist" it up infinity. You will find so many little tricks that last a long time. Do not even need to "get into the wilderness" of the program, you can take what is on the surface. By repeating the proposed programs you will inevitably new ideas and you can come up with something really new. Now we'll talk about code snippets - a procedure that would allow for a variety of original effects in programs associated with cleaning or drawing of the screen text output. All procedures listed below, the "pull" of the specific game programs. With emphasis was not made on the academic side of the issue, that is not on how does this procedure but on an entirely practical, then is how to reproduce a particular effect in his program. This led to the fact that in the initial procedures performed certain changes of addresses and address some other points that allow blocks of code operate completely independently. So those who want to use them in their programs that will only write and run them. For all procedures are BASIC programs to get the proposed block codes for recording on a tape recorder and for the program's demonstration. Owners BETADISK interfaces (TR-DOS) themselves will be able to SAVE or LOAD substitute the standard prefix "RANDOMIZE USR 15619: REM:". A few words to the BASIC program for block codes. In line 10, after the DATA set the following parameters: the value RAMTOP, the name of the block codes used in the tape recording, load address and length of the block codes. Actually codes for a set of are in the DATA lines to 100. R-TYPE The game begins with a ticker at the bottom of the screen. Character height - double, moving lines - smooth, with increments of 1 pixel. Here is a slightly modified (with to unite into a continuous block) listing of this procedure: 1423. 8CC0 21858D LD HL, # 8D85 8CC3 CDCD8C CALL # 8CCD 8CC6 21658D LD HL, # 8D65 8CC9 CDCD8C CALL # 8CCD 8CCC C9 RET -------------------------- 8CCD CB7E BIT 7, (HL) 8CCF C0 RET NZ 8CD0 CBFE SET 7, (HL) 8CD2 E5 PUSH HL 8CD3 011F16 LD BC, # 161F 8CD6 CD0F8D CALL # 8D0F 8CD9 0604 LD B, # 04 8CDB C5 PUSH BC 8CDC 21DF50 LD HL, # 50DF 8CDF CDFE8C CALL # 8CFE 8CE2 21FF50 LD HL, # 50FF 8CE5 CDFE8C CALL # 8CFE 8CE8 21DF50 LD HL, # 50DF 8CEB CDFE8C CALL # 8CFE 8CEE 21FF50 LD HL, # 50FF 8CF1 CDFE8C CALL # 8CFE 8CF4 76 HALT 8CF5 C1 POP BC 8CF6 10E3 DJNZ # 8CDB 8CF8 E1 POP HL 8CF9 CBBE RES 7, (HL) 8CFB 23 INC HL 8CFC 18CF JR # 8CCD -------------------------------- 8CFE 0E08 LD C, # 2008 8D00 E5 PUSH HL 8D01 0620 LD B, # 20 8D03 A7 AND A 8D04 CB16 RL (HL) 8D06 2B DEC HL 8D07 10FB DJNZ # 8D04 8D09 E1 POP HL 8D0A 24 INC H 8D0B 0D DEC C 8D0C 20F2 JR NZ, # 8D00 8D0E C9 RET -------------------------------- 8D0F 7E LD A, (HL) 8D10 E67F AND # 7F 8D12 E5 PUSH HL 8D13 2600 LD H, # 2000 8D15 6F LD L, A 8D16 29 ADD HL, HL 8D17 29 ADD HL, HL 8D18 29 ADD HL, HL 8D19 11003C LD DE, # 3C00 8D1C 19 ADD HL, DE 8D1D 78 LD A, B 8D1E E6F8 AND # F8 8D20 C640 ADD A, # 40 8D22 57 LD D, A 8D23 78 LD A, B 8D24 E607 AND # 07 8D26 0F RRCA 8D27 0F RRCA 8D28 0F RRCA 8D29 81 ADD A, C 8D2A 5F LD E, A 8D2B C5 PUSH BC 8D2C 3A648D LD A, (# 8D64) 8D2F A7 AND A 8D30 280A JR Z, # 8D3C 8D32 0608 LD B, # 08 8D34 7E LD A, (HL) 8D35 12 LD (DE), A 8D36 14 INC D 8D37 23 INC HL 8D38 10FA DJNZ # 8D34 8D3A 1814 JR # 8D50 8D3C 7A LD A, D 8D3D 08 EX AF, AF ' 8D3E CD598D CALL # 8D59 8D41 08 EX AF, AF ' 8D42 57 LD D, A 8D43 7B LD A, E 8D44 C620 ADD A, # 20 8D46 5F LD E, A 8D47 3004 JR NC, # 8D4D 8D49 7A LD A, D 8D4A C608 ADD A, # 08 8D4C 57 LD D, A 8D4D CD598D CALL # 8D59 8D50 C1 POP BC 8D51 0C INC C 8D52 E1 POP HL 8D53 CB7E BIT 7, (HL) 8D55 23 INC HL 8D56 C0 RET NZ 8D57 18B6 JR # 8D0F ------------------------------- 8D59 0604 LD B, # 04 8D5B 7E LD A, (HL) 8D5C 12 LD (DE), A 8D5D 1914 INC D 8D5E 1912 LD (DE), A 8D5F 1914 INC D 8D60 23 INC HL 8D61 10F8 DJNZ # 8D5B 8D63 C9 RET ------------------------------- 8D64 00 mode (height) ------------------------------- 8D65 ... Text Ticker 2 Starts running line with load address 8CC0H (36,032). Calling procedure (8CC0H - 8CCCH), incidentally, may be elsewhere in your program. In the register HL is given by starting address of text messages, then there is a procedure call running line. This can happen many times from different places in your program. When Moreover, every text message must finish printing 32 spaces at the end, this will prevent stop scrolling text on mid-sentence. "Generally need 31 spaces, as the latter familiarity is automatically cleared when the horizontal scrolling. If the running line invoked many times, it creates a significant amount of memory. Therefore, printing 31 spaces allocated in a separate part, it should be performed whenever the print text. This you can see at 8CC6H. Text messages are to address 8D65H (36,197). In the end of each text message to be delivered end mark - any number included seven beats. For example, just FFH (255). Proper procedure "is running Line "(8CCDH) begins with a command end marker test. In Depending on this, is either way out of the procedure or continue. The team at 8CD3H in Register BC is given the initial printing position (line and column), in the example respectively 16H (22) and 1FH (31), then there is a line appears in the bottom of the screen. You can change them (we consider version of such changes). Then, the procedure call Print 8D0FH. With a double height character will be especially noticeable when Scrolling will not occur smoothly - it is immediately manifested in the form of distortion of vertical lines. Therefore, the scrolling occurs in increments in a first pixel of the upper half of the symbol (1 familiarity), then immediately lower. When you call procedures scrolling - 8CFEH - pre-register at the address given by the HL system on display file corresponding to the top pixel line shifts familiarity (in this example is 22-th row and 31-e familiarity). After running a couple cycles of scrolling should command HALT, which is necessary not only for job speed of ticker, but also to synchronize the images with Vertical TV to eliminate distortions of characters. After that there is a loop for printing the next character text message. A few words about the procedure Print 8D0FH. The team at 8D19H in register DE is given by address corresponding to the value CHARS that character set, which will be printing the text crawl. When Using downloadable character set must be considered that the height of symbols - double, so what is beautiful for a single height, can appear distorted when the double height. Authors with the development of a procedure was laid down an interesting point: the system is introduced the cell, which determines the height of the ticker symbols. It can be double or single. Specifies the height of the cell contents 8D64H (36,196). If there is zero the height - double. Any non-zero value specifies a single height of the symbols. This check performed at 8D2CH. In Depending on this happening performance of different units: in single height - 8D32H ... 8D3AH, and at the double - 8D3CH ... 8D4DH. The principal difference these blocks is a single or a double appeal to the procedure for transferring 8 bytes on Screen 8D59H. Please note that nowhere Playing no change in the color attributes of the screen. They are "transparent", ie those which were given previously in these positions the screen. Now a few words about changing the marquee. Suppose that you want, to a running line was located at the top of the screen, but to deal with than the entire line, and only familiarity with the 10 to 21 (ie there are only 12 familiarity in the middle of the line). To do this we just change the position to start printing: 1423. 8CD3 011500 LD BC, # 0015 2 In addition, it is necessary in accordance with this change addresses in the file system on display for scrolling: 1423. 8CDC 211540 LD HL, # 4015 8CE2 213540 LD HL, # 4035 8CE8 211540 LD HL, # 4015 8CEE 213540 LD HL, # 4035 2 It is also necessary to limit scroll zone 12-familiarity: 1423. 8D01 060C LD B, # 0C 2 The number printed at the end of the gaps can now be reduced to 11, setting a marker at the end new location. Experience the resulting variant, and we see that for small the length of the on-screen text, the velocity of its too big - it became difficult to read. The speed can be reduced if the following changes: 1423. 8CD9 0608 LD B, # 08 8CE8 2000 NOP .... .. ... 8CF3 2000 NOP 2 Now a team of HALT will not run after the pair, and after each subroutine call scrolling, and the rate of O Text slowed twice. Now everything is in order. It remains only to draw with ART-STUDIO resulting zone running line (including the INK and PAPER those familiarity, which will output text) in the form of placards or display, which is part of the spacecraft cabin or otherwise - on a plot of your game. Program in BASIC for block codes "running Line: 1 READ ram: CLEAR ram: READ f $: READ st: READ len: FOR a = st T O st + len-1: READ b: POKE a, b: NE XT a: SAVE f $ CODE st, len 2 RANDOMIZE USR st 1910 DATA 36031, "rt", 36032,268 100 DATA 033,133,141,205,205,140,033,101, 141,205,205,140,201,203,126,192, 203,254,229,001,031,022,205,015, 141,006,004,197,033,223,080,205 110 DATA 254,140,033,255,080,205,254,140, 033,223,080,205,254,140,033,255, 080,205,254,140,118,193,016,227, 225,203,190,035,024,207,014,008 120 DATA 229,006,032,167,203,022,043,016, 251,225,036,013,032,242,201,126, 230,127,229,038,000,111,041,041, 041,017,000,060,025,120,230,248 130 DATA 198,064,087,120,230,007,015,015, 015,129,095,197,058,100,141,167, 040,010,006,008,126,018,020,035, 016,250,024,020,122,008,205,089 140 DATA 141,008,087,123,198,032,095,048, 004,122,198,008,087,205,089,141, 193,012,225,203,126,035,192,024, 182,006,004,126,018,020,018,020 150 DATA 035,016,248,201,000,032,032,032, 032,032,032,032,032,032,032,032, 032,032,032,032,032,032,032,032, 032,032,032,032,032,032,032,032 160 DATA 032,032,032,032,255,085,078,065, 085,084,072,079,082,073,083,069, 068,032,068,073,083,067,076,079, 083,085,082,069,032,079,070,032 170 DATA 084,072,073,083,032,073,078,070, 079,082,077,065,084,073,079,078, 032,073,083,032,080,085,078,073, 083,072,065,066,076,069,032,066 180 DATA 089,032,068,069,065,084,072,032, 033,033,033,255
Other articles:
Similar articles:
В этот день... 21 November