Spellcaster presents:


TTTTTTTTTT HH      HH EEEEEEEEEE    MM      MM    AAAA     GGGGGGGGG
    TT     HH      HH EE            MMM    MMM   AA  AA   GG
    TT     HH      HH EE            MM M  M MM  AA    AA  GG  
    TT     HHHHHHHHHH EEEEEE        MM  MM  MM  AAAAAAAA  GG   
    TT     HH      HH EE            MM      MM  AA    AA  GG    GGGG
    TT     HH      HH EE            MM      MM  AA    AA  GG      GG
    TT     HH      HH EEEEEEEEEE    MM      MM  AA    AA   GGGGGGGG

                                                        Issue 2
                                                        27-9-95



 Index

        1. Introduction
          1.1. About the magazine
          1.2. About the author
          1.3. Distribution
          1.4. Contribuitions
          1.5. Hellos and greets
        2. Conditions: Can you live without them ?
          2.1. What are they ?
          2.2. How can I use them ?
        3. The mistery of the lost ASCII
        4. Assembly and Pascal
          4.1. What is Assembly ?
          4.2. The BIOS
          4.3. Interrupts
          4.4. Segments and Offsets
        5. Graphics, part 1 : Mode 13h
          5.1. Introduction
          5.2. What's mode 13h ?
          5.3. How do I get into mode 13h ?
          5.4. Putting Down a Pixel
        6. Points of View
        7. The adventures of Spellcaster, part 2.


 Introduction

   About the magazine

    Welcome to the second issue of 'The Mag', the electronic magazine, brought
  to you by Spellcaster, alias Diogo de Andrade.
    You may be wondering why did I write this issue so close to the last one.
  The answear is simple: I just felt like it... I wanted to write, so, there
  you go.
    This issue has a new regular article. It is called 'Graphics' and it's about
  programming the PC's VGA board (in the 320x200x256 resolution).
    This magazine is dedicated to all the programmers and would-be programmers
  out there, and to those who wish to learn how to program anything, from demos
  to games, passing through utilities and all sort of thing your mind can think
  of.

    When you read this magazine, I'll assume some things. First, I assume you
  have Borland's Turbo Pascal, version 6 and upwards. I'll also think you have
  a 80386 (or 386 for short; a 486 would be even better), a load of patience
  and a sense of humor. This last is almost essencial, because I don't receive
  any money for doing this, so I must have fun doing it. I will also take for
  certain you have the 9th grade (or equivelent).

    As I stated above, this magazine will be made especially for those who don't
  know where to get information, or want it all in the same place, and to those
  who want to learn how to program, so I'll try to build knowledge, building up
  your skills issue by issue. If you sometimes fail to grasp some concept, don't
  despair; try to work it out.
    That's what I did... Almost everything I know was learnt from painfull
  experience. If you re-re-re-read the article, and still can't understand it,
  just drop a line, by mail, or just plain forget it. Most of the things I 
  try to teach here aren't linked to each other (unless I say so), so if you
  don't understand something, skip it and go back to it some weeks later. It
  should be clearer for you then. Likewise, if you see any terms or words you 
  don't understand, follow the same measures as before.

    Ok, as I'm earing the Net gurus and other god-like creatures talking
  already, I'm just going to explain why I use Pascal.
  For starters, Pascal is a very good language, ideal for the beginner, like 
  BASIC (yech!), but it's powerfull enough to make top-notch programms.
  Also, I'll will be using assembly language in later issues, and Pascal makes
  it so EASY to use. 
  Finally, if you don't like my choice of language, you can stop whining. The
  teory behind each article is very simple, and common with any of the main
  languages (C, C++, Assembly - Yes, that's true... BASIC isn't a decent
  language).

    Just one last thing... The final part of the magazine is a little story
  made up by my distorted mind. It's just a little humor I like to write, and
  it hasn't got nothing to do with programming (well, it has a little), but, 
  as I said before, I just like to write it.

   About the author

    Ok, so I'm a little egocentric, but tell me... If you had the trouble of 
  writing hundreds of lines, wouldn't you like someone to know you, even by 
  name ?

    My name is Diogo de Andrade, alias Spellcaster, and I'm the creator, 
  editor and writer of this magazine. 
    I live in a small town called Setbal, just near Lisbon, the capital of
  Portugal... If you don't know where it is, get an encyclopedia, and look for
  Europe. Then, look for Spain. Next to it, there's Portugal, and Setbal is in
  the middle.

    I'm 18 years old, and I just made it in to the university (if you do want
  to know, I'm in the Technical Institute of Lisbon, Portugal), so I'm not 
  a God-Like creature, with dozens of years of practice (I only program by 
  eight years now, and I started in a Spectrum, progressing later to an Amiga.
  I only program in the PC for a year or so), with a mega-computer (I own a 
  386SX, 16 Mhz), that wear glasses with lens that look like the bottom of a 
  bottle (I use glasses, but only sometimes), that has his head bigger than a 
  pumpkin (I have a normal sized head) and with an IQ of over 220 (mine is 
  actually something like 180). I can program in C, C++, Pascal, Assembly 
  and even BASIC (yech!).

    So, if I am a normal person, why do I spend time writing this ?
  Well, because I have the insane urge to write thousands of words every now
  and then, and while I'm at it, I may do something productive, like teaching
  someone. I may be young, but I know a lot about computers (how humble I am;
  I know, modesty isn't one of my qualities).

    Just one more thing, if you ever program anything, please send to me... I
  would love to see some work you got, maybe I even could learn something with
  it. Also, give me a greet in your program/game/demo... I love seeing my 
  name.

   Distribution

    I don't really know when can I do another issue, so, there isn't a fixed
  space of time between two issues. General rule, I will try to do one every two
  weeks, maybe more or maybe less.
    'The Mag' is available by the following means:

    - Snail Mail : My address is below, in the Contributions seccion... Just
                   send me a disk and tell me what issues you want, and I
                   will send you them...

    - E-Mail : If you E-mail me and ask me for some issues, I will Email you
               back with the relevant issues attached.

    - BBS's : I don't know for sure what BBS's have or will have my magazine,
              but I will try to post it in the Skyship BBS.
              If you have a BBS and you want to receive 'The Mag', contact me.

                 Skyship BBS numbers: (351)+01-3158088
                                      (351)+01-3151435

    By the end of this year (1995), I should have an Internet Page, and some
  more BBS's in my list, besides some ftp's.

   Contributions

    I as I stated before, I'm not a God... I do make mistakes, and I don't 
  have (always) the best way of doing things. So, if you think you've spotted
  an error, or you have thought of a better way of doing things, let me know.
  I'll be happy to receive anything, even if it is just mail saying 'Keep it 
  up'. As all human beings, I need incentive.

    Also, if you do like to write, please do... Send in articles, they will be
  welcome, and you will have the chance to see your names up in lights. 

    If anyone out there has a question or wants to see an article about 
  something in particular, feel free to write... All letters will be answered,
  provided you give me your address.

    I'm also trying to start a new demo/game/utility group, and I need all sort 
  of people, from coders (sometimes, one isn't enough), musicians (I can 
  compose, but I'm a bit limited), graphics artists (I can't draw nothing) and
  spreaders... I mean, by a spreader, someone who spreads things, like this mag.
  If you have a BBS and you want it to include this magazine, feel free to
  write me...

    You can also contact me personally, if study on the IST (if you don't
  know what the IST is, you don't study there). I'm the freshman with the 
  black hair and dark-brown eyes... Yes, the pretty one (there goes my modesty
  again). I recommend you to contact me personally, if you can, especially if
  you are a member of the opposite sex (I'm a man, for those of you who are 
  wondering).

    My adress is:
                 Praceta Carlos Manito Torres, n4/6C
                 2900 Setbal
                 Portugal

    Email: dgan@rnl.ist.utl.pt


   Hellos and greets

    I'll say hellos and thanks to all my friend, especially for those who put 
  up with my constant whining (you know who you are).
    Special greets go to Denthor from Asphyxia (for the excelent VGA trainers),
  Draeden from VLA (for assembly tutorials), Joaquim Elder Guerreiro, alias
  Dr.Shadow (Delta Team is still up), Alex "Darkfox" (thanks for letting me
  use your BBS), Joo Neves and Henrique Craveiro for sugestions, and all the
  demo groups out there.
    I also want to say hi to my idols (I know they don't read this, but...),
  Chris Roberts, Franois Lionet, Archer MacLean, everybody at ID Software and
  Apogee, Sierra On-Line, Lucas Arts and Team 17, for showing me what 
  programming is all about.



 Conditions: Can you live without them ?

    Answering the question, yes, you can live without them, but no, you can't
  program without them...

   What are they ?

    Conditions are one of the more important things in Pascal (in any language
  really!). To understand the logics behind conditions, you must understand
  first the concept of TRUE and FALSE, speaking in computer terms.
    The terms TRUE and FALSE in the computer function in the same as our true
  and false, with the diference that we know there is a middle term (the point
  of view). For the computer, there isn't middle term. All there is is TRUE or
  FALSE.

   How can use them ?

    Ok, this is the base for conditions. Let's supose you wanted to find out
  the biggest number of a group of two numbers.

      A:=10;                                 { Give value 10 to var A }
      B:=15;                                 { Give value 15 to var B }

      If A>B Then Write('A is biggest');     { This would compare the two }
                                             { numbers, and if A is larger }
                                             { than B, it would write the }
                                             { phrase 'A is biggest. }

    Do you see know why conditions are so usefull ?
    Did you understand them ?
    The sintax for the IF keyword is:

               IF condition THEN command

    This translates in IF the condition is TRUE, THEN execute command.
  The condition can be anything, as long as it gives out a TRUE or FALSE value.
  This is known as boolean algebra, algebra that only gives TRUE or FALSE
  result.
    Following this, here's a list of operations that give boolean results.

    Ŀ
     Operator   Desciption    Example                                   
    Ĵ
        =        Equal to     A=B : Returns TRUE if A equals B          
                                                                        
        <>     Not Equal to   A<>B : Returns TRUE if A is diferent to B 
                                                                        
        <       Less than     A<B : Returns TRUE if A is less than B    
                                                                        
        >      Greater than   A>B : Returns TRUE if A is greater than B 
                                                                        
        <=     Less than or   A<=B : Returns TRUE if A is less or equal 
                 Equal to            to B                               
                                                                        
        >=     Greater than   A>=B : returns TRUE is A is greater or    
                or Equal to          equal to B                         
    

    Notice that when you compare, you do not use the ':' after the variable
  name. Let's do a program to implement this, so that you understand it
  better...

  Program Test_6;                                    { Starts Test_6 }

  Var A,B:Longint;                                   { Defines vars A and B }

  Begin                                              { Starts main block }
       Write('Write number 1:');                     { Writes message }
       Readln(A);                                    { Get value of var A }
       Write('Write number 2:');                     { Writes another message }
       Readln(B);                                    { Get value of var B }
       If A=B then Writeln('The numbers are equal'); { Compares A and B. If }
                                                     { they are equal, then he }
                                                     { writes 'The numbers are }
                                                     { equal on the screen. }
       If A<B then Writeln('A is smaller than B');   { Compares A and B. If }
                                                     { A is less than B, it }
                                                     { writes on the screen }
                                                     { 'A is smaller than B' }
       If A>B then Writeln('A is bigger than B');    { Compares A and B. If }
                                                     { A is greater than B, it }
                                                     { writes on the screen: }
                                                     { 'A is bigger than B' }
       Readln;                                       { Waits for RETURN }
  End.                                               { Ends the program }

    Do you understand it now ?! this is quite easy, after you experiment with
  it. Note that you can compare more than just numbers... You can also compare
  strings... It's just the same thing. For example:

    'Spellcaster' > 'Diogo' would return TRUE, because 'S' has bigger ASCII
                            value than 'D' (More on ASCII in next article).

    'Spellcaster' > ' Saturday' would return TRUE, because they have the same
                                first letter, so Pascal compares the next one,
                                and 'a' is smaller than 'p'.

    You can also compare variables with fixed values, like this:

    A:=10;
    If A>5 Then Write('Ok');

    So, there's a lot of flexability.
    Remember in first issue, when I said that there were lots os diferent
  programing 'blocks', started with BEGIN and finished with END ?
  Well, conditions are one of those blocks. you can put more than one command
  in an IF sentence, you just have to precede it with BEGIN and end it with END.
  Let's see:

  ONECHAR:='A';
  .......
  .......
  If ONECHAR<'B' Then
  Begin
       ONECHAR:='B';
       Writeln(ONECHAR);
  End;
  .......
  .......

    Notice that the END in the IF sentence has a ';' after it, instead of a '.'.
  This is because the '.' is only used in the main block.

    Experiment at will... You will see how fun this is... Try to improve the
  program I gave last issue to let you choose what operation will be performed.
  Next issue, I'll give you that program, so that you can compare with your own.




 The mistery of the lost ASCII

    ASCII stands for American Standart Code for Information Interchange. It was
  created a long time ago as a convenctional character sistem.
    When you start your computer, it is loaded from it's internal sistem to the
  memory a series of simbols, that define the letters and numbers you see
  displayed on the screen. In the beginning, there were only 128 simbols, but
  soon they were extended, to create the ASCII-Extended code (which is the one
  we really use and that we refer as ASCII), that has 256 simbols.
    You probably don't understand what am I talking about, so I'll try to
  explain myself a little better.

    ASCII is an internal table, a place were there is a series of numbers, from
  0 to 255, and each of those numbers are associated with a letter, a number or
  a simbol. So, you have the ASCII table, where all simbols have a number and
  all numbers have a simbol.

    Whats the use, you may ask. There are many uses, but the main one (at least
  that I can think off now) is the comparision of strings.
    There are two functions for you to use in Pascal, to use ASCII directly;
  CHR and ORD.  Their sintaxes are:

      =CHR(A) -> Gives you the char with the ASCII code A.

      =ORD(A) -> Gives you the ASCII code of the character A.

    For a change, let's see an example:


    Program Test_7;

    Var A:Char;
        B:Byte;

    Begin
         A:='A';
         B:=Ord(A);
         Writeln('The ASCII code of ',A,' is ',B);
         B:=66;
         A:=Chr(B);
         Writeln('The char with ASCII code of ',B,' is ',A);
         Readln;
    End.

    I won't comment this program, so study it carefully. If you have any doubts,
  write to me and I'll try to answear them.



 Assembly and Pascal

    This issue is dedicated to those who already know how to program, so, if you
  are a begginner, I recomend you don't read this. Read some more issues of
  'The Mag' and then return to this one.

   What is Assembly ?

    As I said in the last issue, Pascal (and any programming language) is a
  'translator', that transforms the commands that look a bit like standart
  English to binary codes that the machine can understand. Well, Pascal is a
  high-level language, because it has lots of resources and has lots of
  flexability. We just have to worry about using the commands that are available
  to us. Assembly is also a programming language, but a low-level one. You have
  very little commands to work with, because it uses the commands available to
  the machine, and you have to build new commands from them. It's very harder
  working with Assembly, and it requires a good knowledge of what's happening
  inside the computer, and how does he work.
    The main advantage of Asssembly is the speed and size advantage. Any
  program made in Assembly will be faster and shorter than a Pascal or any
  other language made program.
    By luck, Pascal can work with Assembly, by using something called a inline
  assembler. This means that you can do a Pascal program with assembly in the
  middle, for the sake of speed or just because assembly can do things Pascal
  can't.
    To use Assembly in Pascal, you just have to write the word Asm before the
  assembler block, and then write End in the end of that block. Example:

  Writeln('Anything...');
  ......
  ......
  Asm
     Mov Ax,10h
     Mov Bx,15h
     Shr Ax
  End;
  ......
  ......

    The commands that are between the Asm and the End keywords are Assembly
  commands. Don't forget that almost everything that is in Assembly is in
  hexadecimal.

    I'm teaching this, because I will have to use assembler in the next article,
  and I didn't wanted to leave in the dark. I only have to teach some more
  things about the machine and we can start learning how to draw graphics.

   The BIOS

    The BIOS is the Basic Input/Output Sistem. It's something that resides
  somewhere inside your computer, and that handles the basic input/output (I/O)
  of the computer. It handles the keyboard, the mouse, the screen and all sorts
  of things. Inside of it, there are some commands, called the...

   Interrupts

    The interrupts are a series of little programs, built in the BIOS. Programs
  that handle all sorts of things. They are very important to make a lot of
  things. All of them can be programmed in Assembly, and you could even forget
  the BIOS, but there are some things that aren't worth the trouble of coding.
    The interrupts are called like this, because when they are executed, they
  stop anything that is going on the processor. Some of the interrupts must be
  called by us, some of them are called by other interrupts, and another ones
  are called a fixed number of times a second. For example, interrupt 8, that
  handles the internal clock is called 18 times a second.
    There are all sorts of ways to call a interrupt from Pascal, but if you have
  Pascal 6 or upwards, you can use the simpler way:

  Asm
     Int xx ; where xx is the number of the interrupt.
  End;

    Some of the interrupts require parameters to work, and that usually envolves
  calling the interrupt with the register AX with the number of the
  sub-function. Don't take notice of this. I'll explain this in some issue.

   Segments and Offsets

    One of the more annoying thing about PC's is that it's memory is divided in
  little 64Kb segments. So, everytime you awnt to access a part of the memory,
  you got to specify the segment and the offset.
    Think of it like this: the segment is the page number of the data, while the
  offset is how far into the page is the data you want to access. In standart
  notation this is something like:

                Segment:Offset

    Examples:

                A000:0000   -> By luck, this adresses the upper left corner
                               of the VGA screen (of course in hexadecimal)

                B000:0000   -> This adresses the upper left corner of the
                               EGA screen

                54AB:132A   -> This points to the $132A element of page $54AB


    Don't forget... This is a simplistic view of Segments and Offsets, so don't
  take what I say here for granted.




 Graphics, part I : Mode 13h

    This series of articles is aimmed to the more advanced users, so, if you're
  a begginer, read some more issues of 'The Mag' and then come back to this
  one.

   Introduction

    If you do programming in Pascal or in C for sometime now, you'll probably
  now how to make graphics, using commands like Initgraph. But, you'll also
  should notice this:

  1. You have the need for BGI drivers for any resolution you want.
  2. They are so slow.
  3. They aren't flexible enough.
  4. You don't know what's going on.

    So, if you wanted to do, say, a game, you would have to get a BGI driver for
  MCGA graphics (because that's what most games today use), and you would soon
  find out that a game would be unpraticable, because the graphics would be too
  slow. That's the same reason you couldn't do a demo.

    I hear you cry now: 'But what's the other way to make graphics ?'.
    My answear is very simple: Assembly language, the BIOS and a lot o clever
  thinking.

   What's mode 13h ?

    Mode 13h (this is mode 13 hexadecimal, that is the same as mode 19) is a
  graphics mode that gives you a resolution of 320 pixels wide for 200 pixels
  high, with 256 colors. It's the highest resolution the BIOS can directly
  initialize, without need to tweak the VGA registers (more on that later), with
  a VGA card.

   How do I get into mode 13h ?

    To initialize mode 13h, you just have to execute interrupt 10h,
  sub-function 0, with the parameter 13h. You do it like this:

  Procedure Initgraph; Assembler;    { This creates the assembler procedure }
  Asm                                { This starts the assembler (asm) code }
     mov ah,0                        { This loads the subfunction number }
     mov al,13h                      { This loads the graphic mode }
     int 10h                         { This executes the interrupt }
  End;                               { This ends the procedure }

    To exit from this mode, you do the same, but change the 13h to 03h:

  Procedure Closegraph; Assembler;
  Asm
     mov ah,0
     mov al,03h
     int 10h
  End;

    Ok, you know how to get into and out of mode 13h. Now, let's do something...

   Putting down a pixel

    There are an infinite way of doing this, but I'll teach you two ways. The
  first is using the BIOS. To plot a pixel using the BIOS, you use interrupt
  10h (if you didn't understood yet, interrupt 10h is the video interrupt),
  sub-function 0Ch. You do it like this:

  Procedure Putpixel(x,y:word;col:byte); Assembler;
  Asm
     mov ah,0Ch         { Sets the number of the subfunction }
     mov al,[col]       { Sets the color }
     mov cx,[x]         { Sets the x coordinate }
     mov dx,[y]         { Sets the y coordinate }
     mov bx,[1]         { See note below }
     int 10h            { Executes the interrupt - puts the pixel down }
  End;

  Note: the 'mov bx,[1]' instruction is there because, in other video modes,
        like EGA, there is more than one display page. The number inside
        brackets is the display page number. In mode 13h, there's only one.

    This works fine, but it has a big defect: it's very, very slow. Why ?
  Because it uses interrupts, and interrupts are slow. They are ok for getting
  us into mode 13h, but they are useless for pixel putting.
    This brings us to the other method of putting down a pixel. This is where
  the cleaver thinking comes into work.

    First thing you must know is that the video's segment adress is $A000. This
  is very important and you must know this to do something in mode 13h.
    One of the caracteristics of mode 13h is that the video memory is linear.
  That is,the first pixel (the upper left corner one) is at address (A000:0000),
  the second is at (A000:0001), and so on. When you get to the last one of the
  first line, the one that is at (319,0) and has the address (A000:013F), it
  changes line, so pixel (0,1) has the address (A000:0140). I know this is a
  little hard at first, but it will become clear with the following diagram:

    (0,0)Ŀ(319,0)
         00000001000200030004........013B013C013D013E013F
         Ĵ
         01400141014201430144............................
         Ĵ
         0280............................................
         Ĵ
         ................................................
         Ĵ
         F8C0F8C1F8C2F8C3F8C4........F9FBF9FCF9FDF9FEF9FF
  (0,199)(319,199)

    Do you understand it now what I mean by linear adressing. This is a little
  harder to program, but is very easy just the same. To access directly the
  memory, you just have to use the MEM array. The MEM array is a Pascal
  generated array in which all elements have a correspondency in the memory.
  You can write to it as well as you write to. The sintax is as follows:

                MEM[segment:offset]

    So, you just have to change the segment to $A000 and find out the offset,
  based in the x and y coordinates. Remember one thing, the screen has 320
  pixels wide and 200 pixels high, so, the formula to find out the offset is
  like this:

            Offset:=(Y*320)+X;

    For every time we go down a line, we have to increment 320 the offset,
  because we are using linear addressing. So, we would get a procedure like
  this:

  Procedure Putpixel(x,y:word;col:byte);
  Begin
       Mem[$A000:(y*320)+x]:=col;
  End;

    And voil... You have a pixel in the screen. Altough this procedure isn't
  in Assembly, it's much faster than the one that is, just because it uses
  direct access to the memory. To see the diference, type in the following
  program:

  Program Test_7;

  Const VGA=$A000;                   { I prefer defining this constant, }
                                     { instead of writing $A000 milions }
                                     { of times... }
  Var A,B:Word;

  Procedure Initgraph; Assembler;    { This creates the assembler procedure }
  Asm                                { This starts the assembler (asm) code }
     mov ah,0                        { This loads the subfunction number }
     mov al,13h                      { This loads the graphic mode }
     int 10h                         { This executes the interrupt }
  End;                               { This ends the procedure }

  Procedure Closegraph; Assembler;   { This creates the assembler procedure }
  Asm                                { This starts the assembler (asm) code }
     mov ah,0                        { This loads the subfunction number }
     mov al,03h                      { This loads the graphic mode }
     int 10h                         { This executes the interrupt }
  End;                               { This ends the procedure }

  Procedure BIOSPutpixel(x,y:word;col:byte); Assembler;
  Asm
     mov ah,0Ch         { Sets the number of the subfunction }
     mov al,[col]       { Sets the color }
     mov cx,[x]         { Sets the x coordinate }
     mov dx,[y]         { Sets the y coordinate }
     mov bx,[1]         { See note below }
     int 10h            { Executes the interrupt - puts the pixel down }
  End;

  Procedure MEMPutpixel(x,y:word;col:byte);
  Begin
       Mem[$A000:(y*320)+x]:=col;       { Puts down a pixel using direct }
  End;                                  { memory access. }

  Procedure Cls(col:byte);                     { Clears the screen with }
  Begin                                        { specified color. }
       Fillchar(Mem[$A000:0000],64000,col);    { See note below. }
  End;

  Begin
       Writeln('This program tests the two putpixels.');
       Writeln;
       Writeln('First it tests the BIOS Put Pixel, then it');
       Writeln('tests the MEM Put Pixel.');
       Writeln;
       Writeln('It was writen by Spellcaster');
       Writeln('Press Return to start');
       Readln;
       Initgraph;
       For A:=0 to 199 Do
           For B:=0 to 319 Do
               BIOSPutpixel(B,A,Random(255));
       Readln;
       Cls(0);
       For A:=0 to 199 Do
           For B:=0 to 319 Do
               MEMPutpixel(B,A,Random(255));
       Readln;
       Closegraph;
       Writeln('That''s all folks...');
       Readln;
  End.

    If you run this program, you will notice the diference in speed between the
  two putpixels. The MEM putpixel is more than two times faster !

    If you look at the program, you will notice a procedure I didn't talked
  about: the CLS procedure. It's very easy, this one. It just puts 64000 pixels
  of the specified color, starting in address ($A000:0000). If you think for
  a minute, you'll come to the conclusion that 320*200=64000, that is the number
  of pixels you write. The only thing weird about that procedure is the Fillchar
  keyword. It's sintax is:

                Fillchar(location,nbytes, value)

    It fill a certain part of the memory, starting in the defined location,
  with the value specified. It changes the nbytes from the location forward.
  As the memory in mode 13h is linear, we here have a very quick way to clear
  the screen.

    I think what I explained here can keep you going for some time. Don't stop
  at simple dots... try to do something, like lines and circles. It's very
  easy, if you try.

    In the next issue, in the Graphics feature, I will talk about the pallete,
  one of the more fun things in graphics.

 Points of view

    In this issues points of view, I will have a moan.

    Why is information so hard to get ?
    Even if you have a modem and access to the Internet, you will find it almost
  impossible to find something in particular, making the ride in the Net just
  a chance of luck. If you don't have a modem, you just can wait one of three
  things: Friends that know something they can teach you, friends that have the
  information you require, and the purchase of books. In the last case, good
  books are so hard to find (at least here), and they are so expensive. Some
  of them (like Peter Norton's Guides) cost near 15.000$00 (something like
  $100 US or 60 UK). People like me don't have that kind of money to spend
  on some book that only says a couple of things of interest. Even the books
  by Peter Norton are full of things that doesn't matter for the ordinary
  programmer.
    That is one of the reasons that pushed me in making 'The Mag'. The lack of
  informations. I have lost more than three years gathering the knowledge I
  have (I would know more if I've always been a PC person, but I was for many
  years a Amiga person), and I now give it free of charge to you (but if you
  want to pay me, go ahead. You'll get my undying thanks).
    So, until someone decides to write a really good book about programming, at
  an affordable price, I'll make this magazine, and make it grow. I hope that
  in one year, I'll have some contributors to write some of the articles, and
  that you learn enough to give me the possibility to write more advanced stuff,
  like 3D graphics, texture mapping and other of those new flashy techniques.
  I really hope to get some contributors, because I have limited knowledge.
  I can teach you many things, but at the rate I'm going, in one year you'll
  know as much as me.
    So, people, goodbye... Stay well... Until the next issue. Experiment, try
  out, and do some other stuff do.



 The adventures of Spellcaster, the rebel programmer of the year 2018.

  Episode 2 - Cry for freddom

    I hear a scream in the far. I don't mind... I was getting used to it. It
  must have been some poor bastard who didn't survived this isolation from PCs,
  and cracked up...
    I was decided not to let that happen to me... I would survive enough to get
  out of here and try to push the system down. But I was a little short of
  ideas, until I remembered a small 'joke' I puled in High-Scholl, just two
  years ago. I've had, back then, gotten my first PC, and I decided to program
  a virus, just to play. So I did, but then, the virus ran out of control and
  erased almost my entire hard-drive. I managed, with some effort, to isolate
  it in a disk and I put it away. Some days after, it was the end of my 10th
  grade. I was in front of my Programming Practices teacher, who looked at me
  and said that I was going to get a lower grade than I expected. I was furious,
  because I deserved that grade, so I ploted a sinister revenge. Late at night,
  I broke in the scholl's computer center, carrying only a disk. I inserted
  the disk, and a prompt appeared on the screen:
  'Do you really want to release the Final Judgement Virus (Y/N) ?'.
  I pressed the 'y' key, and in the seconds, the whole network was infected.
  I returned home, laughing to myself, and went to bed. The day after, I went
  to scholl, only to find it in chaos and anarchy. Everything had broken down,
  from the grading database to the students data. I smilled with a grin...
    Remembering this, I started to think of my escape. The only problem was that
  we only had access to Atari 520ST computers, something from the previous
  century, an old machine that didn't work properly even when it was lauched.
  But, winning the fight against my sense of filth and disgust, I grabed a
  book and started to read. It was called:'How to program the Atari'.


                                         See you in the next issue
                                        Diogo "SpellCaster" Andrade
