Demo or Die #02
31 июля 1999

Demo-Building - Generator table of squares.

<b>Demo-Building</b> - Generator table of squares.
__________________________________________


   (C) ra! D


       Generator table of squares


   The operation of this generator is based on
very interesting dependence
Mathematically, it looks like this:


      k k-1

     X = X + Nk,


         k k-1

   where X and X - the squares of consecutive
numbers on this and previous iterations duschih;


   k-iteration number, respectively;

   Nk - the number of a number of positive odd
numbers;


   I think that is a small table,
help to understand this algorithm.


                     -

    X 1 2 3 4 ...

                     -

   X ^ 2 1 4 9 16 ...


    N 3 5 7

                     -


   Some comments on this
Example:


   1) This example creates a table
squares of numbers from 0 to 255;

   2) In the table, the squares of numbers
are top-down, ie first
is the square of 255, then the square 254 and so on
(This is due to specific structures
stack).

   The disadvantage of this is difficult to call, say
so it's just a side effect, which
very easily solved by a sufficiently
inverted number whose square
is like this:


             LD A, NUM,

             , Whose square

             ; To find.

             CPL

             LD BC, TABL

             LD H, 0

             LD L, A

             ADD HL, HL

             ADD HL, BC

             LD E, (HL)

             INC HL

             LD D, (HL)


   3) Do not forget at the end of the program
redirect the stack.

;*****************************************
; * GEN_TABL_X ^ 2 *
; * (C) 1999 idea and code by ra! D *
; * Code len: 16b *
;*****************************************


      LD SP, TABL +512

      LD HL, 1

      LD D, H

      LD E, L

      LD B, # FF
LP1 PUSH HL

      INC DE

      INC DE

      ADD HL, DE

      DJNZ LP1

      ; LD SP, nnnn

      ; RET

TABL DEFS 512


   P.S. Incidentally, I have not met any
a mathematical reference, description
this method.
__________________________________________








Other articles:

Deathmatch Quake v. 2.00 - BRIEF manual on methods of deprivation life of their own kind.

Demo party - OFFICIAL results Chaos Construction 999 for the PC.

Demo party - OFFICIAL results Chaos Construction 999 for the ZX Spectrum.

Demo party - OFFICIAL Paradox'99 results for the PC.

Demo party - OFFICIAL Paradox'99 results for the ZX Spectrum.

Demo-Building - Phong Shading.

Demo-Building - Radial blur, blur effect around the bitmap.

Demo-Building - Generator table of squares.

Demo-Building - an ancient effect a tricky name Moving Shit.

Demo-Building - some of sorting method.

Demo-Building - The printing of chunks.

Demo-Building - The implementation of plasma sizes of 2x2.

NeOS FAQ - Frequently Asked vopposy operating system for ZX Spectrum - NeOS.

Interview - Interview with Dennis Ritchie (Dennis M. Ritchie) creator of the programming language "C".

Interview - an interview with a famous coder'om, one of the founders M & U Sinclair Club, and later eTc group - Lazy.

Interview - Interview with the encoder and zhelezyachnikom LD / X-Trade.

Criticism - Kartika at first nome.p zhypnala Demo or Die.

From the Editor - interface.

From the Editor - Epilogue.

Application - wrapper display files LazyPack 2.0.

Advertising - Advertising and announcements.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
List BBS - The list of stations BBS. Rules for working with BBS. Address of gateway stations to other networks.

В этот день...   21 November