Buzz #10
16 сентября 1997 |
|
Assmbler - A beautiful effect "Burning sprite.
ASSEMBLER *** *** (C) Paracels' DYK. The appearance of this column is due to its extraordinary popularity in all the computer magazines. We decided not to deprive you - our Readers of this joy, but to say that does not claim the status of steep encoders, etc. We decided not to teach you assembly language, because now he knows everyone (or almost everyone) but simply give assm'ovskie texts nekrtoryh effects and explanations for them. We hope that this column will get everything related to the assembler: effects of useful utilities that xor'ki etc. What specifically will print under the heading 'ASSEMBLER' depends, first of all, from us and, of course, from you. Possibly leading this category, we do learn something steep and share with you, but for now give the text a simple but beautiful effect 'BURNING Sprite'. Posneniya front lines to help you better understand the effect of the work. The effect is based on processing the sprite logical operations AND, OR and XOR, thanks to which is obtained by the fire. Size sprite you can set the variables X_SIZE and Y_SIZE. Metka SHIT indicates the beginning of your sprite (where it is stored as a list of DEFB bytes, you can load it INCBIN'om). Another thing: when you create a sprite leave the top margin of 2-3 familiarity to last-minute "embers" flew higher, that will look very nice. And here's the text ... X_SIZE EQU 4; size of the sprite X (in the familiarity). Y_SIZE EQU 32; size of the sprite Y (in pixels). ORG 25000 LOOP EI HALT DI CALL GOREN; Call Subroutine burning sprite. LD A, # 7F IN A, (# FE); Poll. RRA JR C, LOOP EI RET GOREN LD HL, SHIT; Address sprite. EXX LD C, 0 LD DE, 16384; Address screen to print a sprite. LD L, E LD H, D X_COOR PUSH DE LD B, X_SIZE X_COOR2 EXX LD A, R; Take the "random" number in A fills LD E, A; in E. Endymion And the number 7 and records in D. AND 7 LD D, A EX DE, HL; HL = address of the screen, DE = address of the sprite. XOR (HL); Ksor and the contents of the screen increases INC L; ourselves to address in the HL and do contain OR OR (HL); zhimym HL. EX DE, HL; HL = address of the sprite, DE = address of the screen. EXX; replaces registers: HL = DE = address of the screen , (In this case # 4000/16384). EX DE, HL; HL = # 4000, DE = # 4000. AND (HL); Endymion and the contents of the screen. EX DE, HL; HL = # 4000, DE = # 4000. EXX; replaces registers: HL = address of the sprite, ; DE = address of the screen. OR (HL); Endymion A byte sprite INC HL; increase the address in HL. EXX; replaces registers: HL = # 4000, DE = # 4000 LD (HL), A; Writes a (HL) (HL = # 4000) contents ; Register A, ie fills the screen. INC E; Increase L and E: DE = # 4001, INC L; HL = # 4001 DJNZ X_COOR2; Reduce B; if not zero, then the transition ; Go on X_COOR2 POP DE; Restore DE. DE = # 4000. LD L, E; L = E = # 00 LD H, D; H = D = # 40 CALL INC_DE; proceed to obtain routine ; Lower addresses screen. INC C; Increment C, LD A, C; record in A and compared with height CP Y_SIZE; your sprite Y. JR NZ, X_COOR; If not zero, ie C is not equal to Y, then ; Go to X_COOR. EXX; replaces registers. RET ; Sub-get low address display in DE. INC_DE INC D LD A, D AND 7 RET NZ LD A, E ADD A, 32 LD E, A RET C LD A, D SUB 8 LD D, A RET SHIT DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 0,0,0,0,0,0,0,0 DEFB 102,253,153,240,102,193,155,0 DEFB 102,193,155,0,102,193,155,0 DEFB 102,193,155,0,102,193,155,0 DEFB 102,193,155,0,60,241,251,112 DEFB 102,193,155,48,102,193,155,48 DEFB 102,193,155,48,102,193,155,48 DEFB 102,193,155,48,102,193,155,48 DEFB 102,193,153,240,0,0,0,0 Well, good luck! Paracels' DYK.
Other articles:
Similar articles:
В этот день... 21 November