
        __  _                        __ _                           _  __
  ______\ \_\\_______________________\///__________________________//_/ /______
  \___\                                                                   /___/
   | .__                                 __                                  |
   | |                   ___  __________/  |________                         |
   |                     \  \/  / ____/\   __\_  __ \                        |
   ;                      >    < <_|  | |  |  |  | \/                        ;
   :                     /__/\_ \__   | |__|  |__|                           :
   .                           \/  |__|                                      .
   .                                                                         .
   :           H/Q Another Droid BBS - andr01d.zapto.org:9999                :
   ;                                                                         ;
   + --- --  -   .     -        ---    ---    ---        -     .    - -- --- +
   :                                                                         :
   |                           tribute to gutter                             |
   :                                                                         :
   ` --- --  -   .     -        ---    ---    ---        -     .    - -- --- '

   Didn't know about gutter, not at the time it was been released. I 
   learned about it, long time after. Many people like that emag and i am 
   one of them. One thing i really liked, it was the thing that the 
   authors of the mag, released the source code to the public, so 
   everyone can use it or take ideas from it. So when i decided to make 
   NULL a DOS emag, i grabbed a copy of that code to see what others did 
   and how should or could, do it my self.
   
   The thing with gutter is that it has a simple enough code. The most 
   difficult part of it, perhaps its the savefile format and how its 
   being used to read the articles. Anything else is straightforward even 
   for beginners.
   
   So how this file is created, used, what are the benefits from it and 
   what are the disadvantages. First of all, i have to admit that is a 
   clever design. Inside the file are the files of the articles and 
   ansis, in binary format.
   
   Binary format is used in TheDraw and AcidDraw. Its a specific format. 
   Each "line" is 160 bytes long. The first byte is a character, the 
   second is the color attribute of this character. The third byte is the 
   second character, fourth byte the color for the second character etc. 
   So it has a format like this: CACACACACACACA... where C is a character 
   and A the color attribute. If we have an ansi image 25 lines long, the 
   size of it, in this binary format will be 25 * 160 = 4000bytes.
   
   But why use this format? Because in DOS there is a video memory 
   address, which keeps the data of the text displayed in the screen, in 
   exactly the same format. So, if you copy a binary ansi file, into that 
   location, it will look exactly as in an ANSI editor, with colors. So 
   you don't have to do any ansi parsing, and translate the escape 
   sequences. They used TheDraw/AciDDraw to "translate" the file once. 
   After that, the file can be copied, directly to the video memory... 
   and you have graphics!
   
   So, all files for gutter, are saved in a big, huge file in this 
   format. But to know where is each file and keep some info, like the 
   title/author a header is needed. A header is something like an 
   index/catalog, that keeps record of where each file is, the size of 
   it, tile, author etc. To access an article saved in the data file, we 
   have to read the header first and with the info obtained, then someone 
   could access the article data.
   
   Because of DOS and Turbo Pascal limitations, the article or an ansi 
   image, couldb't be longer than 406 lines. Why? because...
   406 lines * 160 bytes/line = 64960bytes. And in Pascal you could only 
   access 65K at once. I didn't remember that, but because one article of 
   mine was big enough, i noticed that weird things happened. The gutter 
   code, was reading the whole article into memory in one step, so it 
   couldn't be more than 65K. To bypass that, i had to access the 
   articles from the disk and not from the memory. Instead of loading the 
   article text into a memory chunk, i just read it from within the data 
   file, every time the user accesses it, by pressing up/down/pgup/pgdn 
   keys. 
   
   Back then, making so many reads (every time a key was pressed) it was 
   very slow, cause the file was read from a floppy disk or a very slow 
   hard disk. Now days, its very fast and also, other techiques like 
   caching are used. So its not big deal to access the file every time. 
   Its the only easy alternative to read big article files, without using 
   XMS memory, which has other disadvantages and it was very time 
   consuming for me to read and learn again, knowledge of the past ;)
   
   To make the engine even cooler i wanted to use screen FXs and also 
   different fonts. The screen fxs are just code and its an easy process, 
   if you get the habit of how the video memory in DOS works. But saving 
   the fonts in the data file was a tricky thing, cause i wanted to leave 
   the "gutter article system" as it was. For both systems (font & 
   article) to work together, i thought to implement the font system, at 
   the end of the file in a backward way.
   
   I made some alterations to the tool which is responsible for "compiling"
   the articles. After completed the article compilation and it stores 
   each font file at the end of the data file. After storing all font 
   files, it writes a header, to know the location of each font file. Now 
   the font engine, reads the font header from the end of the file and by 
   knowing where each font file is, we can access it... and all that in 
   one data file, with out changing the "gutter engine". Also did some 
   small changes here and there, but not anything too big. The two big 
   changes are the font system and making the "article reader" to handle 
   files larger than 65kb.
   
   Perhaps you will be wondering, why the fuck this article is here and 
   not in the tutors section... (if you weren't, now you are :p ). Well, 
   because i wanted to show you, that open source code can be revived, 
   re-used, make it better, read it, think about it, process it and more. 
   If the authors of Gutter, didn't made the source code available, 
   probably i will had to "re-invent the wheel" and re-wrote the same 
   thing, without knowing about it. This piece of code is a part of a 
   unique history to some of us and by being able to "read it in depth" 
   for me is like a trip in the past. To see how things worked under DOS, 
   what the limitations were and how far we have gone, all this time. 
   This gives an appreciation on what we had and what we have now. Kids 
   today, have smartphones and console games with CPUs that we couldn't 
   even dream about it.. and thus present coders/programmers became 
   sloppy.
   
   I am sure that Gutter creators, wouldn't imagine that after 10-20 
   years from that time, some "geek" will find their code, and use it to 
   make an emag and even have the will to evolve it, add stuff and make 
   it even better. And that's the magic of making your code open to 
   others... no licenses and shit like that. 
   
   Also i wanted to show you, that DOS is a cool way to write programs 
   that someone can run everywhere, through a DOS emulator. Specially for 
   us the "text-mode enthusiasts", using text mode apps with full ansi 
   graphics/colors, even in a smartphone is coooooolllll!!!!! :) 
   
   So, this article is not a tribute only to those who made Gutter 
   possible, but to all those who make open source code. Source code is a 
   form of writing, so its also a piece of our past, not just as a scene, 
   but as a species. Source code is a sign of our intelligence... or even 
   stupidity... it all depends on how Skynet will evolve/appear... 
   hahahahaha :)
   

   + --- --  -   .     -        ---    ---    ---        -     .    - -- --- '
         _____         _   _              ____          _   _ 
        |  _  |___ ___| |_| |_ ___ ___   |    \ ___ ___|_|_| |        8888
        |     |   | . |  _|   | -_|  _|  |  |  |  _| . | | . |     8 888888 8
        |__|__|_|_|___|_| |_|_|___|_|    |____/|_| |___|_|___|     8888888888
                                                                   8888888888
                DoNt Be aNoTHeR DrOiD fOR tHe SySteM               88 8888 88
                                                                   8888888888
 /: HaM RaDiO   /: ANSi ARt!     /: MySTiC MoDS   /: DooRS         '88||||88'
 /: NeWS        /: WeATheR       /: FiLEs         /: SPooKNet       ''8888"'
 /: GaMeS       /: TeXtFiLeS     /: PrEPardNeSS   /: FsxNet            88
 /: TuTors      /: bOOkS/PdFs    /: SuRVaViLiSM   /: ArakNet    8 8 88888888888
                                                              888 8888][][][888
   TeLNeT : andr01d.zapto.org:9999 [UTC 11:00 - 20:00]          8 888888##88888
   SySoP  : xqtr                   eMAiL: xqtr@gmx.com          8 8888.####.888
   DoNaTe : https://paypal.me/xqtr                              8 8888##88##888

