Adventurer #08
31 августа 1998 |
|
Exchange of experience - The movement procedure of attribute labels in pixels (floating atrubuty).
(C) Ivan Roshchin, Moscow, 1998 If you've seen "ART VISION" demo, remember that in the last part there moving attribute the inscription "intel outside ". Since the label attribute, then and moves it in increments of 8 pixels (1 familiarity), which looks very nice. I wrote a program that essentially implements the same Full-screen, fit into an interrupt "effect, but is now moving - pixel by pixel, which looks incomparably better. This program has a detailed commentary, so that it does not understand be easy. If you want to see how This effect appeared in the original "- simply remove the program from two lines marked with "*". Picture size 64 * 64 familiarity taken from the "ART VISION" demo and is in array PICTURE. Each familiarity is encoded by a single bit, thus the whole Image is 512 bytes. The trajectory of motion is given with an array of CRDS, which contains 100 elements of the form: 1 byte - offset (familiarity) the left side of the fragment relative to the left border of the picture (see fig.) 1 byte - offset (in pixels, in modulo 8) the left side of the fragment relative to the left border of the picture. 1 byte - offset (familiarity) the upper hand with respect to fragment the upper limit of the picture. 1 byte - offset (in pixels, in modulo 8) the upper side of the fragment relative to the upper boundary of the picture. > X whole picture inferred fragment y The number of elements in the array and their values can be changed, thereby setting a new trajectory. So here's the program itself: CALL MAKEADR; Preparing ... CALL UNPACK CALL CLS M1 LD IX, CRDS; address table LD D, 100; number of coordinates ; Table M2 LD BC, 4 LD A, (IX); Take LD (XATR), A; coordinates LD A, (IX +1); output window LD (XPIX), A; * LD A, (IX +2) LD (YATR), A LD A, (IX +3) LD (YPIX), A; * ADD IX, BC; enlarge. Address PUSH IX PUSH DE CALL OUTSCR; Displays POP DE POP IX XOR A IN A, (254) CPL AND 31; If something RET NZ; pressed, exit DEC D; continue ... JR NZ, M2 JR M1 ;*************************************** , Proc. OUTSCR displays a fragment ; Pictures. ; Login: XATR, XPIX - shift left ; Of the fragment in relation ; The left border of the picture (XATR * 8 + XPIX ; Pixels); ; YATR, YPIX - displacement of the upper hand ; Fragment relative to the upper boundary ; Pictures. OUTSCR DI LD (TO_Q +1), SP; have preserved SP LD SP, TAB_SCR ; SP indicates the start address table ; Of the screen. Each execution ; Team POP from the stack address is removed ; The next line. LD A, (XPIX) ADD A, A ADD A, A ADD A, A ADD A, A ADD A, # 80 LD H, A LD L, 0 LD A, (YATR) LD D, A LD E, 0 SRL D RR E SRL D RR E ADD HL, DE LD D, 0 LD A, (XATR) LD E, A ADD HL, DE POP DE; # 4000 LD BC, - # 10 EX DE, HL ADD HL, BC EX DE, HL LD (LP4 +1), DE ; HL points to a string image; ; DE - the address in memory where ; To forward this line , (In this case is the highest ; Line screen with the address # 4000). LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI ; Forward the remaining (7-YPIX) line: LD (HL_S1 +1), HL LD A, (YPIX) LD B, A LD A, 7 SUB B JP Z, SCRH LP4 LD HL, 0 POP DE LD BC, - # 10 EX DE, HL ADD HL, BC EX DE, HL LD (LP4 +1), DE LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI DEC A JP NZ, LP4 , Now has 23 times forward the on 8 pages SCRH LD YL, 23; Counter HL_S1 LD HL, 0; address next LD BC, # 40; forwarded ADD HL, BC; line LD (HL_S1 +1), HL , Prepares to transfer the address: EX DE, HL; have preserved HL LD C, # 1910 POP HL; where to send LD (SP_0 +1), HL ADD HL, BC LD (SP_01 +1), HL POP HL; On the line below LD (SP_1 +1), HL ADD HL, BC LD (SP_11 +1), HL POP HL; On the line below LD (SP_2 +1), HL ADD HL, BC LD (SP_21 +1), HL POP HL; On the line below LD (SP_3 +1), HL ADD HL, BC LD (SP_31 +1), HL POP HL; On the line below LD (SP_4 +1), HL ADD HL, BC LD (SP_41 +1), HL POP HL; On the line below LD (SP_5 +1), HL ADD HL, BC LD (SP_51 +1), HL POP HL; On the line below LD (SP_6 +1), HL ADD HL, BC LD (SP_61 +1), HL POP HL; On the line below LD (SP_7 +1), HL ADD HL, BC LD (SP_71 +1), HL LD (PUT_SP +1), SP; Save. SP EX DE, HL; recuperated HL LD BC, - # 20 ADD HL, BC LD SP, HL POP AF; took the first POP BC; 16 bytes POP DE; forwarded POP HL; line EXX POP BC POP DE POP HL POP IX LD (TWO +1), SP SP_0 LD SP, 0; write down their PUSH IX; screen PUSH HL; in 8 neighboring PUSH DE; lines PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_1 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_2 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_3 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_4 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_5 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_6 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_7 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX TWO LD SP, 0 POP AF; took second POP BC; 16 bytes POP DE; forwarded POP HL; line EXX POP BC POP DE POP HL POP IX SP_01 LD SP, 0 PUSH IX; Write ... PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_11 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_21 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_31 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_41 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_51 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_61 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX SP_71 LD SP, 0 PUSH IX PUSH HL PUSH DE PUSH BC EXX PUSH HL PUSH DE PUSH BC PUSH AF EXX PUT_SP LD SP, 0; Rest. SP DEC YL; decrements LD A, YL AND A JP Z, END_ML; They took 23 lines ; Once brought 12 lines, waiting ; Interruption. It is necessary to synchronize ; With the progress of the beam. When the beam draws the top ; Of the screen, the program displays ; Image at the bottom, and vice versa. CP 12 JP NZ, HL_S1 LD HL, 0 ADD HL, SP LD SP, (TO_Q +1) PUSH IY LD IY, # 5C3A EI HALT DI POP IY LD SP, HL JP HL_S1 ; If YPIX <> 0, to derive the last ; Line at the bottom of the screen: END_ML LD A, (YPIX) AND A JP Z, TO_Q LD HL, (HL_S1 +1) LD BC, # 20 ADD HL, BC POP DE LD BC, - # 10 EX DE, HL ADD HL, BC EX DE, HL LD (LP5 +1), DE LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI ; Forward the remaining rows: LD A, (YPIX) DEC A JP Z, TO_Q LD B, A LP5 LD HL, 0 POP DE LD BC, - # 10 EX DE, HL ADD HL, BC EX DE, HL LD (LP5 +1), DE LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI LDI: LDI: LDI: LDI: LDI: LDI: LDI: LDI DEC A JP NZ, LP5 TO_Q LD SP, 0; recuperated SP LD IY, # 5C3A ;---/--- IY EI RET; Exit Procedure ;*************************************** , Proc. MAKEADR creates a table ; Addresses of all 192 lines of screen , In which each address is increased by # 10. ; Address Table - TAB_SCR. MAKEADR LD HL, TAB_SCR LD DE, # 4010 LD B, 192 LP_MAKE LD (HL), E INC HL LD (HL), D INC HL CALL DOWN_DE DJNZ LP_MAKE RET DOWN_DE INC D LD A, D AND 7 RET NZ LD A, E SUB # E0 LD E, A RET NC LD A, D SUB 8 LD D, A RET ;*************************************** , Proc. UNPACK Unpack the picture To the address on the PICTURE # 8000 - # FFFF UNPACK LD HL, # 8000 LD DE, PICTURE LP_UP1 LD B, 8 LD A, (DE) LP_UP2 RLA LD C, # FF JR C, TO_MEM LD C, 0 TO_MEM LD (HL), C INC HL DJNZ LP_UP2 INC DE LD A, H CP # 90 JR NZ, LP_UP1 LD HL, # 8FFF LD DE, # 9FFF AND A PUSH AF LP_UP3 POP AF LD A, (HL) RLA PUSH AF LD (DE), A DEC HL DEC DE LD A, L CP # FF JR NZ, LP_UP3 LD A, H AND # 0F CP # 0F JR NZ, LP_UP3 LD BC, # 2000 ADD HL, BC EX DE, HL ADD HL, BC EX DE, HL LD A, D CP # 0F JR NZ, LP_UP3 POP AF RET ;*************************************** , Proc. CLS sets the attributes: CLS LD HL, # 5800 LD (HL), 5 LD DE, # 5801 LD BC, # 2FF LDIR RET ;**************************************** ; Picture # 40x # 40 = # 1000 # bit = 200 bytes PICTURE DB # 00, # 00, # 00, # 00, # 7F, # F0, # 00, # 00 DB # 00, # 00, # 00, # 1F, # FF, # FF, # 80, # 00 DB # 00, # 00, # 00, # 7F, # FF, # FF, # E0, # 00 DB # 00, # 00, # 03, # FF, # FF, # FF, # FC, # 00 DB # 00, # 00, # 1F, # FF, # FF, # FF, # FE, # 2000 DB # 00, # 00, # 3F, # FF, # FF, # FF, # FE, # 2000 DB # 00, # 00, # FF, # FE, # 1F, # FF, # FC, # 00 DB # 00, # 01, # FF, # F0, # 03, # FF, # FC, # 00 DB # 00, # 07, # FF, # 00, # 00, # 1F, # F8, # 00 DB # 00, # 0F, # F8, # 00, # 00, # 0F, # F8, # 00 DB # 00, # 1F, # C0, # 00, # 00, # C1, # F0, # 00 DB # 00, # 3F, # 00, # 18, # 00, # E0, # 70, # 00 DB # 00, # 7E, # 00, # 18, # 01, # E0, # 20, # 00 DB # 00, # F0, # 00, # 18, # 01, # E0, # 00, # 00 DB # 01, # F0, # 01, # FF, # 81, # C0, # 04, # 00 DB # 03, # E7, # 03, # FF, # 31, # C0, # 0E, # 00 DB # 03, # C7, # 00, # 1C, # 79, # C0, # 0F, # 00 DB # 07, # 87, # 00, # 18, # F9, # C0, # 0F, # 80 DB # 0F, # 00, # 5E, # 19, # 99, # C0, # 1F, # C0 DB # 0F, # 0E, # 7E, # 19, # 99, # C0, # 1F, # C0 DB # 1E, # 0E, # 67, # 39, # B1, # C0, # 3F, # F0 DB # 1C, # 0E, # 67, # 31, # B1, # C0, # 3F, # F0 DB # 1C, # 0C, # 67, # 33, # E1, # C0, # 0F, # F8 DB # 38, # 0C, # 67, # 33, # C1, # C0, # 07, # F8 DB # 30, # 1C, # 67, # 33, # 89, # C0, # 03, # F8 DB # 30, # 18, # 67, # 31, # 99, # 80, # 01, # FC DB # 30, # 18, # 67, # 31, # 99, # 80, # 00, # FC DB # 60, # 18, # 07, # 31, # F1, # 80, # E0, # 7C DB # 60, # 18, # 03, # 30, # E1, # 80, # E0, # 7E DB # 60, # 00, # 00, # 30, # 00, # 00, # E0, # 3E DB # E0, # 00, # 00, # 00, # 00, # 00, # E0, # 3E DB # E0, # 00, # 00, # 00, # 00, # 00, # E0, # 1E
Other articles:
Similar articles:
В этот день... 21 November