Deja Vu #08
31 мая 1999 |
|
CODING - 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:
Similar articles:
В этот день... 23 November