______/\___________________________      __  ________________ ___  /\_______
\____   \  ________ _   _ ______   \    /  \|  \  ________   |   \/  ______/
/   |    \  _)   \   \_/   \   |    \  /    \   \  _)   \    |    \______  \
/    |     \       \   |     \  |     \/          \       \  /~\    \    /   \
\_____     /_______/___|     /________/\____\_____/_______/_________/________/
===\_____/============|____/========================================[+tZ^]==

                             DemoNews Issue #81
                    January 29, 1995 - February 4, 1995

                                ------------

 DemoNews is a weekly publication for the demo scene. It is produced at the
  Internet FTP site  ftp.eng.ufl.edu (HORNET).  This newsletter focuses on
 many aspects of demos and demo making. Everyone is welcomed to contribute
                   articles, rumors, and advertisements.

   Information about HORNET and DemoNews can be found under /demos/README

Start.of.DemoNews.081,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

SIZE:  52,846  SUBSCRIBERS:   Last week: 1220   This week: 1241   Change: +21

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

            SECTIONS          ARTICLES
            ----------------  -----------------------------------
            General           HORNET has been busy!
            New Uploads       Files recieved at HORNET
            NAID              Survival Guide
            Editorial         General Protection Relationships
            Code              Ctrl-Alt-Delete, Now Its a Game!
                              Assembly Part 3 (It ain't no party)
                              BSP Trees
            Back Issues       How to Get 'em, Descriptions
            Closing Comments  Quote for the Week, etc.

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<General>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

_____HORNET has been busy!

 Here are just a few things I would like to make the readers of DemoNews
 aware of:

 -ANSI:  The ANSI is back on HORNET!  After more flames than I could count
 (even with my socks off), I have decided to have an area on HORNET where
 the "packs" will be stored.  Syntax Error (organizer of iCE) is now
 HORNET's main coorespondent in this field, and he will be maintaining the
 files in this area.  However, there will not be an /incoming/ansi
 directory, only a /demos/ansi. Most of the previous problems stemmed from
 misuse of the /incoming/ansi directory.  Syntax Error will keep up to 10
 megs of the most current and wanted packs on HORNET.  He will be
 personally responsible for keeping this directory updated.  Also, any
 ANSI-related mail will be forwarded to him.  You can reach Syntax Error at
 [email protected].

 -MC3PLAY:  MikMak, Rao, Stony, and Air Richter are currently working on a
 Music Contest ]I[ player.  This will be used by the judges and contestants
 alike for playing MC3 entries.  Remember, this contest will be officially
 announced at NAID on April 15, 1995.

 -DNDP:  DemoNews Plus for DOS.  Ior, Psibelius, and Zoltar are currently
 working on a DOS-based version of DemoNews.  More than a plain vanilla-
 ascii reader, this is a full-fledged diskmag!  It will include graphics,
 music, additional articles from the DemoNews staff, and best of all, will
 be released on a MONTHLY basis.  Stay tuned for more details.

 -DN/HTML:  Jeff (White Noise) / HORNET deserves a lot of appreciation.
 In the past couple of weeks, he has made enormous strides in making the
 World Wide Web version of DemoNews come to life.  As the entire DemoWorld
 project becomes more concrete, you can expect quite a bit of coverage of
 it in DemoNews.

 -SLACKING:  I have been very slow in getting two interviews done.  The
 first is with Stone/Dust, and the second is with Gore/FC.  I finally got
 the questions out to Stone, but the Gore interview still has yet to take
 shape.  My apologies to these two individuals as well as the readers of
 DemoNews for the delay.

 -NEW FACES:  Two new individuals have joined the staff of HORNET as
 columnists.  They are Tom Verbeure and GraveDigger.  I met Tom through
 Jason Nunn (dee-cug, another DN columnist and friend).  Tom is an expert
 in the nuiances of hard core Assembler.  GraveDigger is another new
 addition.  Recently he did an incredible review of the Egg music for
 DemoNews, and this week he has done a "Survival Guide for NAID".  I am
 very pleased to have both of these gentlemen furthering the HORNET mission.

 -LISTSERVER:  There are two people not mentioned very often in this
 newsletter who do a lot of work for HORNET.  Pi is the TRUE listserver
 coordinator for HORNET.  Whenever the listserver crashes or goes buggy,
 Pi is the guy I count on to bring it back up.  In a slighly different area,
 Martin M. Pedersen does one of the janitorial jobs here at HORNET.  :)
 Each week when DemoNews goes out, I recieve lots of bounced mail
 notifications.  I forward all of these to Martin and he sends me a list
 of who I need to (un)subscribe or help out.  This is not a fun job and I
 really appreciate his help.

 -ASPHYXIA TRAINER:  Over the past several months, I have been working on
 converting Denthor's "VGA Demo Trainer Guide" source code from Pascal to
 C++.  In the background of the whole thing, FateGrinder and I shoot around
 ideas about how to optimize different assembler routines, etc.  If you
 look at my code hard enough, you're bound to find some of his influence in
 there.

 I know I'm forgetting something...  :)

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<New Uploads>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  NOTE: All locations start with /demos and then their respective sub-
        directory.  Please note however that the actual base directories
        (like /pub/msdos/demos) may differ from mirror to mirror.

Location          Filename.Ext  Size  Description
----------------  ------------  ----  ----------------------------------------

                                 /demos

/alpha/NEW        answer  .zip    40  Answer by Warlock of Amnesty
                 dfuse   .zip    10  Digital Fuse intro by Uncle Bob/Zion
                 einstein.zip     9  BBS Intro for Einstein BBS
                 friends .zip   875  Straight Line Connection for 3S Party 94
                 greetro .zip   199  Happy New Year by Sunrise
                 kiddo   .zip   132  A.P.E.X Presents an Intro called Kiddo
                 mciesc  .zip    14  BBStro for MCI Escapes by Subsystem
                 meet95  .arj   708  Something from Sti/Euphoria (GUS)
                 naidtro .zip   144  The NAID Party Intro (SB only)
                 southfix.zip    79  BBS Intro for South of Heaven by Omicron
                 tornado .zip    23  Shocker presents Tornado Intro (no mus)
                 xmas_dem.zip   658  Christmas Demo by The Paralytic Minds
/diskmags         bm9     .zip   580  Blackmail Issue #9 (stuff from TP94)
                 yahoo04 .zip   286  Yahoo #4, The Hangover Issue
/nets             dginfo18.zip    16  Demogroups Interchange InfoPacked v1.8
/news             nad_u01 .zip  1428  New Age Demo Database Upgrade: 1

                                   /code
/demosrc
                 fcsp2src.zip    31  FC's StarPort BBS ][ Source
                 incosrc .zip   241  Source to Inconexia demo by Iguana
                 isad2src.zip    20  ASM source for Immortal Syndicate BBS
                 kuk2src .lzh   159  Source for Pleasure Access BBS
                 sea_code.zip    33  ASM Source to Seasick / VLA
                 sqd1_src.zip    21  ASM Source to Squid1.com (BBS Intro)
/graph/lens       lenssrc .zip    40  BAS, ASM example of a Lens
/graph/pallette   fadecode.zip    30  C,ASM source for fades and pallette rot
                 palrot  .lzh     2  Pallette Rotate by Draeden / VLA
/graph/plasma     c_plasma.zip    55  C source code to color plasma
                 jclplasm.zip    88  ASM,C For NICE color Plasma
/graph/shadebob   jeffbobs.lzh    75  PAS source for Shade Bobs
/graph/tutor      tut9new .zip    43  Part 9 of Asphxia VGA demo tutor in C++
/pmode            dpmispec.arj    33  Protected Mode API For DOS Extended Apps
                 protect .lzh    15  ASM Protected Mode programming example
/sound            fmed101 .zip   147  OPL3 FM Sound Editor for Programmers
                 gp15-pas.zip    46  PAS source for GUS Modplayer
                 gusenv  .zip     1  ULTRASND environment checking in ASM
                 gusp15  .lzh    19  ASM source for GUS Modplayer
                 pps110  .lzh    84  Protracker Playing Source/Josh Jensen
/utils            basm10  .zip   297  Basic to ASM Language Translator
                 frmi!150.exe    38  Flat Real Mode Interface v1.5

                                  /music

/disks            f10_pck2.zip        Force Ten Pack #2
                 f10_pck3.zip        Force Ten Pack #3
                 f10_pck4.zip        Force Ten Pack #4
                 rot     .zip        Rotation by Neophyte mini musicdisk
                 traxx36 .zip        Latest Traxx album
/programs/frntend mplay12 .zip        Musicplay 12.0 frontend music program
/programs/misc    readcda .zip        Read digital data from CD using CDROM
/programs/players radv1_0a.zip        ADLIB tracker package (anyone use FM!?)
/songs/s3m        belly   .zip        Belly's Theme by Falcon (FM ADLIB)
                 cannabis.zip        Cannabis sativa by Transee
                 dnc2trnc.arj        Dance to the Trance by Hector
                 doom-hth.arj        Doom and Stuff by Hector
                 dreary  .arj        Dreary as all hell by Hector
                 epi-opus.zip        Opuscule by MusicMan/Epinicion
                 firesirn.arj        Firesiren by Hector
                 gonnadie.arj        We're All Gonna Die by Hector
                 k-udream.zip        Unfaithful Dream by Boomer the Bass Pig
                 messiah .zip        Messiah by Transee
                 mindrave.zip        Mind of a Raver by Avatar
                 mystwat2.zip        Myst Water by Hector/DMK
                 mystwatr.zip        Part 2 of the above
                 nois    .zip        Nois by Kevin, Fast drums & strange sou
                 pl_dt   .zip        Song by Plastique/Dep
                 pl_heart.zip        "
                 pl_know .zip        "
                 pl_move .zip        "
                 pl_rave .zip        "
                 pl_thund.zip        "
                 pl_uknow.zip        "
                 pl_who  .zip        "
                 pl_zany .zip        "
                 renais  .zip        Renaissance by Null
                 rh_cyu  .zip        Song by Red Horizon/Dep
                 rh_insom.zip        "
                 rh_nw   .zip        "
                 rh_ready.zip        "
                 rh_real .zip        "
                 rh_samur.zip        "
                 rh_sea  .zip        "
                 rh_tod  .zip        "
                 rh_vp2  .zip        "
                 sky_jung.zip        Jungle Baby Love by D.J. Skyjump
                 trn-imh .zip        In my Hough by Transee
                 trn-medi.zip        Mental Diary by Transee
                 wait4u  .zip        Waiting for You by Falcoln (Adlib)
/songs/xm         mftp    .arj        Music for the People by (see below)
                 moby-go .arj        Moby-Go by Pieter Van Den Veen
/text             life    .zip        Some text about a new group

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<NAID>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

_____Survival Guide by GraveDigger

   +         .         /\
 .        + .      .  /  \    .    +
  _____ 3\ __3____    \__/_______             Official Survival Guide
  \__  \3 \  3\   \ +  __ \      \                    for the
 .  /   \  \  / _  \  /  \ \____  \  .   North American International Demo
   /  _     \/ /_   \/    \/    3  \                Competition
. /    \____/    \__/   __/__       \           April 15 - 16, 1995
  \    /  . \____/  \__/  +  \______/ww
:::\__/::::::::::::::::::::::::::::::::

Here is a practical(?!) guide to surviving NAID, the upcoming North American
International Demoparty, which is to be held in Quebec on April 15th and
16th. There's still a few months left to prepare yourself for this event,
so I decided to provide this guide for anyone who intends to attend. I hope
you find this guide helpful, and remember to pack light. If you plan to
sleep at the school, there will be a lot of people in one big room, unless
you've reserved a room for a group. Of course, feel free to donate me some
space if you're getting a hotel room.

By the way, the above NAID logo was borrowed from the FILE_ID.DIZ of the
naidtro.zip archive. I couldn't draw a logo of my own, and I liked that one
a lot, so there it is.

Personally, I have never attended a demoparty, though I have some ideas on
how to prepare for it, as I'm more familiar with Canada than I am with
Finland or Denmark. I'm hoping this guide can help everyone have the best
possible time at NAID. This being the first party of this kind on this side
of the puddle, I would like to see the date go down in history, and the
party repeated in years to come. We need to show the Euros that we know how
to party, too!

Please keep in mind that this guide is intended merely as a complement to
your regular luggage checklist. For your convenience, though, a small box
has been placed next to each item so you can check it off as you pack it.
Even though you now have this list, don't forget items like toothbrushes,
toothpaste, deodorant or anti-perspirant... Oh, hell with it. I'll probably
be the first to forget these items anyways. (Hope there's a drugstore in the
vicinity?)
 _
|_| 1. First, you will need an English-French dictionary. As you know,
    Quebec is the French-speaking region of Canada. Comment vas tu? Tu
    habites aux Etats-Unis? Parlez-vous francais? Hmm. You might need to
    work on your accent, too.
 _
|_| 2. Next, you might want to take a life-jacket. Considering that a large
    portion of you will be crossing the St. Lawrence River to get to the
    school where NAID is being held, you don't want to take your chances
    with those bridges.
 _
|_| 3. You will want to have a source of caffeine. Whether it be in the form
    of money for soda machines or coffee, or your own beverage supply, it
    will be required to stay up after hours and party, at which time you
    will probably consume more caffeine, and party some more... and hell,
    who really wants to sleep anyways?
 _
|_| 4. Be sure to pack your teddy bear if you have one. Yeah, just look at
    that poor little guy sitting on your bed. How do you think he feels when
    you just leave him there?
 _
|_| 5. Bring along unfinished programs and songs and such, and maybe you can
    get together with someone else who has a pute and some knowledge, and
    work on it with them. In fact, here's a C program that I started which I
    need help with. If anyone can assist me, please let me know. (I just
    recently took up C as a hobby, so please bear with me.)

-----[cut]-----[blah.c]-----

#include <stdio.h>             /*    Blah v1.0.0  */
                               /*      1/04/95    */
void main()
{ printf("The program is now running.");
}

-----[cut]-----[blah.c]-----

I'm not sure what this program is going to be used for, but I'm sure once
it is completed it will be really cool. :)
 _
|_| 6. If you bring your own computer to NAID, be sure to lock it up, if at
    all possible. At other recent demoparties, especially The Party 94,
    equipment was stolen or damaged. This only applies if you're not bringing
    your kid brother's CoCo, in which case you should leave it out in plain
    sight, and hope it gets stolen. Then, when the culprit is caught,
    everyone can point and laugh, and this should prove to be a funny
    experience, for all except one person. Hey, win some, lose some, right?
 _
|_| 7. You might want your own roll of toilet paper. Hey, you never know...
    I can imagine that it sucks to get stuck on the can without toilet paper.
    Have you ever hobbled down the hall to your toilet paper supply with your
    pants down? Uhh.. not that I ever have, I just don't imagine it being
    something any of you would want to get stuck doing. Yeah, that's it.
 _
|_| 8. If you have a flashlight, bring it with you. This can be used for
    finding the bathroom in the middle of the night, or just for reading
    porno magazines in your sleeping bag. For the latter option, this will
    let everyone around you locate you, and you can then trade porno
    magazines with each other. However, please keep in mind that I do not
    read porno magazines, nor do I promote pornography. <cough>
 _
|_| 9. If you have a beeper or pager, leave it home if possible. It would be
    just plain annoying to be watching a demo when all of a sudden, someone's
    beeper goes off, half the crowd turns to find the source of the noise,
    and misses the best part of the demo. Though it would be funny to hear a
    tune with such a sound in it, or even a phone ringing, and watch everyone
    looking for it.
 _
|_| 10. Keep a calculator with you and keep track of the exchange rate for
    your currency. You don't want to get ripped off when buying stuff or
    exchanging your money. And in the event you want to sell something, you
    can rip them off if you do it right.
 _
|_| 11. You might want to bring some homework with you. You'll most likely
    be away from home all weekend, and you might have some extra time during
    which you can study. Or if you're really lucky, your books will get
    stolen and you won't bother going to class anymore.
 _
|_| 12. Bring a portable radio. If you live somewhat far from Quebec, you can
    occupy yourself by finding cool radio stations that you'll never be able
    to hear again after Sunday. You'll also have something to look forward to
    when NAID '96 is planned.
 _
|_| 13. Two words: breath mints. :)
 _
|_| 14. Grab a flat-head screwdriver to take with you. What for? I don't
    know. Wait, hmm. Looks like I have run out of ideas for this list.

I hope this guide becomes a part of your trip to NAID. Print it out, have it
translated into french, sign language, and braille. Share this guide with
others planning to attend. Fax it, snail mail it, tape it to your forehead.
Memorize it backwards. Also, If you have any additions to this above list,
please contact me at the email address below. Anyways, hope to see you there!

GraveDigger [uuDW/CoRE]
[email protected]

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<Editorial>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Much response was generated by last week's humorous editorial entitled
Codethink(School);.  This week, I take a U-turn from humorous to dramatic
(hey, you can't expect me to be in the same mood every week).

One small note: I will make frequent use of the pronoun "they" as being
third-person singular.  It is incorrect grammatically to have a sentence
such as "Ask someone a question and THEY will give you an answer".  The
sentence should be "Ask someone a question and he or she will give you an
answer".  However, I will be using "they" as in the above example rather
than filling this editorial with "he/she" everywhere.  Enough said, let's
go on...

_____General Protection Relationships

re-la-tion-ship, noun 1. a connection, association, or involvement.

Without exception, every one of us in the demo scene has two things in
common: we interact with computers and we interact with humans.  In
essence, we have relationships with both.  Under close inspection, these
relationships can actually reveal an amazing amount about who we are as
individuals and how successfully we deal with others in our lives.

Ask a computer what the sum of two plus two is and it will tell you four.
Ask a human the same question and they will probably raise their eyebrows
and wonder which mediation you've been taking.  Ask that same person if
they want to go and see a movie.  Mabey they're sick, or busy, or tired, or
just don't want to.  If you're lucky they might even say "yes".  Ask a
computer if it wants to run a program.  It might have difficulty, but that
computer will die, trying to make you happy.

If you think about it, a computer is your ultimate friend.  It never tells
you to get some sleep or do your homework.  Its always there, waiting
patiently for you to make a request.  With games, demos, and various GIFs,
the computer can give you hours and hours of entertainment.  Even more,
your computer actually changes with you: it remembers what you have done
in the past and keeps track of what's new in your life.

How many times have you had an argument with someone and gone to your room
to watch Second Reality or play a game of DOOM?  In that respect, a
computer can help relieve stress.  The computer is always in your corner,
willing to help out with any problem you might have at the time.

Over the years, I have had a lot of difficulty in forming lasting relation-
ships with members of the opposite sex.  Part of this stems from my
inability to correctly guess what they "mean" all of the time.  Say I ask
woman X if she wants to go and eat at McDonalds.  The reply is "well...ok".
Let's just take a few possible interpretations of this answer:
  1. "I am tired of eating at McDonalds, can't you think of anywhere else?"
  2. "I don't really care where we eat."
  3. "While I was saying the word 'well', I was actually trying to think
     of some place else we could eat.  I couldn't, so I guess McDonalds
     is 'ok'."
  4. "That was just a silly answer.  You know I always love to at at
     McDonalds!"
  5. "The only reason my answer came out like that was because I was
     watching the road for you to make a mistake while driving."
  6. "What?  Are you trying to tell me I'm FAT?"
The list of guesses goes on and on.  A computer only HAS two answers,
yes and no (1 and 0).  Its nice not having to play mind games once in a
while.

The computer is a shield between you and reality.  It can transport your
mind away from the physical world; away from the problems, the headaches,
the work, and the daily routines that we go through every day.  The more I
think about it, I realize that our "Escape" CD was very appropriately
named.

As this article draws to a close, I begin to wonder if its any good or if I
should just delete the whole thing and call it a day.  I just asked my
computer if it likes the article and it wouldn't tell me.  Oddly enough, I
feel like calling my parents right about now.

-Christopher G. Mann / HORNET   January 29, 1995

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<Code>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

_____Ctrl-Alt-Delete, Now Its a Game! by Denthor

Telephone conversation :
<Ring> <Ring>
<Click>
Fanus   : Hello, Buys residence.
Denthor : Hi there Fanus, whats up? Can I speak to Piet?
Fanus   : Ummm ... he's not in ... ummm ... who is this? I don't recognize
          you.
Denthor : Don't worry, it must be my new haircut.
Fanus   : Oh. This must be Denthor.

Hi all! I am back after a two week absence from the Demuan List. Today I am
going to introduce you to two new games, which should make sitting at the
computer and listening to music a lot more fun.

The first game is one I have described before in my trainers. It requires
two people and a computer. I like to call it Control-Alt-Delete. Here is
how it works. One person gets the delete button, and the other person gets
the Control and Alt buttons. Player one must then hit delete very quickly,
while player two has to try and hit control and alt at the same time. If
the computer reboots, player two wins, otherwise player one stays at his
station. When player one wins, they swap sides and begin again.

This game can provide hours of enjoyment, and really is great fun in
between really boring lectures about stuff you learned years ago. When I
invented the game, I thought I was doing really badly against Pipsy until I
realised that the computer had frozen.

Note : People have caught on how to play at the local university, and sneak
up and play it on my computer while I am telnetting. Be warned. Also, the
game isn't as much of a challenge when you play it by yourself.

The second game I invented while I was on holiday last week (one of the
reasons I didn't write an article) ... we were down the South Coast, stuck
in a hotel room while it poured with rain outside. The Tugela river
overflowed it's banks, the sand bars dissapeared, and the tan I was hoping
to get never appeared. (I have been programming so much I haven't seen the
sun for the past three months, so when I finally get to go away, it rains,
of course. Way to go, Murphy.)

Anyway, with no computers, no phone, South African TV and no nightlife, we
had no choice but to listen to the radio. After a while of mind numbing
boredom, I invented a new game. I haven't named it yet, but here goes. You
listen to a song on the radio. Every time the singer says a word that is
more then one syllable long, you add a point. You don't count words twice,
or all songs would get a high score.

Most of the songs got between three and five, but we lost count when they
played a Counting Crows song. Ace of Base did surprisingly well, wile some
rap artists didn't score anything. Try it, you'll be amazed.

The PC Games Programming Encyclopedia part two will be out on the 10th of
Febuary, I will make sure that Hornet is one of the first sites to get it.
I hope to have up to number 20 of my trainer series in it.

So, I leave you to pick a game and start playing!

Byeeeee...

Denthor - [email protected]

PS. This no-GUS thing is a Creative Labs conspiracy, isn't it?


_____Assembly Part 3 by Jason Nunn

    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    \\\\\\\\[ "Implementation Techniques" - Assembly Part III
    \\\\\\\[[  By Jason Nunn
    \\\\\[[[[
    \\[[[[[[[
    ____________________________________________________________________

In this issue I will be discussing the basic nuts and bolts on how to
implement an assembly program geared towards a demo. This article is
intended for the C or Pascal programmer who hasn't quite got the confidence
to use a full blown assembly compiler. In the first part, you may remember
me telling you of a friend that has reached a turning point in his coding
development, yet he still won't "take the plunge" because he doesn't have
access to all the nice perks of 3GL's, like sine, cosine, and random
functions and larger precision variables than the chip itself. This issue
will hopefully provide that incentive.

But...., before we do that, I would like to first finish off last article's
talk on optimization. I forgot to include the fast string functions. I'm
not going to waffle on too much about this now, as this article is
dedicated to "assembly techniques". All I will do here is show my results,
and give out some tips.

Same things apply on this run - my machine is a 486-33 ISA, operating in
P-mode, and the lower the number, the faster a given instruction is.

        STOSB   [209729]                MOV     [EDI],AL   [134226]
                                        INC     EDI

        STOSD   [306805]                MOV     [EDI],EAX  [244208]
                                        INC     EDI

        LODSB   [209729]                MOV     AL,[ESI]   [134226]
                                        INC     ESI

        STOSD   [306805]                MOV     EAX,[ESI]  [244208]
                                        INC     ESI

        MOVSB   [228550]                MOV     AL,[ESI]   [142124]
                                        MOV     [EDI],AL
                                        INC     ESI
                                        INC     EDI

        MOVSD   [384379]                MOV     EAX,[ESI]  [324112]
                                        MOV     [EDI],EAX
                                        INC     ESI
                                        INC     EDI

Of course, REP operations are faster than their equivalent by about half.
In general, it is better to use MOV's and INC's to perform one off
operations. So if you're coding with these instructions, chances are that
you can get a bit more speed out of your code.

Ok, now on with the main talk. Generally, I won't be going into great depth
as there are plenty of tutorials and manuals on the net that explain the
rank basics of assembly. My role here will be to highlight and familiarize
extrordinary things about coding methods of assembly.

If you've never coded in assembly, then it may pay you to write your
equivalent program in a 3GL first and before converting it over. I guess it
depends on the person. I prefer to implement idea's in straight assembler.
I'm comfortable with the language enough to mumble it in my sleep and their
are no barriers or contingencies like there are in 3GL code. You can also
run into serious problems when converting to your target language, but I'm
sure that there are as many negative points about doing this as they are
positive points.

How to crunch huge numbers
--------------------------

One of the first questions a new demo coder may ask is how he/she could
add, multiply or subtract a number that is larger than the precision of the
chip. Well, this really doesn't apply now, as the standard is 32 bits. This
is ample for nearly all calculations, but for those of you that may want to
perform a 64 bit ADD calculation, this is how you do it:

        ADD     EAX,ECX
        ADC     EDX,0

In this example, we don't have a 64 bit register, therefore we must make
two data sources, whether they be registers or memory references to act as
one large register. In our case, EDX and EAX act as one. EAX contains the
least significant data and the EDX contains the most significant data of
our 64 bit number. ECX contains the number we are adding to this 64 bit
concatenated register. The basic idea behind this is that we first add ECX
to EAX. If the number in the EAX register "clocks" then the CPU's carry
flag will be set.

The next instruction - ADC (for those of you that don't know) is a funny
sort of ADD instruction that performs two add instructions. It will first
add the source register to the destination register, and then add 1 to the
source register if the carry is set. Hence the name "ADD ON CARRY". In our
example, if the carry flag is set, we will only add in the carry flag as
the source value is zero. Therefore, if the least significant component of
our 64 bit variable (EAX) clocks, the it will carry over to the EDX
component.

Although the above example only adds a 32 number to the 64 bit number. If
you wanted to add a 64 bit number to a 64 number then you would adopt the
following:

        ADD     EAX,ECX
        ADC     EDX,0
        ADD     EDX,EBX

Where EDX:EAX is the destination 64 register, and EBX:ECX is the source
register.

To add larger precision's, we simply chain!. Here we are adding a 32 bit
number that resides in EAX to a 128 bit number which is stored in
EDX,EBX,ECX and ESI.

        ADD     EDX,EAX
        ADC     EBX,0
        ADC     ECX,0
        ADC     ESI,0

To subtract, the same principle applies, accept we use SUB and SBB
instructions:

        (a)                                     (b)
        SUB     EAX,ECX                         SUB     EAX,ECX
        SBB     EDX,0                           SBB     EDX
                                                SUB     EDX,EBX

With the 486's math coprocessor, the large multiplication and division is
more viable than our old conventional way of calculating large numbers;
which as you will see and very slow. Pretty soon, I will be exclusively
using coprocessor calculations in my demos, as they are extremely popular
now. Hence rendering the following code (for me) obsolete. However, for
names sake, I'll discuss the old way of doing things...

For multiplying a 64 bit variable to a 32 bit variable you can use this
algorithm:

        MOV     EAX,ESI
        MUL     EBX
        PUSH    EAX EDX
        MOV     EAX,ESI
        MUL     ECX
        POP     ECX EBX
        ADD     ECX,EAX

As a formula, the code is equivalent to this: ECX:EBX = ECX:EBX*ESI.

Note that you can chain this one also by taking the EDX value from the
second MUL and multiplying it by the next significant register of the
source and adding that answer into the respective register of the
destination.

Dividing is a little bit more complex. How complex?...this complex:

        PROC LONG_DIV
          OR            EBP,EBX
          JZ            @@jump_0599
          PUSH          EBP
          MOV           EBP,ECX
          OR            EBX,EBX
          PUSHF
          JNS           @@jump_0548
          NOT           ECX
          NOT           EBX
          ADD           ECX,01
          ADC           EBX,00
        @@jump_0548:
          OR            EDX,EDX
          PUSHF
          JNS           @@jump_0557
          NOT           EAX
          NOT           EDX
          ADD           EAX,01
          ADC           EDX,00
        @@jump_0557:
          MOV           ESI,ECX
          MOV           EDI,EBX
          XOR           ECX,ECX
          XOR           EBX,EBX
          MOV           EBP,0021h
        @@jump_0562:
          RCL           ECX,1
          RCL           EBX,1
          SUB           ECX,ESI
          SBB           EBX,EDI
          JNB           @@jump_0570
          ADD           ECX,ESI
          ADC           EBX,EDI
        @@jump_0570:
          CMC
          RCL           EAX,1
          RCL           EDX,1
          DEC           EBP
          JNZ           @@jump_0562
          POPF
          JNS           @@jump_058A
          NOT           ECX
          NOT           EBX
          ADD           ECX,01
          ADC           EBX,00
          POPF
          JNS           @@jump_058D
          JMP           @@jump_0597
        @@jump_058A:
          POPF
          JNS           @@jump_0597
        @@jump_058D:
          NOT           EAX
          NOT           EDX
          ADD           EAX,0001
          ADC           EDX,00
        @@jump_0597:
          POP           EBP
        @@jump_0599:
          RET
        ENDP

This formula divides EDX:EAX by EBX:ECX. Just in case anybody recognizes
this thing, I've reversed it from a certain popular commercial package (not
giving any names) hehe :). I havn't used it since my real mode days
(which, for the record is about 2 years ago when coding TC669), and it's
basically optimized for that. I've made no attempt to optimize it for
P-mode, as I most likely will never use it ever again.

How to implement a Decimal point (or rather - a hexadecimal point :)
--------------------------------------------------------------------

Now that we have discussed the ways in which we can do a whole range of
calculations, your next question is how to implement floating/none discrete
calculations. For that, we must take a register/memory unit and divide it
into two parts. The number and a mantissa. For the sake of efficiency, you
would typically contain this in a single register, namely a 32 bit
register. I usually use this type of construct (represented in binary):

         /------------32 bits------------\
         NNNNNNNNNNNNNNNN.MMMMMMMMMMMMMMMM

Here you have a 16 bit actual number, with a 16 bit mantissa. As you can
see the actual number is of a higher order than normal. If to wanted to
extract the number from this variable, you can simply perform a SHR 16.
This will arrive you at the "NNN...." component of the number. Here is an
example of 1 and a half:

        0000000000000001 1000000000000000b

If we wanted the discrete part of the number (ie the "1" part), then just
perform a SHR 16, which arrives us at: 0000000000000001. As you can see,
there is no real difference between discrete and non-discrete variables. To
the machine, it's all the same thing. The difference is the way you
interpret the product. Calculations are still no different to normal
numbers. If we wanted to add a "half" to this number then it's as simple
that this:

   MOV     EAX,00000000000000010000000000000000b   ; this is a decimal "1"

   ADD     EAX,00000000000000001000000000000000b   ;this is a decimal "0.5"

So, as you can see, it's not very hard. For multiplication, you're going to
have to include a SHRD instruction, as the number will now be in EDX and
the mantissa in EAX, hence the precision is now larger. This will return
the number back to the EAX 32 bit precision that it should be. Here is an
example:

        MUL             ECX
        SHRD            EDX,EAX,16

Here, we multiply EAX by ECX, which arrives at EDX:EAX. Then we just step
down this answer to arrive at the result, witch will now be contained in
EAX. With division, it's the opposite:

        MOV             EDX,0
        SHLD            EDX,EAX,16
        DIV             ECX

Here we are dividing EAX by ECX. Note the preparation just before the
divide.

Signed Data
-----------

As of now, we have only discussed unsigned data. Generally speaking, these
calculations are very simular, but there are some major differences.

Contained in a given 32 register, unsigned numbers go from 0 to FFFFFFFFh,
where as 32 signed data range from 80000000h which is the lowest number and
7FFFFFFFh begin the highest number. When using signed data, there are only
a couple of extra things you must know. Signed data has its own
multiplication and division instructions (ie IMUL and IDIV), and its own
set of conditional jump instructions.

  JL (jump if less than) and JLE (jump if less than or equal to)
      are a signed equivalent to
  JB (jump if below)     and JBE (jump if below or equal to).

  JG (jump if greater)   and JGE (jump if greater than or equal to)
      are the signed equivalent to
  JA (jump if above)     and JAE (jump if above or equal to).

To change our unsigned divider from this....
        MOV             EDX,0
        SHLD            EDX,EAX,16
        DIV             ECX

...To a signed divider, simply substitute the MOV EDX,0 with a CDQ. The CDQ
extends a signed number in EAX into EDX. Example given:

        CDQ
        SHLD            EDX,EAX,16
        IDIV            ECX

Implementing Complex mathematical relationships
-----------------------------------------------

At one time or another, a coder is going to have to use some sort of
complex mathematical function like triangle ratios, logarithmic factors and
random numbers to implement various things. To create a function that maps
a relationship in real time is basically impossible in efficiently terms.
The only way you can do this is to store relationships in the form of
tables. This may not be apparent to users of compilers like turbo C etc but
electronic calculators, compliers, maths coprocessors, spreadsheets all use
this method of mapping these relationships. it a very fast a convenient way
of doing things.

The first common function is the random function. A random signal can be
achieved using the following algorithm. The product of this function is a
random number stored in the EAX register.

        ;input: NIL; output: EAX
        proc random
          mov  ebx,[random_seed1]
          lea  ebx,[ebx*4]
          mov  eax,[ebx+@@rantable]
          mov  ebx,[random_seed2]
          lea  ebx,[ebx*4]
          add  eax,[ebx+@@rantable]
          mov  [ebx+@@rantable],eax
          inc  [byte random_seed1]
          and  [byte random_seed1],01111b
          dec  [byte random_seed2]
          and  [byte random_seed2],01111b
          ret
        random_seed1
          dd    2
        random_seed2
          dd    13
        @@rantable:
          dd 0fd8fce7ah,02d7ad7b7h,0f48a8f3ab,04a3b8f8bh
          dd 0f2dec542h,0a847fab7h,0f4da81aab,04a348f86h
          dd 024547edah,03b535a43h,0b35a535ab,0aa333483h
          dd 0fd2f4e7ah,0c525a5b7h,016d3b4a4b,0643b4fd3h
        endp

If you expand the table to 256 entries then you could eliminate two
instructions, but there again, it's not worth doing. This random function
will give you a very random signal :). There is only one problem with this
algorithm, and that is, the randomness will always follow the same pattern.
If this feature undesirable, then you may like to make an initiation module
that jumbles up the seeds or the numbers a bit. An obvious way of randomly
choosing a seed, would be to store a fixed reference variable in memory.
For example:

        proc randomise
          mov  al,[043253445h]
          mov  [byte random_seed1],al
          mov  al,[012345678h]
          mov  [byte random_seed2],al
          ret
        endp

Anyway, I'm going to stop here as it's getting very close the deadline
time. One day, I'll learn not to leave things till last minute. In the next
part, I'll be hopefully finishing up this assembly series and moving on to
my talks of sound/tracker programming (the interesting stuff).

I'll be soon releasing a tracker that I have written called FunkTracker.
With this will be the full source code listing. My discussions will be
based around my knowledge and experience when producing current and past
trackers and players, and discussing implementation and hardware issues. I
also plan to discuss reverse engineering using microsoft CodeView, and plan
to obtain hack docs on the AWE32 card. So this will be all coming up!.
until next time.

See ya
:Jason Nunn


_____BSP Trees by Tom Verbeure

Problem situation: sorting polygons is slow and can be incorrect for
certain view-angles. Heavily influenced by Computer Graphics, Principles
and Practice, I have written this small tutorial for BSP trees, which
solves the problem for static objects and for every view angle.

As I already said: Binary Space Partitioning Tree. Unlike many other
abbreviations, this one really explains a lot of the algorithm: it uses a
tree. It partitions space and it partitions in two parts.

First: it is only usefull in static scenes: no 3D morphing or other goodies
are allowed.

Let's go to the 2D case, 3D is exactly the same.
Take a sample scene:

        A\        -----   C|
              \   B       E    |
          ------   |
                               |
                   /    .
                  /      V
                D/

The positive side of the polygons is the side with the defining
character... Ignore V for now.

One could sort this thing during rendering, but as there can be no correct
sort criterium and sorting is slow, we don't want that. Besides, we have
memory to spare :-)

Now, we're going to build a tree that is totally viewpoint independent:

Take polygon B as the root. Polygon B divides space in to parts: the
positive and the negative side (Geee!) We have partitoned space in two.

First, scrap B from the 'not-used' polygons-array and classify the
remaining polygons. Group those on the + side, and those on the - side. As
you can see, polygon C is both on the + and the - side. What to do? Create
2 new polygons C+ and C-, erase C. Is there another complainer ? Nope: all
poly's are on either the + or the - side. Now we have this situation:

                   B
                              / \
            A,C+,E   D,C-

Not really a tree yet, but we've only started...

Now, do the same thing for the groups at the child nodes, without caring
about those in another child-node.

For the + side of B, we have polys A,C+ and E. Take A as next node polygon.
Neither C+ nor E are on it's negative side (we ignore D and C-). For the
other node, take D as next node polygon. Only C- remains there, and it is
on the negative side. That side of the tree is finished. We have the
following situation:

                   B
                              / \
                             /   \
                            A     D
                             \     \
               C+,E     C-

There's one child with more that one poly left. Take C+ as node polygon, E
become it's child, on the positive side. We're finished.
Situation:

                   B
                              / \
                             /   \
                            A     D
                             \     \
                              C+    C-
                             /
                            E

Now, what can we do with it? A lot... Suppose the viewpoint is at position
V. In which order do we have to sort the polygons, when using a back to
front rendering algorithm ? Answer: walk the tree, make sure all nodes
(including children) are visited.

Start at the root. Is V on the positive side? Nope, well, we want the polys
far away first, so walk the positive way. Are we on the positive side of A?
Yep, walk the negative way. It is empty! Ah. Well, draw A first. The go the
positive way. Are we positive of C+? Yep. Negative way of C+ is empty. Draw
C+ poly. Go positive way of C+. E has no child, draw it. Go up until a
non-empty branch is found, draw all node polygon not drawn already. We now
arrive at B again. Draw it. Negative is not visited yet, walk it. We're
negative of D. Positive way is empty. Draw D and go negative. C- has no
child. Draw it. All nodes have been visited. The end.

We have drawn the polygons in following order:

A, C+, E, B, D, C- which is a correct order. The BSP tree has to be
constructed only once and for all. From then on, sorting the polygons is
always correct and in linear time. Standard sorting algorithms can be
proved to be of n*log(n) order of time, so we have an increase in speed as
well.

Disadvantages:

- Memory: one has to have the tree in memory. This can be substantial for
      lots of polygons.
- Polygon splitting: one ends up with more split polygons. It is almost
      always unavoidable to do splitting.
- Polygons are not allowed to move.

A BSP tree is NOT unique: just pick another polygon as a node and one gets
a different one. In this case, one can avoid splitting polygons: start with
a root and build the following, correct, BSP tree:

               C
                      /
                     B
                    / \
                   A   D
                  /
                 E

Tadaam! No polygon splitting!

Building a tree with as little splitting as possible is an exponential of
the number of polygons. As Foley and Van Dam says, just try a limited
number of nodepolygons, pick the one with the least splitting and the tree
will be good enough.

Voila. That's it. Not too difficult I think. Notice BSP trees are also
usefull to sort objects, by using planes that divide the space in such a
way that Object A is on the negative and Object B is on the positive side
of the plane. Very useful (only for non-intersecting objects).

This text is written without the Bible (Computer Graphics, P&P) besides me,
but since I read their chapter about BSP trees many times, it contains
almost the same info.

For polygon splitting algorithmes, there is one in Graphics Gems. I don't
know which one, but buy all four books, you won't be disappointed... :-)

Tom Verbeure
Synergy Design

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<Back Issues>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

_____How to Get 'em

After reading this issue of DemoNews, you may be wondering how you can get
previous ones.  Well fear not!  There are two different ways to do so:

1: FTP to hornet.eng.ufl.edu and go to /pub/msdos/demos/news/OLD_NEWS and
   start downloading anything you see.

2: Now you can request back issues of DemoNews via e-mail.  Start a letter
   to [email protected] (any subject line) and in the body of the
   letter include "get demuan-list <index>" where INDEX refers to the
   index number of the issue.

   For example:  get demuan-list 43

   This would retrieve DemoNews #76 (part 1 of 2).

   For more recent issues that are split into multiple parts, you must send
   an individual request for each index number.

_____Descriptions

Issue  Index  Date      Size    Description
-----  -----  --------  ------  ----------------------------------------------
 75   41,42  12/18/94   68009  A DemoNews Reader, The Birth of Commercial
                               Life, Editorial: Calm Before the Storm,
                               Interview with Mello-D, US Demo Scene
                               (Renaissance meeting), Jelly Tots and Pizza
                               Shops, Review of Wired '94 Graphics.

 76   43,44  12/25/94   92589  Interview with EMF, DemoNews Readers Write,
                               Kimba's Life Story, X-Mas in the Demo Scene,
                               CORE, Demo & Music Database, Interview with
                               Purple Motion/Future Crew, Interview with
                               Krystall/Astek, Common Sense ][ by Perisoft,
                               Its X-Mas in Africa, Interview with Maxwood
                               of Majic 12, Assembly Part ][, Common Sense
                               Response by Stony.

 77   45,46  01/01/95  101100  Chart History, Snowman Near-Disaster, Son of
                               Snowman, The Party 1994, Making Waves, Using
                               Assembly Part 2.

 78   47-49  01/08/95  111185  The Party 1994: Results and Reviews, Report
                               by Stony and Friends, What happened to PC-
                               Demo competition.  Editorial: TP94 = ASM94
                               part 2.  Egg2: Trancescrambled Review, More
                               on Fast Tracker 2.03.  General Rambling by
                               Denthor.

 79   51     01/15/95   41832  A Day in the Life of Snowman, Ambient Sample
                               CD 1, Where's the Sound Blaster, TP94
                               Graphics review.

 80   55     01/22/95   27028  DemoNews/HTML, Traffic Jam, CodeThink(School);
                               The Solo Sample CD

,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,

<<Closing Comments>>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

The quote this week comes from "Assembly Language for the PC, Third
Edition". p.174

   "A program is never done...but it must be stopped somewhere."

This was intended as a moral for programmers, but with a little rewording
the message is applicable to many areas in life.

See you in CyberSpace,

                       -Christopher G. Mann (Snowman)-
                           [email protected]

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,End.of.DemoNews.081.