Demo or Die #02
31 июля 1999

Demo-Building - The printing of chunks.

<b>Demo-Building</b> - The printing of chunks.
__________________________________________

 (C) Devil of eTc / Scene '99


   Chanks ...


  Currently, the domestic
demomake'rstve more and more
becoming popular for use
graphics output on the screen of so-called
chunks.
 The advantages of this technology are great,
Among them:

  - 16 shades of gray (even if
Chunks 8 * 8 we can use
attributes, then the colors become even
too much:)
 - Relatively fast output to
Screen (2-3 int'a), with a rather small
scale image of the screen (no more than 3,072 b.);
 However, there is a drawback, which is almost
balances the benefits:
 - Significantly decreases the screen resolution
(If chunks 4 * 4 it is obvious resolution
screen will be 64 * 48 that, to put it mildly,
not enough ...);


  Example chunks 4 * 4 you can see in
demos such as Refresh, Forever,
5thElement, Goa and many others.


  First, consider how to derive
finished animation on the screen (the effect you
can be found in the intro Demo or Die # 01). For
This should be very animated in such a
format:


      1-byte 2-byte

     OOOO OOOO OOOO OOOO. . .

      / \ / \

  1 Chunk 2 Chunk 3 Chunk 4 Chunk


  That is, you have to convert so-
image to the first byte in the older
half of the code is the first chunk
(4 bit - 0 .. 15 shades of gray), and
the younger half of the byte code of the next
chunk, and so all of Kartika. Following her
Memory must be placed second image
pictures, then third, etc.


 Here is a sample program with a detailed
description.


        ORG 25000
CADR EQU 12; SIZE
LEN EQU 15; REAL_LEN = (LEN +1) * 4
HGT EQU 48


;==================================;
; Kidatel chunks by Devil / eTc / sCeNE;
; MoveR cHanKS 4 * 4 pIXels;
;==================================;

CHANKS EQU # F000; at this location will

                  , Is launched

                  ; Table. Images of chunks


        EI: HALT


        CALL INIT_CH;, expand the floor
                     ; Nuyu Table. chunks


        CALL INITCH; initialize

                     ; Kidatel chunks


        CALL INITTAB; create a table. hell
                     ; Ests screen

        LD A, CADR; in A, the number of

                     ; Animation frames

        LD LX, A

TWERD

        EI

        HALT

        CALL MOVCH; call the procedure

                     , Throwing the image of scr.

        LD A, # 7F; check press

        IN A, (# FE); space, and if
        RRCA; lie then the output

        RET NC


        JR TWERD

MOVCH
; Procedure for deriving the image of the screen
MOVCH1 LD A, LX

        DEC A

        AND A

        JR NZ, MOVCH0

        LD A, CADR

        LD HL, TABLCH; in HL, the address of the image

                     ; Screen
MOVCH0 LD LX, A

        XOR A
MOVCH2 LD HX, A


        LD B, TABLADR [; in B, high byte

                      , Address table

                      ; Address screen

        ADD A, A

        LD C, A

        LD A, (BC)

        LD D, A

        INC BC

        LD A, (BC)

        LD E, A; in DE, address screen

        PUSH DE; from which we

                     ; Output chunks

        LD B, CHANKS [; in B, high byte

                     , Address table

                     , All combinations

                     ; Chunks

        CALL PUTLIN; draw a line from

                     ; (LEN +1) * 4 chunks

        POP DE

        LD A, HX; check, rather than

        INC A; the last line is

        CP HGT; we withdraw?

        JR NZ, MOVCH2

        RET

;-----------------------------;
; CREATE DITHER TABLE
To the address DTDAT are images of chunks
; Duplicated in older and younger
; Parts bytes.
; Example:
,% 1010 1010
,% 0100 0100
,% 1010 1010
,% 0000 0000

; Procedure INIT_CH deploys images
; Chunks at # F000, so that
; Get all # FF combinations of chunks.
; Byte address indicates the number
; Chunk and byte for byte number in
; Chunk (from # 0400 bytes)

INIT_CH

        LD HL, CHANKS
CRDT0 LD A, L: AND # F0
.2 RRCA

        LD DE, DTDAT

        ADD A, E: LD E, A

        ADC A, D: SUB E: LD D, A

        LD B, 4
CRDT1 LD A, (DE): INC DE

        AND # F0

        LD (HL), A: INC H

        DJNZ CRDT1

        LD A, L: AND # 0F
.2 RLCA

        LD DE, DTDAT +4

        ADD A, E: LD E, A

        ADC A, D: SUB E: LD D, A

        LD B, 4
CRDT2 DEC DE: LD A, (DE)

        AND # 0F

        DEC H: OR (HL)

        LD (HL), A

        DJNZ CRDT2

        INC L: JR NZ, CRDT0

        RET

DTDAT; 16 COLORS DITHER DATA

        DB # 00, # 00, # 00, # 00

        DB # 00, # 00, # 00, # 00

        DB # 88, # 00, # 00, # 00

        DB # 88, # 00, # 22, # 00

        DB # AA, # 00, # 22, # 00

        DB # AA, # 00, # AA, # 00

        DB # AA, # 44, # AA, # 00

        DB # AA, # 44, # AA, # 11

        DB # AA, # 55, # AA, # 55

        DB # AA, # DD, # AA, # 77

        DB # AA, # 77, # AA, # FF

        DB # AA, # FF, # AA, # FF

        DB # AA, # FF, # BB, # FF

        DB # EE, # FF, # BB, # FF

        DB # EE, # FF, # FF, # FF

        DB # FF, # FF, # FF, # FF

; Descent to 4 lines on the screen down
DOW_DE4 LD A, 4

        ADD A, D

        LD D, A

        AND 7

        RET NZ

        LD A, E

        ADD A, 32

        LD E, A

        RET C

        LD A, D

        SUB 8

        LD D, A

        RET

;--------------------------- INITTAB LD DE, # 4000; create table

        LD HL, TABLADR; Address Screen

        LD B, 48; fast rasINITT1 LD (HL), D; couple addresses

        INC HL

        LD (HL), E

        INC HL

        CALL DOW_DE4

        DJNZ INITT1

        RET

;---------------------------; Procedure is created kidatel line
; Chunks of kidatelya four chunks
, (Those same four chunks are thrown in
; Screen procedure PUTLIN)

INITCH LD B, LEN

        LD HL, PUTLIN

        LD DE, ENDPL
INITC1 PUSH BC

        LD BC, ENDPL-PUTLIN

        LDIR; reproduce a piece of

        POP BC; PUTLIN to ENDPL

        DJNZ INITC1; LEN times

        LD A, # C9; a RET at the end

        LD (DE), A

        RET

;---------------------------
        ORG ($ -1) / 256 * 256 +256
TABLCH; ship animation

        INCB "ANIM"


        ORG ($ -1) / 256 * 256 +256
TABLADR DS 48 * 2; buffer under Table.

                    ; Address screen

;---------------------------; Everything here is quite simple:
; In HL - the image of the screen
; B - byte table
; Chunks (ie, B = # F0)
; DE - address on the screen

PUTLIN

        LD C, (HL); take in C, the code chunk

        INC HL; in BC, we address

                    ; Image chunk

        LD A, (BC); toss 1-byte

        LD (DE), A; chunk of the table

                    ; Screen

        INC D; dropping down

                    ; Screen

        INC B; go to the next
                    ; Shem byte

        LD A, (BC): LD (DE), A: INC D, B
; As 2-byte

        LD A, (BC): LD (DE), A: INC D, B
; As 3-byte

        LD A, (BC): LD (DE), A: INC E
; After the 4-th byte We turn right on
; Screen, grab the code and the next chunk
; Begin to climb.

        LD C, (HL)

        INC HL

        LD A, (BC): LD (DE), A: DEC D, B

        LD A, (BC): LD (DE), A: DEC D, B

        LD A, (BC): LD (DE), A: DEC D, B

        LD A, (BC): LD (DE), A

        INC E
ENDPL


 However, we considered the ideal, ie when
We have a single byte codes of two,
neighboring chunks. This can be achieved in
rare cases (animation, plasma), most often we
we have one code by one byte. In this
If kidatel slightly modified and
unfortunately, becomes significantly
Brake: (

PUT_LIN

; HL = BUFFER - the same buffer in which you
, Are forming an image before displaying on the
; Screen
; HL '= ADDR_SCREEN - address on the screen
; B = TAB [- table bytes are shifted by 4 bits
; Right
; D '= CHANKS [- byte chunks table


        LD C, (HL); take the code chunk

        LD A, (BC); Tab. shifts its

                  , 4 bits to the right

        INC L

        LD C, (HL); take the following code

                  ; Chunk

        OR C; get in one byte

                  ; Codes of two neighboring

                  ; Chunks

, Then everything on vysheopisanomu algorithm

        INC L

        EXX

        LD E, A


        LD A, (DE)

        LD (HL), A

        INC H

        INC D

        LD A, (DE)

        LD (HL), A

        INC H

        INC D

        LD A, (DE)

        LD (HL), A

        INC H

        INC D

        LD A, (DE)

        LD (HL), A

        INC L

        EXX


        LD C, (HL)

        LD A, (BC)

        INC L

        LD C, (HL)

        OR C

        INC L

        EXX

        LD E, A


        LD A, (DE)

        LD (HL), A

        DEC H

        DEC D

        LD A, (DE)

        LD (HL), A

        DEC H

        DEC D

        LD A, (DE)

        LD (HL), A

        DEC H

        DEC D

        LD A, (DE)

        LD (HL), A

        INC L

        EXX


  That's all. If anything is unclear, the questions
send to the address 2:4536 / 100.128 @ FidoNet to
Sergey Movchan.
__________________________________________







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:
Advertising - Advertising and announcements.
Activities - the Soviets first-year student: options for note-taking boring lectures.
Beech - pohozhdehiya shtiplitsa and one another in ppiklyuchehiya bopmaha.
Advertising - Advertisements and announcements ...
News - New Minsky Newspaper: UFO.

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