Deja Vu #08
31 мая 1999

CODING - Conversion of graphics into text format ASCII.

<b>CODING</b> - Conversion of graphics into text format ASCII.
AY-Track: LITTLE WIZARD, MUZIC 2
__________________________________________


(C) 02.1999 DaniEl / PGC / BDA
__________________________________________


 Conversion of graphics into text format ASCII.
 ---------------------------------------


   Good day, dear readers! What
will be discussed, you guessed it!
Yes, the conversion of graphics to text.

   Let's try skonvertit, for example, a picture distinguished 
ColorBok'a "kristina", here it:



     k

     r

     i

     s

     +

     +

     l

     l

     l

     l

     l

     l

     l

     l

     l

     l

     l

     l

     l

     l


   Immediately estimate the graphic symbols
that will be used for conversion into
increasing order of brightness:


              "- Code 32

              "" - Code 176

              "" - Code 177

              "" - Code 178

              "" - Code 219



   For more reliable results will
envelope in the 64-character format. It turns out, on the one 
matrix size of 8 * 8 pix have two characters. 

   Conversion algorithm is as follows: count the number of 
pixels for each matrix size of 4 * 8 and inserts in a table of 
24 rows multiplied by 64 characters. The range of values 
​​obtained from 0 to 32. On the basis of this table creates a 
text file. Corresponds to the intensity codes

ASCII:


      intensity ASCII



         0 - 0 32

         1 - 10,176

        11 - 20,177

        21 - 31,178

        32 - 32,219



   It's not all for the universality of the text file should be 
every 64 symbol to insert the marker end of the line - two

Code # 0D, # 0A. After this, ready to upload text and paste to 
your heart desires! 

   If all is clear, then go to the listing, if it is not clear, 
it still pass: 

; (C) DANIEL, 02.1999
; GRAY SCALE GRAPHICS (6144 OR 6912) TO ASCII CONVERTOR V1.0 
BETA 



        ORG # 8000



        DI

        LD HL, # C000

        LD DE, # C001

        LD BC, # 5FF

        LD (HL), L

        LDIR



        LD IX, # C000; buffer intensities

        LD HL, # 4000; "ekranka"

        LD B, 24; row count

M1 PUSH BC

        PUSH HL



        LD B, 32
M5 PUSH BC

        PUSH HL



        LD B, 8
M4 PUSH BC



        LD B, 4; older tetrad

        LD C, (HL)
M2 RL C

        CALL C, INC1; calculate the intensity of the left halves

        DJNZ M2; familiarity


        LD B, 4; younger tetrad
M3 RL C

        CALL C, INC2; calculate the intensity of the right 
halves 

        DJNZ M3; familiarity


        INC H

        POP BC

        DJNZ M4; cycle for the familiarity


        INC IX

        INC IX

        POP HL

        INC L

        POP BC

        DJNZ M5; cycle for the 32-familiarity


        POP HL

        LD B, 8
M6 CALL DOWN_HL

        DJNZ M6; the transition to the next line

        POP BC

        DJNZ M1; cycle for all rows


; Actually start conversion


        LD BC, # 600

        LD HL, # C000
M7 LD A, (HL)

        OR A

        JR Z, S20

        CP 1932

        JR Z, SDB

        CP 1911

        JR C, SB0

        CP 1921

        JR C, SB1

        LD (HL), # B2
M8 INC HL

        DEC BC

        LD A, B

        OR C

        JR NZ, M7



, The introduction of marker line endings


        LD DE, # D000

        LD HL, # C000

        LD B, 24
M9 PUSH BC

        LD BC, 64

        LDIR

        LD A, # 0D

        LD (DE), A

        INC DE

        LD A, # 0A

        LD (DE), A

        INC DE

        POP BC

        DJNZ M9

        EI

        RET


S20 LD (HL), # 20

        JR M8
SDB LD (HL), # DB

        JR M8
SB0 LD (HL), # B0

        JR M8
SB1 LD (HL), # B1

        JR M8


INC1 INC (IX +0)

        RET


INC2 INC (IX +1)

        RET


DOWN_HL INC H

        LD A, H

        AND 7

        RET NZ

        LD A, L

        ADD A, 32

        LD L, A

        RET C

        LD A, H

        SUB 8

        LD H, A

        RET



   Instructions for use: Georgia file
in "ekranku, call the procedure, save
result from the address # D000, length of 1584 bytes.

   If you wish, try to try to use for the conversion of a wider 
set of characters that can analyze the file attributes, since 
in this version of his result does not depend, we can add 
protsedurku, which will kill all spaces facing the end of the 
marker line is slightly reduce the file size.


   So go ahead, the results of your upgrades we are happy to 
place in the next issue of Deja VU. Good luck to you.


   The result of the picture "kristina" in
text:



   Even after writing konvertilki me
were two such converters. ASCII Convertor v2.71 by Air / 
EdelweisS and converter by Jerry / AF. On the quality of the 
conversion, they roughly the same, but somehow the result of 
the first converter is preserved in some incomprehensible 
format. The interface converter from Jerry / AF, of course, the 
better, but the converter by Air / EdelweisS has many settings. 
The result of the converter by Jerry / AF is stored in a 
standard format ASCII (as it should), but without markers of 
the end of lines, here's an example: 



                  , _. "_

               , D ", <__ u,

             _ / R, f ~ r _lr 1, l r _ E_

             f, _% / D $ J u h r

            l № TF, '! $ B r

           b /! D _Y her u # - _ $

          ¯ l D g_'') A s

           , R ¯ t t 6 r

          r rF № f ¢ ¢ $ F

             r r ¢ 'u t

          U | r, ¢ ¢

               ] M = ¢ D

               $ _ + + _ + ¢ +

            J D) __ № ¢ ¢ F /

             P_ C 't

               * _ # "'

                  '



   Conversion rather slow, but qualitative. Apparently it uses 
the entire character set! 

   Yet there is such a fancy word
editor of the Modern Word, modified Eternity Industry, which 
has a plugin, allowing convertible screens, but it works only 
in the registered version, so anyone can buy the editor of

Authors and envelopes, so to speak, on the spot. "


           Thank you for your attention.





Other articles:

Aperativchik - On the control of the shell DEJA VU

Aperativchik - Number came late in the month.

Aperativchik - Freebies will be no more.

Topic - Provision # 2. Perspective.

Topic - On working with electronic drive in the IS-Dos.

Topic - A new crossroads - some of the complexities of the game The Castle.

Topic - the printer and the ZX-Spectrum (command system printer family Epson).

drop of solder - Ode to watch.

drop of solder - Scanner v1.3.

drop of solder - Disk protector v1.4 (scheme).

SOFTWARE - Overview of new products demos: Iris UltraDemo, Lazarus Trackmo, Russian Fields of Experiments, Pressure Trackmo.

SOFTWARE - Overview of new products games: White Eagle, Leprekon, Kozel, Puzzle (prerelease of Flash), Space, Translate Worlds, Devil-s Curse, Choppers: death match, Twilight: The Land of Shadows, Falen Angel, 12 Secret Book, The Cezar, Chainick horror in Flat.

SOFTWARE - Review sistemok: ASCII Convertor v2.71, Global Commander v1.31, BA v1.0, X-Copy.

SOFTWARE - Men like gods: the script for the game Elite III

SOFTWARE - The work of the program to print images XL-graph.

CODING - The Optimization - Building a table repetition of bytes.

CODING - Universal Player - Pro Tracker v3.31.

CODING - an undocumented feature of the processor Z80.

CODING - Conversion of graphics into text format ASCII.

CODING - How to create uncopyable whereas sector.

CODING - BUGS in Plaeyer-e Pro Tracker 3.x

ANOTHER WORLD - CPU Pentium III.

ANOTHER WORLD - At the crossroads of three worlds.

ANOTHER WORLD - News from the world of Amiga.

ANOTHER WORLD - My Choice - PC?.

Hall of Fame - What do we think about the scene.

Hall of Fame - Everyone on party!

Hall of Fame - On CD-ROM project from the city of Kemerovo.

Seven and 1 / 2 - April Fools' Day.

Seven and 1 / 2 - Purposely not think: seven stories from the seller to ZX software.

Seven and 1 / 2 - Anecdotes.

attempt at writing - Amiga rulez or suxx?

Advertising - Advertisements and announcements ...


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

Similar articles:
Iron - decoder for cable TV.
INTRO - Create K. Sinclair ZX-2000 computers.
From the world of bat - large analytical writing to the continuation of discussions begun in the letter hakkerskoy of "Stars of Keledan" (about hackers, programmers, users and many others ...).

В этот день...   5 May