----------------------------------------------- .- main -.
| __ the __ coding .__ asylum .___| |= wtf!? =|
|_/ |_ ____ | | __ | |__ ____ __| _/| |= * programming * =|
|\ __\/ __ \| |/ / | | \_/ __ \ / __ | | |= my creations =|
| | | \ ___/| < | Y \ ___// /_/ | | |= graphics creations =|
| |__| \___ >__|_ \_____|___| /\___ >____ | | |= links =|
| \/ \/_____/ \/ \/ \/ | |= about me =|
- programming --------------------------------- \______________________/
\
this is the programming section. it information about pro /
gramming languages, and about what the difference between \
compilers and interperters is. /
\
BASIC/QuickBASIC /
\
A brief History /
This is a programming language made by Microsoft in \
the mid eighties. It all began in about 1964 with the /
development of BASIC (Basic All Purpose Symbolic Code) by \
two Dartmouth College students. To make a long story /
short, Billy Gates decided to make his own version: MS- \
BASIC. This was at first an interpreter that was supplied /
for the 8086 Genre. When the 286 came out, Microsoft \
renamed this package to Microsoft QuickBASIC, which was /
now a compiler. It has been a growing language (with \
version 4.5 being the latest and 7.1 as the latest /
professional development edition) that later in the \
late 80's changed into VisualBASIC for DOS which inturn /
'morphed' into VisualBASIC for Windows as we know it \
nowadays. /
\
Companies that make BASIC Compilers/Interpreters /
Microsoft: QuickBASIC 4.5, VisualBASIC 5.0 \
Powersoft: PowerBASIC 3.2 /
\
Example BASIC code: /
\
10 FOR a=1 to 10 /
20 PRINT "HELLO" \
30 NEXT /
\
Equivalent QuickBASIC code: /
\
FOR a=1 TO 10 /
PRINT "HELLO" \
NEXT /
\
Note: QuickBASIC features a bit more advanced /
programming techniques, that allow but do not require \
line numbers. Originally in BASIC, line numbers were /
mandatory. \
/
C/C++ \
/
A Brief History \
Yes, The thrid letter of the alphabet. That's right! /
Believe it or not, that's the name of a programming \
language (Just shows how creative programmers can be). /
Now back to C. It all began in the 1970's with the hope \
of creating a programming language with new principles /
and compatibility between different platforms such as \
different UNIX systems. The original name (and it took me /
some time to research this) was A. With some major impro- \
vements it was renamed to B and then with even more im- /
provements, it was renamed to C. It was created by Brian \
Kernighan and Dennis Ritchie (K&R) at Bell Laboratories. /
As the years went by, a new style of programming has \
risen and now basically conquers the programming field. /
This is called Object Oriented Programming, or OOP. You \
may have heard of C/C++. The C is the C language and the /
C++ is a flavour of C, but with object oriented thingies \
built in. (I can't say to much about OOP because I myself /
am not very fluent with it) \
/
Companies that make C/C++ Compilers \
/
Microsoft Visual C++, QuickC \
Borland C++ 5.0 /
Watcom C/C++ 11.0 (this is really cool) \
Delorie Software DJGPP (Free! NOT shareware! Freeware! /
id's Quake/QuakeČ is made in it!) \
/
Example C code: \
/
#include "stdio.h" \
void main(void) /
{ \
int a=5; /
printf("This is the value of a:&i\n",a); \
} /
\
Equivalent QuickBASIC code: /
\
a=5 /
PRINT "This is the value of a:"; a \
/
Turing/OOT \
/
A Brief History \
This is a language made in the University of Toronto /
by a group of professors. It is basically a teaching lan- \
guage that gives you a way of learning about programming /
concepts in general. It is a really good language to be- \
gin programming in. It was meant as a replacements lan- /
guage for the more complicated PASCAL language, and \
therefore shares many similarities with Pascal. So far, /
this concept has worked, with some 60% of the schools in \
southern Ontario using Turing as their language of educa- /
tion. There is one thing I REALLY like about Turing, it \
is (1) Mulitiplatform: UNIX, Macintosh, ICON, IBM PC etc. /
(2) it uses an auto-indent key -F2. This key allows for a \
long program with many of loop's and if's to be automati- /
cally indented without you having to press the TAB key \
whenever an indentation should be made. This is extremely /
helpful at times with large and complicated programs. \
/
\
Companies that make Turing Interpreters /
Holt Software and Associates. Turing 7.2, DOSOOT, WinOOT \
/
Example Turing code: \
var a : int /
put "Enter a numerical value".. \
get a /
put "The value you entered plus one is:", a+1 \
/
Equivalent QuickBASIC code: \
INPUT "Enter a numerical value"; a /
PRINT "The value you entered plus one is:"; a+1 \
/
Pascal \
/
A Brief History \
This language is named after Blaise Pascal, a math- /
ematician of the 17th century. Niklaus Wirth from Zurich, \
Switzerland created the programming language in the late /
1960's at ETH (Eidgenossiche Technische Hochschule). It \
took about 10 years for it to get recognized as a widely /
respected programming language. \
/
Companies that make Pascal Compilers/Interpreters \
Borland TurboPascal 7.0 /
Watcom Pascal \
/
Example Pascal Code: \
program main (output); /
begin \
writeln ("test test"); /
end. \
/
\
Equivalent QuickBASIC code: /
PRINT "test test" \
/
\
Assembly Language (Asm) /
\
The Facts and History /
Asm controls what the CPU does almost electron by \
electron. It has total control over the CPU, and in turn /
the whole computer. It can basically make anything, and \
has no limitations. Most High Level Languages (hll) will /
allow you to do "anything" but will have their limit- \
ations divided into factors such as speed, size and ease /
of use. Asm, on the other hand, has speed maximized \
(depending on the design of course), but ease of use is /
rather low (meaning that it is hard.) As for size, well, \
that can be divided into seperate categories. The source /
code for asm can be rather lengthy. A program writen in \
BASIC can take up only 1 line of source code, while the /
asm version of the program might take up some 5 to 10 \
lines. On the other hand, the executable or binary ver- /
sion of a program done in BASIC might be something like \
12Kb, while it's asm equivalent only 5 to 10 bytes. Yes, /
bytes! The size difference is enormous. This is the main \
reason most demos are coded in asm, because there is a /
size limit, and what can be fit into 4,096 bytes amazes \
me almost everytime. /
The language itself also has a big disadvantage, \
once you learn it on an Intel 80x86 based processor, you /
will have to learn a whole new batch of commands (op- \
codes) for the Motorola 68x000 CPU. In a language like C /
or BASIC, the program can almost always be translated by \
both Compilers/Interpreters without any complications. /
\
Asm requires the knowledge of how the CPU operates. /
It is necessary to understand how memory is segmented, \
how the Stack operates, and what registers or interrupts /
are. These are things that will probably unveil the in- \
nerworkings of your other programs created in a hll such /
as C or BASIC. You will be able to optimize your source \
code in the hll and make it as "friendly" to the CPU and /
compiler as possible. It would be pointless for you to \
create a program that converts temperatures in Celcius /
to temperatures in Farenheit in ASM for optimum speed, \
because if it was done in BASIC, it would run with /
unnoticed speed loss, and would cut development time by \
several hundred. The bottom line is,if you want to have /
something squashed into as little space as possible, and \
want it to run with absolute maximum speed, learn to do /
it in asm. Making a program in BASIC might be easy, but \
being able to make a program in asm that will work as /
fast as possible, is harder, but worthwhile. \
/
Companies that make Asm Compilers: \
Microsoft MASM (macro assembler) /
Borland TASM (turbo assembler) \
Eric Isaacson's A86 (Shareware) and A386 (full version) /
\
Sample ASM source: /
\
.MODEL SMALL /
.CODE \
MAIN PROC /
Start: \
ASSUME CS:@CODE, DS:@CODE /
mov dx,OFFSET TheBeep \
mov ah,9 /
int 21h \
mov ax, 4c00h /
int 21h \
Main ENDP /
.DATA TheBeep DB 07h,"*Beep*$",0Dh,0Ah \
/
Equivalent QuickBASIC source: \
/
PRINT CHR$(7) + "*Beep*" \
/
\
Compiler? Interpreter? What's that? /
\
Much like a language interpreter in real life, an /
interpreter is a program that can take english like \
terms and convert them into terms understood directly by /
a CPU (Central Processing Unit). For example,it can take \
the instruction PRINT "HELLO" and convert it into some 3 /
lines of computer understood code. Remember, a computer \
can only add numbers. That is all that it can do. It /
cannot possibly "understand" the command PRINT. \
/
But what is the difference between an interpreter \
and a compiler? Let's visualize this. If I were to tran- /
slate what a person was saying to you in a different \
language, live in near real time, I would get stressed /
and probably confused. This is what happens to an inter- \
preter. It is slower and more CPU intensive. Now, if I /
were to view a video tape of what that person was saying \
and was to translate it into another language, I could /
do that on my own time, look over certain parts of the \
tape, double-check things and then neatly type it up for /
you to understand easily. This is what a compiler does. \
It takes a whole program in one big chunk, converts it /
to the "neatly typed instructions" for the CPU to under- \
stand, and then backs away, as the CPU deals with the /
code. The advantages over a compiler are that interpr- \
eters tend to start to execute code faster than compil- /
ers, whereas compilers first go through the whole list \
of instructions, and then run it, which may be time /
consuming with large programs. This slow-down in com- \
pilers is minimal with the average speed of the current /
PC. If I were to recommend to you which one to use, I \
would say to use a compiler. The reason? Compilers make /
code a LOT faster and some of the new compilers can even \
Optimize your program for you. /
\
this site is designed and created by Michal Guerquin /
© 1997 by Michal Guerquin [e.mail] \