Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming & batch files
#1
PROGRAMSMsg # 1 of 44                    Date: Sat 23/08/1997,  3:23 pm

From: GURU                       Read: 23 times

     To: All
Subject: PRELUDE

Umm, this is kinda long, so if you can't be bothered, then just skip over it
Smile  This is basically a description of the adventure system I'm working on,
incase anyone is vaguely interested and incase anyone feels like giving
their opinion. Would you use it? If so, what would you rather were changed?

  Here is a description of my work and ideas for PRELUDE. The project is
currently working in a PASCAL implementation, and I am porting it (slowly Smile
to C. If you have the time, please read through this and give me your opinio
of this system. Appologies in advance for any parts I don't explain too well
- I'm trying to condense the results of several years' thought about this
into a quick overview. Also, there are several areas that are a bit vague -
the whole point of writing PRELUDE is to sort out some of these ideas.
  
  In this text, I use the word 'adventure' to mean a work of computer-bassed
interactive fiction. In general, I am refering to a 'text adventure' - that
is, a game where the player types commands such as "eat food" or "throw the
rope across the canyon", and the computer responds via. some set of rules
laid out by the author of the adventure. However, I do not intend to limit
the final system to only handling games of this type.


  PRELUDE is/will be the test version of a much bigger adventure game system
which I plan to develop sometime in the future. The purpose of writing
PRELUDE is to examine some of the strategies available for use in the
future system.

  Essentially, the adventure system will be a set of control routines, which
will be modifiable by the user of a system to conform to his or her
requirements. An adventure created by the author will consist of a set of
these routines, plus game data stored in the form of lists.

  Therefore, the 'adventure' will be created out of a number of layers:-

* GAME DATA - this is a set of lists, describing objects, places, etc. These
        are given the generic name 'frame' (name taken from AI work);
* CONTROL ROUTINES - a set of ANSI C routines + a main program that will
        use the data and control the adventure game.


  A standard 'library' of control routines will be provided:

   * LST - interfaces to the game data lists
   * FRAME - a frame is a 'thing' (object, place, person, etc.). The routine
                in this library handle movement of frames, etc.
   * CMD - routines to handle user commands, such as "get", "go", etc. These
                routines interface between FRAME and PARSER.
   * CMDLST - matches verbs with appropriate routine from CMD
   * PARSER - handles user input, uses CMDLST to exectue appropriate CMD
                actions. PARSER and CMDLST interface between CMD and
                user input.
   * GAME - gets input from user, then runs PARSER.


  For example, the standard CMD library would contain routines for verbs suc
as "get", "go", "drop", "eat", "look", "examine", "put", etc.

  If the author required non-standard commands (eg. "teleport", or
"levitate"), then these could be added to CMD and CMDLST. The code for these
commands could be built from the 'building blocks' provided by FRAME.

  If the author required a subtle change in the way a large number of
commands operate, the appropriate building blocks in FRAME could be
modified.

  
  The exact implementation of the GAME DATA lists is not important - the
LST library interfaces to these lists - changing implementation just means
changing the LST library.

  The LST library will provide simple 'building blocks' from which FRAME
commands can be built - for example displaying a set of text stored in part
of the list (an object description perhaps), adding and removing 'tags'
(eg. flags for on/off, visible/invisible, etc.), maps (eg. where to look if
the user wants to "go north"), etc...

  As well as the standard control routine library, the system will provide
a program to create GAME DATA lists ('frames'), allowing the author to
specify every component of the frame for his or her adventure.


  This system gives the author _complete_control_ over how his or her
adventure is going to work. I have chosen C since it is powerful, can be
ported easily to other platforms, and is known by many people. Obviously
creating any adventure that requires more than what is provided in the
standard library will require programming, but so do other adventure-
authoring systems.


  I indend for the system to be PUBLIC DOMAIN - meaning that anyone can
change the standard library to suit his/her purposes. It would of course
be possible to build several 'standard libraries' - eg. one containing
commands used in 'fantasy' adventures ("cast spell", etc.), another for
'modern' adventures ("drive", "switch on", etc.)...


  The working version I have is currently a reduced version - understood
commands are "go", "look", "examine", and "put ... in ...". Using the
building blocks from LST, it was easy to implement multiple descriptions
(eg. a description for when you first enter a room, and a shorter descriptio
every time after that), adjectives (eg. the "big blue metal box"), and
inheritance via. type and adjective (eg. all big things can contain small
things, all boxes can contain things whereas balls can't, all balls are
spherical, etc.).

  IMHO this system provides a powerful, portable, and easy(ish) way of
authoring adventure games. But, of course, my opinion is probably biassed.
Thanks for reading all this - please give me _your_ opinion on this system.

--------------------------------------------------------------
PROGRAMSMsg # 2 of 44                    Date: Sat  6/09/1997, 11:27 am
From: GURU                       Read: 19 times

     To: XLNC
Subject: File parameters

Dunno if you read the PASCAL subby, thats why this is here.

Program for Turbo Pascal/TMTPL to write parameters to a file that you can
use from QBASIC or whatever. It'll output a text file - first line of text
file is a number (number of parameters), then following lines are
parameters.


GETPARAM.PAS:
----------------------snip-------------------
PROGRAM GetParam;

USES CRT, DOS;

VAR OutFile : TEXT;
    i : INTEGER;

BEGIN
ASSIGN (OutFile, 'PARAMS.TXT');
REWRITE (OutFile);
WRITELN (OutFile, ParamCount);
FOR i := 1 TO ParamCount DO
  WRITELN (OutFile, ParamStr (i));
END.
----------------------snip-------------------

Change the 'PARAMS.TXT' to any filename you like (eg.
'C:\DATA\PARAMETE.RS')

--------------------------------------------------------------
PROGRAMSMsg # 3 of 44                    Date: Sun 14/09/1997,  2:25 am
From: RASPUTIN                   Read: 16 times

     To: XLNC
Subject: Re: OLMR

>>>No No No...When u use the SL colour codes... it takes up 3 chr spaces.
>>>so an inverse color thing Blinking etc takes 6-9 spaces of the 80 you can
>>>have on each line.
>
>>Ooooooh, thats what you mean...    <look of enlightenment>
>>OK. Talk to Ras on that one - he's the one that did that WriteX thingi kind
>>like that  Smile
>
>Hinterestin.. Ras.. Wotz WriteX thing?

A procedure I wrote in Pascal that writes strings in inline colours...
Eg, To write Yellow Text, just do: WriteX('<tYe>Yellow Text.');
Yellow on Blue:   WriteX('<tYe>Yellow...<bBl>On Blue.');
or Light Magenta on Black: WriteX('<tLm><bBk>Ras was here.');

The first letter (case IN-sensitive) specifies textcolour or Background...
Then the remaining two match the searchlight colour labels.

There are of course better formats to use for frequent colour changes...

--------------------------------------------------------------
PROGRAMSMsg # 4 of 44                    Date: Wed 22/10/1997, 10:58 am
From: GURU                       Read: 12 times  [1 Reply]

     To: All
Subject: C++

Hey y'all. I've discovered (on 42 BBS) a wonderfull thing called DJGPP.
Its a C/C++ compiler, its really easy to use (comes with an editor called
RHIDE which makes the whole thing work just like Turbo Pascal, including
online help), and best of all, its FREE!

  Anyway, its about 8 megs or so ZIPped, so I won't upload it right now. If
anyone is interested, leave a message and I'll stick it in the
TRANSFER area.

chow

___ Blue Wave/386 v2.30 [NR]

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

PROGRAMSMsg # 5 of 44                    Date: Thu 23/10/1997, 12:52 am
From: XLNC                       Read: 13 times  [1 Reply]

     To: GURU
Subject: Re: C++

>Hey y'all. I've discovered (on 42 BBS) a wonderfull thing called DJGPP.
>Its a C/C++ compiler, its really easy to use (comes with an editor called
>RHIDE which makes the whole thing work just like Turbo Pascal, including
>online help), and best of all, its FREE!

U mean its a complete standalone C++ clone or do we need C.?

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

PROGRAMSMsg # 6 of 44                    Date: Thu 23/10/1997,  4:51 pm
From: GURU                       Read: 14 times

     To: XLNC
Subject: C++

 >Hey y'all. I've discovered (on 42 BBS) a wonderfull thing called DJGPP.
 >Its a C/C++ compiler, its really easy to use (comes with an editor called
 >RHIDE which makes the whole thing work just like Turbo Pascal, including
 >online help), and best of all, its FREE!

 Xl> U mean its a complete standalone C++ clone or do we need C.?

Its a complete port of the UNIX 'GNU C++', so it is a complete standalone
compiler for either C or C++ (depending on what you want to write your
programs in Smile
  Oh, and it runs in protected mode (so you can use all 8/16/32 megs of
memory, insead of just the usual 640k), and handles virtual memory for you
(so you could make 4-gig variables if your HDD was that big Smile

___ Blue Wave/386 v2.30 [NR]

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

PROGRAMSMsg # 7 of 44                    Date: Wed 23/07/1997,  9:58 pm
From: JOKO                       Read: 22 times

     To: GURU                    Fwd From: :   No, not the confectionary treat
Subject: Re: RIPterm

> Jo> Doesn't work in ripterm. But if it did would it be:
> Jo> ,,,,,,,,,,,,,
> Jo> Aimeeeeeeeeeeeeee...!  ?
>
>Smile   Try Pressing ALT-=, _then_ do it
Aim‚e...
WOW it does work!
Aim‚e Aim‚e Bo Ba N‚n‚ Rama Bana Bo Banana, Aim‚e!
Guru Guru Bo Ba Gunu Nana Rama Bo Banana, Guru!
Joko Joko Bo Ba Hoko Tana Lana Bo Banana, Joko!
Raspy Raspy Bo Ba Baspy Gana Fana Bo Banana, Raspy!

I think thats how the song goes. Tell me if I'm wrong.

----------------------------------------------------------------
THE PROGRAMMER'S QUICK GUIDE TO THE LANGUAGES
----------------------------------------------------------------

The proliferation of modern programming languages (all of which seem to
have stolen countless features from one another) sometimes makes it
difficult to remember what language you're currently using. This handy
reference is offered as a public service to help programmers who find
themselves in such a dilemma.


                TASK: Shoot yourself in the foot.


C: You shoot yourself in the foot.

C++: You accidentally create a dozen instances of yourself and shoot
them all in the foot. Providing emergency medical assistance is
impossible since you can't tell which are bitwise copies and which are
just pointing at others and saying, "That's me, over there."

FORTRAN: You shoot yourself in each toe, iteratively, until you run out
of toes, then you read in the next foot and repeat. If you run out of
bullets, you continue with the attempts to shoot yourself anyways
because you have no exception-handling capability.

Pascal: The compiler won't let you shoot yourself in the foot.

Ada: After correctly packing your foot, you attempt to concurrently load
the gun, pull the trigger, scream, and shoot yourself in the foot. When
you try, however, you discover you can't because your foot is of the
wrong type.

COBOL: Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place
ARM.HAND.FINGER on HANDGUN.TRIGGER and SQUEEZE. THEN
return HANDGUN to HOLSTER. CHECK whether shoelace needs to be re-tied.

LISP: You shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which you
shoot yourself in the appendage which holds the gun with which you shoot
yourself in the appendage which holds the gun with which you shoot
yourself in the appendage which holds the gun with which you shoot
yourself in the appendage which holds...

FORTH: Foot in yourself shoot.

Prolog: You tell your program that you want to be shot in the foot. The
program figures out how to do it, but the syntax doesn't permit it to
explain it to you.

BASIC: Shoot yourself in the foot with a water pistol. On large systems,
continue until entire lower body is waterlogged.

Visual Basic: You'll really only _appear_ to have shot yourself in the
foot, but you'll have had so much fun doing it that you won't care.

HyperTalk: Put the first bullet of gun into foot left of leg of you.
Answer the result.

Motif: You spend days writing a UIL description of your foot, the
bullet, its trajectory, and the intricate scrollwork on the ivory handles of
the gun. When you finally get around to pulling the trigger, the gun jams.

APL: You shoot yourself in the foot, then spend all day figuring out how
to do it in fewer characters.

SNOBOL: If you succeed, shoot yourself in the left foot. If you fail,
shoot yourself in the right foot.

Unix:
% ls
foot.c foot.h foot.o toe.c toe.o
% rm * .o
rm:.o no such file or directory
% ls
%

Concurrent Euclid: You shoot yourself in somebody else's foot.

370 JCL: You send your foot down to MIS and include a 400-page document
explaining exactly how you want it to be shot. Three years later, your
foot comes back deep-fried.

Paradox: Not only can you shoot yourself in the foot, your users can,
too.

Access: You try to point the gun at your foot, but it shoots holes in
all your Borland distribution diskettes instead.

Revelation: You're sure you're going to be able to shoot yourself
in the foot, just as soon as you figure out what all these nifty
little bullet-thingies are for.

Assembler: You try to shoot yourself in the foot, only to discover you
must first invent the gun, the bullet, the trigger, and your foot.

Modula2: After realizing that you can't actually accomplish anything in
this language, you shoot yourself in the head.

Enjoy


--------------------------------------------------------------
PROGRAMSMsg # 8 of 44                    Date: Thu 24/07/1997, 11:33 pm
From: XLNC                       Read: 31 times

     To: JOKO                    Fwd From: :   No, not the confectionary treat
Subject: Re: RIPterm

>----------------------------------------------------------------
>THE PROGRAMMER'S QUICK GUIDE TO THE LANGUAGES
>----------------------------------------------------------------
>C: You shoot yourself in the foot.
>FORTH: Foot in yourself shoot.
>Visual Basic: You'll really only _appear_ to have shot yourself in the
>foot, but you'll have had so much fun doing it that you won't care.
Etc...
Machine coad- You discover the way to do it is to move your foot Micron
by micron thru the bullet, but have to write a complete alter reality to be
able to see the event happen.

DOS - You search all the Util disks you can find for that utility you saw
once written just for this purpose but u deleted it because you though you
would never Ever use it.

COBOL (Part 2) You miss a full stop in the first line and the program shoots
holes in EVERYTHING.
QuickBasic You never get around to Shooting yourself in the foot, but you
discovered part of the solution to world piece, and a cursor controll system

WINDOWS You forget about shooting yourself in the foot after finding the
games folder.

WINDOWS 95 Where the hell did you put your foot again. Theres the bullets
but this gun can only move the bullets to another Clip.

VIRTUAL ENVIRONMENTS- You see yourself shooting yourself in the foot
Meanwhile your actually scaring the cat with your index finger.

THE INTERNET- What you thought was your foot turned out to be a foregn army
installation and somone else now wants to shoot you in the foot.
                ---=== X.L.N.C wuz here ===---

-
Reply
#2
PROGRAMSMsg # 9 of 44                    Date: Thu 12/02/1998, 12:51 am

From: RASPUTIN                   Read: 12 times

     To: All
Subject: programmable calculator

My new Sharp EL-5120 programmable calculator is now running the
following:

GUESS   :REAL
LABEL IN
PRINT"DIGITS-(1-3)
INPUT N
T=INT (RANDOM*10^N)
C=0
PRINT"G=YOUR GUESS
LABEL GUESS
INPUT G
C=C+1
IF G<T GOTO LOW
IF G>T GOTO HIGH
PRINT C
PRINT"GUESSES TO WIN
END
LABEL LOW
PRINT"GUESS HIGHER
GOTO GUESS
LABEL HIGH
PRINT"GUESS LOWER
GOTO GUESS

Features (of program):
- choice of 1, 2 or 3 digit random number to guess.
- keeps track of how many tries to guess correctly.

It's a 3 line display, two limitations I'll note are:
- text or digits on a line by using PRINT" or PRINT,
but not both on one line.
- One command per line, except IF ... GOTO.

1200 bytes memory, but of course it gets wiped for exams Sad

--------------------------------------------------------------
PROGRAMSMsg # 10 of 44                   Date: Sat  7/03/1998,  9:40 pm
From: RASPUTIN                   Read: 12 times

     To: All
Subject: PIC Programmer circuit

Well, there's these things called PIC's (Peripheral interface
Controller), and they're basically a little 18-pin chip, and 13 of the
pins are user configurable I/O under program control in ASM.
Actually, PIC-ASM has only 30-odd opcodes, as it is RISC.
A dedicated assembler called MPASM is freeware by Arizona Microchip,
and there's shareware cross assemblers with an include file full of
EQUates for PIC-ASM. The programmer is a simple circuit which plugs
between your parallel port, and 5 pins of the PIC chip, for
In-Circuit-Serial_Programming.
Designing a circuit for the PIC chip is easy too, starting with only a
few components, depending on application.

     RA2  -|~~~~U~~~~|- RA1    
     RA3  -|  P I C  |- RA0    
     RA4  -|  16C84  |- Osc_I  
    !MCLR -|         |- Osc_O  
      0V  -|         |- +5V    
     RB0  -|         |- RB7    
     RB1  -|         |- RB6    
     RB2  -|         |- RB5    
     RB3  -|         |- RB4    
           `~~~~~~~~~'         

ant to get mine to control a solid-state-analog-audio-recorder
chip, which is 8-times better than digital sound storage.
I've I/F'd this chip to the PC before with good success, and now
I'll try it with the PIC. Next I'll probably try telephone
interfacing...

Ever wanted to program your own microcontrollers?

--------------------------------------------------------------
PROGRAMSMsg # 11 of 44                   Date: Tue 24/03/1998, 12:25 am
From: RASPUTIN                   Read: 11 times

     To: SPARKS
Subject: PIC Programmer circuit

 Sp> Subject: Re: PIC Programmer circuit

 >     RA2  -|~~~~U~~~~|- RA1    
 >     RA3  -|  P I C  |- RA0    
 >     RA4  -|  16C84  |- Osc_I  
 >    !MCLR -|         |- Osc_O  
 >      0V  -|         |- +5V    
 >     RB0  -|         |- RB7    
 >     RB1  -|         |- RB6    
 >     RB2  -|         |- RB5    
 >     RB3  -|         |- RB4    
 >           `~~~~~~~~~'         
 >
 >Ever wanted to program your own microcontrollers?

 Sp> I have seen these chips before (:  You can get many different sizes
 Sp> of these PIC chips.  They came out a while ago.  The only problem is
 Sp> that you had to have a computer and a programmer. ):  I have some books
 Sp> on PICs (old Every Day Electronics mags>..... (:

 Sp> I've always wanted my own microcontroller (: but it has allways
 Sp> been a dream.....

Is this the one?

     13V       5V                            5V
     ÄÂÄ      ÄÂÄ                           ÄÂÄ
     ÚÁ¿      ÚÁ¿                            ³    ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
     ³1³      ³1³                            ³    ³ Derren Crome ³
     ³k³      ³k³        ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿     ³    ³ EPE, Feb.'96.³
     ÀÂÙ      ÀÂÙ        ³    P I C    ³     ³    ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
      |      __|_        ³    16c84    ³14   ³
 PRG /O      \  /        ³          VddÃÄÄÄÄÄÙ                  LPT
    / O     __\/__       ³    ____     ³                        ~~~
      ³        ³        4³Vpp/MCLR     ³13          ÚÄÄÄÄÄÄÄ¿  ÚÄÄ¿
      ÀÄÂÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄij         DataÃÄÄÄÄÄÄÂÄÄÄÄÄ´  1k   ÃÄÄ´ 2³
        ³       5V       ³             ³    ÄÄÁÄÄ   ÀÄÄÄÄÄÄÄÙ  ÀÄÄÙ
        ³      ÄÂÄ       ³             ³    ÄÄÂÄÄ68n
        ³      ÚÁ¿       ³             ³     ÄÁÄ
 RST |_|o      ³1³       ³             ³12          ÚÄÄÄÄÄÄÄ¿  ÚÄÄ¿
     | |o      ³2³       ³          ClkÃÄÄÄÄÄÄÂÄÄÄÄÄ´  1k   ÃÄÄ´ 3³
        ³      ÀkÙ     16³             ³    ÄÄÁÄÄ   ÀÄÄÄÄÄÄÄÙ  ÀÄÄÙ
        ³       ÃÄÄÄÄÄÄÄÄ´Osc          ³    ÄÄÂÄÄ68n
        ³     ÄÄÁÄÄ      ³     Vss     ³     ÄÁÄ               ÚÄÄ¿
        ³     ÄÄÂÄÄ10p   ÀÄÄÄÄÄÄÂÄÄÄÄÄÄÙ     GND          ÚÄÄÄÄ´25³
       ÄÁÄ     ÄÁÄ             ÄÁÄ 5                     ÄÁÄ   ÀÄÄÙ
       GND     GND             GND                       GND

Cheap and easy to make, I have a current Dick Smith catalog for
any bits I don't already have.
Are you interested in making one?

The main programmers are:
- David Tait      (software & circuit & sample source and object code)
- Steve Marchant  (software & circuit & sample source and object code) )
- Derren Crome    (EPE, Feb.'96.; March, April '98)
- Charles Manning (EA. Nov.'95, April '96, May '96.)
- Nigel Goodwin   (Most versatile software: includes dissassembler)
- S.G. Willis     (Circuit: [PP87WORD.DOC], similar to others.)


Have you got Adobe Acrobat, to read .PDF files?
Have you got WinWORD 6.?
Care to check out the circuits? They're in .PDF, .GIF/.BMP, .DOC formats.
I've found that most of the circuits are basically the same,
and there's one generic circuit for the Data and Clock, and Clock_Out,
and generic circuits for Vpp (PGM) & Vdd (PWR) control.
It's the Pin_4 (Vpp/!MCLR) circuit that is the hitch.
On most of the programmers, it's got a pulldown resistor for reset,
yet this doesn't work for literal In-Circuit_Serial_Programming,
Which is where Derren Crome (EPE)'s programmer is good.
If your LPT doesn't drive the PIC well enough, use a 7407 to buffer
the Clock and Data lines.   Easy done.

--------------------------------------------------------------
PROGRAMSMsg # 12 of 44                   Date: Fri 22/05/1998,  4:25 pm
From: GURU                       Read: 19 times

     To: All
Subject: Nachos

Hey hey, we did our demonstration of out Operating Systems project today...
and the guymarked it and we got 90%   WAHOOOOO!!!

  One of the marker's comments: "Try to resist those Microsoft tendencies"

Smile

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

PROGRAMSMsg # 13 of 44                   Date: Wed 30/12/1998, 11:32 pm
From: RAS                        Read: 12 times

     To: GURU
Subject: HTML programming for Windows

I saw an article in a magazine in Hutt Vally Polytech library about how
HTML was the easiest way to program in windows.
The article admits it's extremely inefficient, but OTOH quite easy.
Eg. Forms can be filled in and calculations made in javascript alone.

On the subject of HTML, DHTML (Dynamic HTML) is what makes it easy to
have web pages generated on the fly depending on previous user input or
whatever... without needing to resort to SGL and that.

And XML (eXtensible Markup Language (or eXtended ... in one magazine))
is 'replacing' HTML, so the inet magazines reckon.

BTW I got a mag. with an example of doing a currency conversion on a user
inputted dollar amount (eg. US$ to NZ$). I'll send it after I've typed it in
(cause I want it on PC), after you remind me a few times... if u want 2
Smile

--------------------------------------------------------------
PROGRAMSMsg # 14 of 44                   Date: Fri  4/07/1997, 11:28 am
From: GURU                       Read: 27 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Programming

OK, time to tell you some words and concepts you need to know. Just remember
that with computers, as long as you know the jargon you can pretend you know
what you're talking about    Smile
  Sorry again if this is _too_ basic - gimme a chance OK. Skip over the bits
you know.


  Pascal is a PROGRAMMING LANGUAGE. Like French or English, it is a means of
communication. It is (by the standards of the computer industry) now quite
old - Pascal was developed in the late 60s/early 70s. It is regarded as an
"out of date" language by a lot of programmers, but it remains one of the
easiest programming languages to learn. Fortunately, once you have learnt
a programming language, other languages (such as C or C++, ADA, COBOL, ASM)
are pretty easy to pick up.

  When you write a program in Pascal, you produce PROGRAM CODE. This is a
list of instructions, in the Pascal language, telling the computer exactly
what to do. For example, a part of your code might look like:

                CLRSCR;
                WRITELN ('Hello world!');

  Don't worry about what it does (tho you can probably guess) - I'll get ont
that later.

  Your <insert computer name here> computer, unfortunately, can't understand
Pascal though... the only instructions that your computer understands are
called MACHINE CODE instructions. Once you've written your program in Pascal
you run a COMPILER, which is a conversion program. All it does is take
your Pascal program in one end, and spits out a machine code program out the
other end. What you get is an EXECUTABLE program - a list of machine code
instructions that tell the computer to do something.



   +--------+                           +------------+
   | Pascal |                           | executable |
   | (text) |  -->    COMPILER    -->   |  (binary)  |
   |  file  |         program           |    file    |
   +--------+                           +------------+

eg. HELLO.PAS                              HELLO.EXE



  The compiler that we will be using is called "TMT Pascal". I'll tell those
of you that need it how to set this up in the next message. For now, I'm
just telling you this so you know what TMT is.



  OK, on to files and filenames. This is easy... a Pascal file is a text
file with the extension ".PAS"  (for example HELLO.PAS). You can create
these files with any text editor (use EDIT which comes with DOS if you
don't have any other editor).
  Quick note: If you're using Turbo Pascal, you'll notice that it has its
own editor built into it)

  An executable file has the extension ".EXE"  (for example HELLO.EXE).
Remember that you don't actually create these files yourself - the compiler
makes these by translating the .PAS file into something the computer can
understand. You can RUN an executable file from DOS by typing the name (eg.
typing HELLO and pressing ENTER), clicking on it from WIN'95 EXPLORER,
etc...



Right, thats enuff for now. Next message: How to set up the TMT Pascal
Compiler...
.

--------------------------------------------------------------
PROGRAMSMsg # 15 of 44                   Date: Sat  5/07/1997,  6:09 pm
From: GURU                       Read: 25 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: What things are 2

Well, Aimee complained she didn't understand the last post, so maybe I'll
be able to explain things better this time...  tell me if any of you are
still lost.




PROGRAMMING LANGUAGE (eg. Pascal) - a set of commands to tell the computer
        to do something. For example, there are commands for "clear the
        screen", "draw a line", etc...

          Other programming languages you may have heard about are C, C++,
        BASIC, etc.

          At the risk of confusing those who don't know what a batch file
        is... batch files in DOS also have a programming language - there
        are commands like "load a program", "write a message", etc...


OK. make sure you understand the above stuff first... once you've got that,
        then it gets confusing: computers (eg. 286, 386, 486, etc. or
        Macintosh, or whatever) can't understand Pascal.

          Very important!  ^^^^^   You are going to write a program in
        Pascal, but the computer isn't going to be able to understand the
        instructions you write (it doesn't speak that language).


Analogy: Imagine I write a message on a piece of paper: "SING A SONG"    Smile
        I want a paritcular person (Bob) to do what I've written, but that
        person only speaks Swahili.
          So, Bob can't do what I want, 'cos Bob can't understand English
        commands.
          To resolve this situation, we need a third person (Joe) who can
        speak English _and_ Swahili. Joe can read my message, and write
        the message in Swahili. Then I can give the Swahili message to Bob,
        and Bob will understand what to do.


So. I can speak Pascal. The computer can't understand Pascal. We need a
        translator to translate what I write into something the computer
        can understand. This translator is called a COMPILER.



Thats all I was really trying to explain... If you do understand this now,
you might want to go back and read the other post, specifically the last
part about Pascal and executable files, remembering that:

        Pascal files are files that I can understand and the computer can't;

        Executable files are files that the computer can understand and I
        can't;

        The compiler ("TMT Pascal", "Turbo Pascal", whatever) is the thing
        that translates from one file to the other.

--------------------------------------------------------------
PROGRAMSMsg # 16 of 44                   Date: Thu 10/07/1997, 12:06 pm
From: GURU                       Read: 19 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Setup

OK, now you know what all this about, its time to setup the Pascal compiler
on your computer and test it with a simple program. I'll divide this into
two parts - read part one if you're using the freeware Pascal compiler
TMTPL; part two is for you guys using Borland Turbo Pascal (which is
a commercial product, so sorry, I can't legally distribute it Sad   )

  BTW, I'm assuming you're using DOS ('cos thats what I have). If you're
using WIN'95 , shutdown into DOS mode. I have no idea what you do with
OS/2, WIN NT, etc...   Smile    If you get stuck, post a message and me or
someone else should be able to help out.


  TMTPL
  -----

  First of all you need to download TMT from this BBS. Go to the file area,
(from the main menu, thats (O)ther, then (F)ile), (J)ump to the TEMPDIR file
area, and (D)ownload 'TMTPL.ZIP' . While you're about it, download the
example file, 'HELLO.PAS' aswell.

  Now go to DOS, and make a directory for the compiler (eg. C:\TMTPL). Go
to that directory (CD \TMTPL) and use PKUNZIP to decompress the archive.

 eg. PKUNZIP C:\DATA\DWNLOADS\TMTPL.ZIP -d

  (make sure you use the -d parameter - this tells PKUNZIP to put things
into the proper subdirectories)

  OK, thats it. Nothing else needs setting up for now. Time to test things
with HELLO.PAS ...
  Move HELLO.PAS into the TMTPL directory (eg. into C:\TMTPL), and change to
that directory (eg. CD \TMTPL). Type the following:

 BIN\PLT HELLO

  and press ENTER. The TMT compiler will give you all sorts of information
that you really don't need to know at the moment about free memory, etc.
Just ignore all this... wait for the command prompt again. Type DIR and take
a look at things... you should see (in addition to some other TMT files
and directories) the following files

 HELLO.EXE
 HELLO.FPD
 HELLO.PAS
 HELLO.SYM

  Forget about HELLO.FPD and HELLO.SYM - they're not needed for now. What
we're interested in is this: The origional file (HELLO.PAS) has now been
COMPILED into an EXECUTABLE file (HELLO.EXE) by TMTPL. Type HELLO to run the
executable program.


  Turbo Pascal
  ------------

  Download the test file HELLO.PAS (see above) from the file area of
Board Shitless.

  I'm hoping that TP is already set up - either by the installation
procedure or by someone else. Anyway, load up Turbo Pascal:

 eg. C:\TPASCAL\TURBO

  (or whatever). Go to the FILE menu (ALT-F), choose OPEN, and open
HELLO.PAS . Type CTRL-F9 (or go to RUN menu and select RUN option) to run
the program.

  Unlike TMT Pascal, Turbo Pascal is a combined editor-compiler - you run
your programs from within the Turbo Pascal editor. Normally Turbo Pascal
doesn't make executable files like TMT does. However, if you _want_ it to,
all you have to do is go to the COMPILE menu and change the DESTINATION
option from "Memory" to "Disk".
  (did that make any sense? Smile



Hopefully you should have understood what I'm going on about, and everything
should have worked out OK. But, if Murphy is haunting you, leave a message
saying what you don't understand/what doesn't work, and we'll fix it up...


--------------------------------------------------------------
PROGRAMSMsg # 17 of 44                   Date: Mon 14/07/1997,  6:38 pm
From: GURU                       Read: 17 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Start

OK, we've gone over what a Pascal program is, and hopefully by now
everything is set up, working, and you know how to compile and run
programs. This post runs through HELLO.PAS and explains what all the parts
do.



Firstly, Pascal programs have a particular LAYOUT - you have to write your
program in a particular way so that the compiler will be able to translate
it.
  Below, I've rewritten HELLO.PAS, just for reference. I've also labeled the
line numbers so I can explain things better


--------------------------------------------
1     PROGRAM Hello;
2
3
4
5     { This program clears the screen and then writes "Hello, world!". }
6     { Then it waits for you to press ENTER }
7
8
9
10    USES CRT;
11
12
13
14    BEGIN
15    CLRSCR;
16    WRITELN ('Hello, world!');
17    WRITELN;
18    READLN;
19    END.
--------------------------------------------


  First thing you need to know: Pascal _doesn't_care_ about capitalisation.
Cool eh  Smile   The first line could have been

 PROGRAM Hello;
     or program Hello;
     or PrOgRaM hElLo;   (if you're in lamer-mode Smile
       or whatever...

  I capitalised PROGRAM 'cos thats the way I feel comfortable with reading
it, but it really doesn't matter - do it any way you like.


  Second thing: There are two types of instructions in the program:
    KEYWORDS such as "PROGRAM", "USES", and "BEGIN" and "END" tell the
_compiler_ what to do... they won't affect your final program, but you still
need them in order to compile the program.
    COMMANDS such as "CLRSCR", "WRITELN" and "READLN" are commands for the
_computer_ to do something. These are the things that your final program
will be "made" of...


  Thirdly: the 5th and 6th lines... These are COMMENTS - things written by
me for _people_ to read. Comments tell someone reading the program what the
program is doing. BUT they don't actually do anything... the Pascal compiler
ignores them.
  To write comments in a program, just write whatever you want between the
'curly brackets' { and } .


  Fourth and final point for now: Some of the keywords have to be in a
particular order. You _have_ to have "PROGRAM" as the first thing in your
program, then "USES", then the "BEGIN" (and, obviously, "END" comes after
"BEGIN")



  Confused yet?  Smile    Lets do a little translation of our own to clear
things up:-


 1     PROGRAM Hello;

  This tells the compiler that you are writing a program, and the program
is called "Hello".


 5     { This program clears the screen and then     etc...
 6     { Then it waits for you to press ENTER }

  Doesn't do anything. The program would compile exactly the same without
these lines. BUT, they explain to someone reading the program what is going
on. Comments ar extremely important, especially for larger, more complex
programs   Smile


 10    USES CRT;

  This tells the compiler that we're going to be using commands that have to
access the screen (eg. screen clearing). Although this is very important, I
won't go into it yet - I'll explain more about this in a later post.


 14    BEGIN

  Tells the compiler that this is where the main program begins. So far we
have seen KEYWORDS... now we get onto the actual program - the COMMANDS.


 15    CLRSCR;
 16    WRITELN ('Hello, world!');
 17    WRITELN;
 18    READLN;

  OK, these are the commands of our program. Its a simple program, so it onl
has four commands:-
 Clear the screen
        Write "Hello, world!" and move to next line
        Write a blank line
        Wait for ENTER to be pressed


 19    END.

  Finally, we finish the program with the keyword "END" and a full stop.
This tells the compiler that we have finished typing in the commands for our
program.



  Thats is - a few commands to tell the compiler whats going on, and four
simple commands telling the computer what to do, and we have a program.
There's just one final thingi to confuse you even further...

  Notice the semicolons (Wink scattered throughout the program. These tell the
compiler that you've finished writing a line...  you need one after _everycommand, and after _some_ keywords (like after the "PROGRAM" and "USES"
keywords) but not others (like "BEGIN").

  Probably _the_ most annoying thing with starting to write your own program
will be forgetting to put the semicolons in, or putting them in the right
places. After a while you get the hang of it, but its a pain at first  Smile

--------------------------------------------------------------
PROGRAMSMsg # 18 of 44                   Date: Wed 16/07/1997,  1:59 pm
From: GURU                       Read: 15 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: .tpu files

 >Okok... I've read the docs for everything, gone over everything with a fine
 >toothed comb, and all I can find on making units is the phrase:
<etc>
 Ra> If it's structured as a TPU, then it'll compile to disk as a .TPU.
 Ra> You compile it to file exactly as you would a program, but the Unit
 Ra> begins with 'UNIT MyUnit;' instead of 'PROGRAM MyProgram;'
 Ra> (and Units also have INTERFACE and IMPLEMENTATION sections, otherwise
 Ra> they're the same as programs, and (more to the point) handled the
 Ra> same.
 Ra> BTW What Pascal you using? Turbo Pascal? If so which version? TP5.0,
 Ra> other?

I'm going to get onto units properly later on, but yeh, for now...
  Units are just 'parts' of programs - the idea is you make a unit (for
example Pascal's CRT unit, which does nice things like clearing the screen,
etc...) so you don't have to keep writing the same code every time you write
a program...   all ya have to type is
                CLRSCR;

  When you choose the 'compile to disk' option in Turbo Pascal, and compile
a unit, it creates a .TPU file. People do this 'cos they're stingy with their
code, and don't want other people looking at it and changing it.
  BUT, as I have said, .TPUs _only_ work with Turbo Pascal, and _only_ with
the version they were compiled with.
  TMT Pascal uses its own type of compiled used (.FPD or something I think)

  You do not need to create .TPU files! Both Turbo Pascal and TMT Pascal
are capable of reading pascal source-code (.PAS) units, when you compile
your program...
  For example, if you have a file called 'MODEM.PAS' which is a unit for
working with the modem, required by a program called 'VOICECHT.PAS'... and
VIOCECHT 'uses' MODEM:
                USES CRT, DOS, MODEM, etc...;
  then Turbo Pascal and TMT Pascal will automatically look for the
'MODEM.PAS' unit.

Does that help at all? (as I say, I will cover this more later)

Also, if the general opinion is that I'm going too slow, then I'm happy to
move along faster...?  Comments?

cyz  Smile

___ Blue Wave/386 v2.30 [NR]

--------------------------------------------------------------
PROGRAMSMsg # 19 of 44                   Date: Thu 17/07/1997, 11:24 am
From: GURU                       Read: 19 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Variables

Quick reminder of last post, before we move on...

  Your Pascal program has to have a STRUCTURE - things have to be in a
certain order:

        PROGRAM ProgramName;

        USES WhateverItUses, Separated, By, Commas;

        BEGIN
        { Commands in this bit }
        END.

  Voila... And we'll talk more about the 'USES' part when we get onto
talking properly about 'units'.   And remember the semicolons after
commands, and some keywords (such as on the 'PROGRAM' and 'USES' lines, and
the full stop at the end of the program.


  Variables
  ---------

  Assuming you had never ever seen a variable in your life (which may or may
not be true), and wouldn't know one if it jumped up and whacked you on the
nose with a big neon sign saying "I'm a variable", this is how you would
know what one is...

  A variable is a label given to a piece of data in your program.
  The label can be any combination of letters, numbers, and the underscore
('_') character (tho it can't _start_ with a number). For example, the
following are all ok labels:

        MyVariable
        MyVariable2
        Another_Dum_Variable

  The data can be pretty much anything. To start with, I'll tell ya about
one type of data: the integer. INTEGERs are numbers, and in Pascal they can
have a value of about -32000 up to +32000.


  Think of variables as being boxes. These boxes have labels on them so that
people can recognise them, and they are designed to hold a specific type
of item (in this case, integer numbers).

  eg.         |             |           |             |
  Variable    |             |           |             |
  'boxes':    |      27     |           |   -16543    |
              |             |           |             |
              +-------------+           +-------------+
                IntegerBox1               IntegerBox2


'Making' variables
------------------

  You DECLARE (ie. 'make') a variable by using another keyword:
                VAR


  Take a look at the following:

        PROGRAM AnotherProgram;

        USES WhateverItUses;

        VAR MyInteger : INTEGER;
            AnotherInteger : INTEGER;

        BEGIN
        { Commands }
        END.

  Thats all there is to it. The 'VAR' section goes after 'USES' and before
the main program ('BEGIN'). You list the names of the variables (eg.
'MyInteger', and 'AnotherInteger' - remember, Pascal doesn't care about the
difference between upper and lower case), put in a colon (':'), and then
the TYPE of variable that you want it to be ('INTEGER'). And, to cause you
problems, a semicolon (';')     Smile


  Once you've done that, you've created an integer variable, which you can
use to store whatever number you want (as long as its an integer from -32000
to +32000 Smile     (eg. score in a game, number of minutes left in a Door,
number of times a key has been pressed, whatever...)


'Using' variables
-----------------

  To write out the 'contents' of a variable onto the screen, we use the
                WRITELN
  command again:

        WRITELN (MyInteger);


  If we want to 'set' the number in a variable, we use the ASSIGNMENT
OPERATOR (':='), like this:

        MyInteger := 0;
     or AnotherInteger := -10;


  We can do all the usual things with integers, like addition, subtraction,
multiplication, etc... I'll just give heaps of examples and some comments,
and ya should be able to work it out.

        { "Myinteger 'gets' 10 * 2" -- ie. Make MyInteger equal 20 }
        MyInteger := 10 * 2;

        { "MyInteger gets AnotherInteger" -- ie. Make Myinteger equal }
        { AnotherInteger }
        MyInteger := AnotherInteger;

        { Make MyInteger equal to MyInteger plus 5 -- ie. add 5 to MyInteger
        { This is maybe a little confusing, but thats how ya do it  Smile  }
        MyInteger := MyInteger + 5;

        { Subtract 32 from MyInteger }
        MyInteger := MyInteger - 32;

        { Multiply MyInteger by 2   (use asterisk ('*') for 'multiply') }
        MyInteger := MyInteger * 2;

        { Divide MyInteger by 4   (use 'DIV' for divide. I'll explain }
        { this later if this sounds dum Smile  }
        MyInteger := MyInteger DIV 4;

        { Multiply AnotherInteger by 7, add 3, and put the result into }
        { MyInteger }
        MyInteger := AnotherInteger * 7 + 3;

        { Order doesn't matter... the following does the same thing as }
        { the previous example }
        MyInteger := 3 + AnotherInteger * 7;

        { By you can use brackets to change the order that operations are }
        { done (yay - just like 1st form maths Smile }
        MyInteger := (3 + AnotherInteger) * 7;



There ya go. Again, if theres anything you don't understand, tell everyone
so we can all laugh at you  Smile   (just kidding)
  Take a look at VARS.PAS (in the file area), which is just an example of
the above stuff. Compile it, watch what it does, etc...

cyz
Reply
#3
PROGRAMSMsg # 20 of 44                   Date: Sun 20/07/1997,  4:04 pm

From: GURU                       Read: 17 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Commands

By now we've covered:

  - the structure of a Pascal program (PROGRAM ... USES ... etc.)
  - integer variables, and the things you can do with them
  - a few basic commands (READLN, WRITELN)

At this stage, I will go into a little bit more detail about the commands
that you saw in HELLO.PAS, and how you can use these commands with integer
variables. I'll also talk a bit about STRINGS...


  WRITELN
  -------

WRITELN is a Pascal command to display something on the screen, and then go
to the next line. For example, to write "Hello, World!" onto the screen, we
used:

  WRITELN ('Hello, World!');

  In programming terms, a piece of text is called a STRING of text, or just
a STRING (god only knows why Smile . We tell Pascal that we are using a string
by using quotation marks (' characters) around the string, as in

                'Hello, World!'
                'This is a string'
                'This is another string'


  Still with me?   Smile    So when we type the command

                 WRITELN ('Hello, World!');

  what we are doing is saying to the compiler:

                 Write this string to the screen: "Hello, World!"...
                 and then go to the next line.


  Remember also, in the VARS.PAS example, we used the WRITELN command to
display the contents of an integer variable:

                WRITELN (Height);

  When we type this, we are saying:

                Write the value stored in "Height" onto the screen...
                and then go to the next line.


  Cool, eh? Same command (WRITELN) can display integer variables, _andstrings  Smile   Infact, is can display both of them on the same line, if you
want. For example:

                WRITELN ('Height = ', Height);

  This will write onto the screen something similar to

                Height =        42

  (don't worry about the fact that the "42" is shifted across for now. Who
really cares anyway  Smile

  Another example:

               WRITELN ('A string can be ', 'broken into ', 'several bits');

  Writes the following to the screen:

               A string can be broken into several bits

  And:

               WRITELN (Height, Width, Depth, Height * Width * Depth)

  Shows something similar to:

                      12       2       1      24



  READLN
  ------

READLN is Pascal's way of reading something from the keyboard. If you just
type

  READLN;

  (like we did in HELLO.PAS), then it waits for the user to press the ENTER
key. However, it can also be used to get more interesting things from the
keyboard - for example, to read numbers:

  READLN (MyInteger);

  Will wait for the user to type in a number, and press ENTER. Then it will
put the number into the integer variable "MyInteger".

  This is probably best explained by example, so heres a short program to
show you READLN in action:



-----------------------------------
PROGRAM Example1;



{ Clears the screen. Prompts the user to type a number. It then tells the }
{ user what number (s)he typed }



USES CRT;



VAR Number : INTEGER;



BEGIN
CLRSCR;
WRITELN ('Please type a number: ');
READLN (Number);
WRITELN ('The number you typed was ', Number);
END.
-----------------------------------

--------------------------------------------------------------
PROGRAMSMsg # 21 of 44                   Date: Wed 23/07/1997,  5:17 pm
From: GURU                       Read: 16 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Strings

This post expands on ideas from the post about variables and strings.
Specifically, we'll see how to make STRING VARIABLES, and how they can be
used. Once you've got the hang of this, you've got to the stage where you
can actually do something _useful_!   Woo hoo  Smile

Just a quick note first: Could I please have some feedback on how everything
is going: too fast, too slow, you don't understand something, you understand
everything and could I please get a move on...  whatever...   is anyone
taking notice of this...?    Smile



  OK. Remember what I said about INTEGER variables. We can create them:

                VAR MyInteger : INTEGER;

  And, once created, we can use them for storing numbers:

                MyInteger := 5;
                WRITELN (MyInteger);

             or WRITELN ('Enter a number:');
                READLN (MyInteger);
                WRITELN ('You typed ', MyInteger);


  We said that a VARIABLE was a "piece of data", and an INTEGER VARIABLE
was a label for a piece of data which could hold numbers - specifically
numbers ranging from -32000 to 32000 (approx).


  I also introduced the concept of STRINGS - lines of text, with quotation
marks around.


  Well, we can create STRING VARIABLES:

    VAR MyString : STRING;

  Just like we could for INTEGER numbers (compare with the method for
creating/defining INTEGER variables).
  So what we now have is a thing called "MyString" which can hold a line of
text...  cool, eh  Smile


  What can we _do_ with STRING variables? Well, we can put some text into
them:

                MyString := 'This is a line of text';


  Or we could output their contents to the screen (ie. display them):

                WRITELN (MyString);


  We could read a line of text from the user:

                READLN (MyString);


  Obviously this is fairly useful, since it means that we can store things
like the user's name, etc...

  Below is a simple program to demonstrate STRINGs. All I'm doing is using
the things I've described above:

-----------------------------------
PROGRAM Example2;



{ Clears the screen, then prompts the user to enter some personal stats. }
{ Then clears the screen again and displays those stats. }
{ Then waits for user to press ENTER }



USES CRT;



VAR FirstName : STRING;
    LastName : STRING;
    Age : INTEGER;



BEGIN

{ Get stats from user }
CLRSCR;
WRITELN ('Please enter first name:');
READLN (FirstName);
WRITELN ('Please enter last name:');
READLN (LastName);
WRITELN ('Please enter age:');
READLN (Age);

{ Redisplay stats }
CLRSCR;
WRITELN ('Stats:');
WRITELN;
WRITELN ('Name: ', FirstName, ' ', LastName);
WRITELN ('Age: ', Age);

READLN;
END.
-----------------------------------

--------------------------------------------------------------
PROGRAMSMsg # 22 of 44                   Date: Fri 25/07/1997,  8:36 am
From: GURU                       Read: 19 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Characters

Continuing our sortie into STRING territory...   (noone has complained that
this is going too fast  Smile



  Introducing to you another member of the variable family: This one is a
real character, you should really like him. Hes quite small, but don't look
down on him. Little brother of the STRING... please welcome...  CHAR!

  CHAR is short for "character" - what you probably think of as letters,
numbers, etc.  ie. the following are all CHARs:

                a    b    c    d
                A    B    C    D
                1    2    3    4
                ´    ø    ð    ñ
                etc...

  We tell the compiler that we are using chars in the same way we do STRINGS
(ie. with quotation marks). The difference is that instead of putting in
a whole line of text, we can only put in one character:

                MyChar := 'A';


  We declare (create) CHARs the same way we did for INTEGERs and STRINGs:

                VAR MyChar : CHAR;



  OK. Thats not too exciting. Things get more interesting when we use string
and chars together...  Make sure you understand the above stuff, 'cos now I'
going to go on and talk about some things you can do with strings and
chars...



  Addition
  --------

You can add any combination of strings and chars together to create another
string:

                MyString := String1 + Char1 + String2 + String3 + Char3;

Or whatever. The result is what you'd expect...

            eg. 'ABCDEF' + '12345' + 'x' + 'QWE' = 'ABCDEF12345xQWE'

Easy as...   Smile


  WRITELNing
  ----------

I've already shown you that you can WRITELN strings. Chars youk the same way

                WRITELN (String1, Char1, String2, Char2, Char3);

And, of course, you can put constants into the writeln:

                WRITELN ('The value of Char1 is: ', Char1, '!!!');


  Indexing
  --------

What this means is taking a part of a string out and turning it into a char.
If this sounds complicated, think about the following example:

        We have a string MyString which contains 'ABCDEFGHIJ'
        Imagine that for some reason we want to know what the 5th character
          in the string is...
        So, we _index_ the 5th character.

We use the square brackets [] to say that we are indexing, and we have to
include the number of the character we want to index between the brackets:

                MyChar := MyString [5];

 Using the above example, MyChar will now contain 'E'


Of course, we can reverse the process. We can change the 5th character of
the string to whatever we want...

                MyString [5] := 'x';

             or MyString [5] := MyChar;


And last of all, we could replacethe constant 5 with an integer variable:

                MyString [MyInteger] := MyChar;
             or MyChar := MyString [MyInteger];

(tryin' to confuse you here Smile    This is the sort of thing that will be
extremely useful when we talk about loops, etc... in a few posts' time.


  Lengths
  -------

One last thing: often you need to know how long a string is - that is, how
many characters it has in it. eg. the string

                'ABCDE'

has a length of 5.
To find the length of a string, we use (surprise!) the Pascal LENGTH command

                WRITELN ('Length of MyString is ', LENGTH (MyString));

             or MyInteger := LENGTH (MyString);

--------------------------------------------------------------
PROGRAMSMsg # 23 of 44                   Date: Fri  1/08/1997,  1:19 pm
From: GURU                       Read: 17 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Loops

Computers being computers, they are very good at doing lots of very booring
things very quickly. Well, now ya know how to do booring things (like adding
numbers, asking the user for their name, etc...), we have to look at how
to do it _lots_   Smile


  A LOOP is a piece of code that gets run over and over again.

  For example, if we want to write a number guessing game, we will want the
program to ask the user for his or her guess over and over again. This is a
loop.


  There are several ways of doing loops in Pascal, each one a little bit
different. The easiest is the FOR loop:

  FOR i := 1 TO 10 DO
    WRITELN ('Number', i);

  Where i is an integer variable.

  What this does is run the WRITELN bit over and over again...
  - First time, it makes i = 1, so we see
    Number       1
    on the screen
  - next it increments (adds 1 to) i, so i now = 2...
    Number       2
  - then it increments i again, and again, and again...  Smile
  - until i = 10...
    Number      10
  - Then it stops.

  So what we see in the end is:

    Number       1
    Number       2
    Number       3
    Number       4
    Number       5
    Number       6
    Number       7
    Number       8
    Number       9
    Number      10



  REPEAT
  ------


A REPEAT loop does something over and over again until some condition is
met...  for example, the user guesses a number correctly

        REPEAT
          { Stuff to repeat goes in here }
        UNTIL SomeCondition;

  Read through the following program, which is a number guessing game:


-----------------------------------
PROGRAM Guess;



USES CRT;



VAR Number : INTEGER;
    Guess  : INTEGER;



BEGIN

{ Lets make the number that the user has to guess 4 }
Number := 4;

{ Tell the user what to do }
WRITELN ('Guess the number (between 1 and 10)...');

{ Here's the loop: do this until the user guesses correctly }
REPEAT
  READLN (Guess);
UNTIL Guess = Number;

WRITELN ('Correct!');
END.
-----------------------------------


--------------------------------------------------------------
PROGRAMSMsg # 24 of 44                   Date: Mon  4/08/1997, 10:59 am
From: RASPUTIN                   Read: 17 times  [1 Reply]

     To: GURU                    Fwd From: :   No, not the confectionary treat
Subject: COLOURS.PAS  writeX('<tYe>Yellow text');

Hi Guru, in TRANSFER is COLOURS.PAS for you to look at.
You can see the HTML and Searchlight-colours influence, unfortunately i
combined the disadvantages of both, and ended up with the lowest common
denominator.

Basically: Use as Write and WriteLn, but accepts string argument only,
and converts imbedded colour-tags to TextColor and TextBackground equiv's.

Eg.: WriteX(  '<tYe>Yellow text <bBl>on a Blue background');
     WriteLnX('<tLr><bGy>Light Red on Grey<Xp>');
the <Xp> tag makes colours persist on exit, so to change to
Light Magenta on Grey you could WriteX('<tLm><bGy><Xp>');
instead of using Textcolor and TextBackground.

Have a look, and let me know what you think.
I'm gonna rewrite it in C soon, but I'm gonna start from scratch as it could
be much improved, any suggestions appreciated.

I was considering text stored as a (Pascal equiv.) an array of bytes.
 eg TextStr = array[1..160] of byte. This would hold 80 characters, and
their respective 80 attributes, in pairs, like this:
  for i := 1 to NumChars  do begin
    write character TextStr[ i *2 -1]   with attribute  textStr[ i *2];
    end;{for}

 I already have a working Pascal routine to write strings in this format
to screen, All i need is another routine to convert strings in WriteX
format to array_of_char_&_attribute format.  easy done.  What'd'ya
reckon?

More...  Poison  Remedy

--------------------------------------------------------------
PROGRAMSMsg # 25 of 44                   Date: Thu  7/08/1997, 11:14 am
From: GURU                       Read: 16 times

     To: RASPUTIN                Fwd From: :   No, not the confectionary treat
Subject: Re: COLOURS.PAS  writeX('<tYe>Yellow tex

>Hi Guru, in TRANSFER is COLOURS.PAS for you to look at.
>You can see the HTML and Searchlight-colours influence, unfortunately i
>combined the disadvantages of both, and ended up with the lowest common
>denominator.

OK I'll take a look   Smile
sounds like a good idea tho

>I was considering text stored as a (Pascal equiv.) an array of bytes.
> eg TextStr = array[1..160] of byte. This would hold 80 characters, and
>their respective 80 attributes, in pairs, like this:
>  for i := 1 to NumChars  do begin
>    write character TextStr[ i *2 -1]   with attribute  textStr[ i *2];
>    end;{for}

I don't quite understand why you want to store strings like this... it would
be fine for large ammounts of text, but there would be a lot of wasted space
if your program involved lots of strings like the "Yellow text on blue
background" example above...
  Still, if you wanna do it this way, you could use a TYPE definition to
hold the 'NumChars' and the 'TextStr' bits together, like so:

  TYPE Xstr = RECORD
         NumChars : INTEGER;
         TextStr  : ARRAY [1..160] OF CHAR/BYTE/whatever;  Smile
       END;

  Then declare variables of type 'Xstr':

  VAR MyText : Xstr;

  FOR i := 1 TO MyText.NumChars DO   etc...

(you may already know this ofcourse Smile  ... the C equivalent of the TYPE,
RECORD approach is called 'struct'

>More...  Poison  Remedy

Ya got the poison! Ya got tha remedy!
(Ya got tha Prodigy album Smile
Reply
#4
PROGRAMSMsg # 26 of 44                   Date: Thu  7/08/1997, 11:22 am

From: GURU                       Read: 18 times  [1 Reply]

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Conditionals

Last post I mentioned 'condition's, for the REPEAT UNTIL loop:

  REPEAT
    { stuff to repeat }
  UNTIL SomeCondition;


I didn't go into much detail on what this condition bit was, so I will do so
now. Its pretty straightforward...

  You can use any variable, constant, etc...  and any reasonable operator
such as "equal", "greater than", etc...

  eg.   UNTIL Guess = 5;

     or UNTIL MyString = 'QUIT';

     or UNTIL TotalLosses > 500;


  Also, you can use "AND", "OR", etc...  to link conditions together


        UNTIL (Guess = 5) OR (NumGuesses > 10);

     or UNTIL (Score > 1000) AND (Time > 10) AND (Lives = 0)

etc...   easy, eh?  Smile


The other thing I should mention here is how to do a part of your program
bassed on a condition. eg. "do this if such-and-such a thing...":

        IF Guess < Number THEN
          WRITELN ('Too low');


  All you need is     IF SomeCondition THEN
                        Stuff_to_do;

If the stuff to do takes several lines, you put a BEGIN END pair around the
stuff you want done:


   IF Guess < Number THEN
     BEGIN
     WRITELN ('Your guess was too low');
     WRITELN ('Try again');
     END;

--------------------------------------------------------------
PROGRAMSMsg # 27 of 44                   Date: Fri  8/08/1997,  1:08 am
From: RASPUTIN                   Read: 16 times  [1 Reply]

     To: GURU                    Fwd From: :   No, not the confectionary treat
Subject: Re: Conditionals

>Last post I mentioned 'condition's, for the REPEAT UNTIL loop:
>     or UNTIL MyString = 'QUIT';

I often use:
var
  Done: boolean;

begin
  Done := false;

  while not done do begin
  ...
  { if ReadKeyWord=kbEsc then Done:=true; or equiv.}

  end;{while}

I have a question...

When I'm testing for several conditions, eg:
if ((Cond_1 = true) OR (Cond_2 = true) OR (Cond_3 = true)) then
  DoSomething;
What I wannna do is along the lines of:
if (( Cond_1 OR Cond_2 OR Cond_3) = true ) then or something like that
  DoSomething;
Errm, I think I just answered my own question, oh well, it's another
example illustrating logic.







--------------------------------------------------------------
PROGRAMSMsg # 28 of 44                   Date: Mon 11/08/1997,  4:59 pm
From: GURU                       Read: 15 times

     To: ALL                     Fwd From: :   No, not the confectionary treat
Subject: Re: Conditionals

>I often use:
>var
>  Done: boolean;

Yup. Just like you can have STRINGs (for storing text), and INTEGERs (for
storing numbers), there is a variable for storing conditions  (see
Rasputin's thingi above Smile
  a BOOLEAN variable can hold either the value of TRUE or the value of
FALSE. You set it either by explicitly stating its value:

>  Done := false;

(tada) or by assigning the result of a condition to it:

Done := (UserResponse = 'QUIT');

And then you can use the boolean variable in any place where you could use a
condition (eg. IF, or REPEAT...UNTIL):

REPEAT
  { blah blah blah }
UNTIL Done;



-----

>if ((Cond_1 = true) OR (Cond_2 = true) OR (Cond_3 = true)) then
>  DoSomething;
>What I wannna do is along the lines of:
>if (( Cond_1 OR Cond_2 OR Cond_3) = true ) then or something like that
>  DoSomething;

You don't need the =TRUE bit...  IF checks that something =TRUE anyway  Smile

>Errm, I think I just answered my own question, oh well, it's another
>example illustrating logic.

Thats life for ya. Funny old thing

--------------------------------------------------------------
PROGRAMSMsg # 29 of 44                   Date: Tue 12/08/1997,  3:40 pm
From: GURU                       Read: 13 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Constants

You may've noticed I've been talking about/using constants in some messages
here... I'm just gonna do a quick post about them to explain things...

  Basically - you know about variables (eg. BOOLEAN (true/false), STRING
(text), and INTEGER (numbers))... they are places in memory that you can use
to hold something. and, they're VARIABLE - ie. you can change them.

  Constants are, like variables, places in memory to hold things. The only
difference is that you can't change them...

  CONST Number = 1234;
        SomeText = 'Hello, World!';
        BooleanThing = TRUE;

and you can use them in the same sorta ways:

  WRITELN (SomeText, Number);

Just remember that you can't change them... ie. you CAN'T DO THIS::

  SomeText := 'This is an error!';



So why use them...  its just convenient. For example, you can use them to
make error messages, etc...   the fact that they can't be changed means that
you can't stuff them up accidentally...

thats about it really. caio

--------------------------------------------------------------
PROGRAMSMsg # 30 of 44                   Date: Mon 18/08/1997, 10:32 am
From: GURU                       Read: 16 times

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: Pascal

So far I've covered

  VARIABLES - INTEGERs, STRINGs, and BOOLEANs
and stuff you can do with them (addition, subtraction, etc. of integers;
addition, lengths, etc. of strings)

  CONDITIONALS - IF condition THEN stuff

  LOOPS - REPEAT UNTIL condition;
          WHILE condition DO stuff;   (I'm not sure I specifically said
anything about this one, but I'm sure you can work it out Smile


That is (believe it or not) basically everything you need to know to write
simple applications and/or games involving user input and output. There are
several different things I can explain now. What do you guys want me to
cover?

  Uses of the above - ie. lots of examples of the sorts of things you can
do, etc...

  variables - there are lots more types of variables, including floating
point numbers etc...

  units - units are kind of like sub-programs. you need to know how to use
other people's, and how to write your own.

  display - writeln and company. There are many more display routines,
including cursor movement, and color changing

  files - how to read and write to/from files, so that you can save/load
information, modify files, etc...

  anything else you can think of...

--------------------------------------------------------------
PROGRAMSMsg # 31 of 44                   Date: Fri 29/08/1997, 12:21 pm
From: GURU                       Read: 17 times

     To: XLNC                    Fwd From: :   No, not the confectionary treat
Subject: Re: Pascal

>Im still lost as Noahs Ark.. I understood Interrupts were things set
>to check for a situation each clock tick. Never done anything in that
>field.

An 'interrupt' is the name given to some routine that (supposedly) can be
called at any time in an IBM-compatable PC. There are two major types of
interrupt - 'hardware' and 'software' - both are just routines that can be
called - the difference is _who_ or _what_ calls them...
  ie. Hardware interrupts are routines called by the hardware if the
computer - for example, the timer-tick interrupt is called 18.2 times every
second, interrupt 3 or whatever your modem is on is called everytime your
modem wants to do something, etc...
  Software interrupts tend to be Operating System or BIOS utilities - for
example, Ras' "change the typerate" program calls a BIOS interrupt ( I
think). DOS provides interrupts for writing things to the screen, reading
and writing things to files, etc...

Hope that is useful

--------------------------------------------------------------
PROGRAMSMsg # 32 of 44                   Date: Sat  6/09/1997,  5:07 pm
From: RASPUTIN                   Read: 18 times  [1 Reply]

     To: GURU                    Fwd From: :   No, not the confectionary treat
Subject: Re: Pascal

>>What do you mean probably? You're dead right there Guru, the fact that
>>there's only 10 bytes of executable code is only academic. (sigh).
>>It was 12 bytes when I did AH=.. AL=..., BH=, etc... but pared off a whole 
>>bytes by doing AX=.. BX=...  Proud of me? (Don't answer that <grin>).
>
>Wow... you're a ledgend  Smile
>if you've got anything like   mov ax, 0   in it, you can cut it down even
>more by using   xor ax, ax   (you're not the only one with an obsession for
>tiny programs Smile Another friend of mine spends more time cutting down the
>size of his programs than actually writing the in the first place...)

i remember that the first time I saw xor ax,ax (followed by mov bx,ax)
I stopped and thought, Hey! that's the same as mov ax, 0 (and mov bx, 0).
I wondered why they do that until one day I called up a mate with a program
i wanted to write with debug, and he dictated the code over the phone and
explained how it was quicker, and several other things.

BTW that's when I learned that there were two different ways a prog written
with Debug could read it's command line parameters. I did it an easier way
than the way Pascal & C do it.  DOS puts a upper-cased copy of the forst two
arguments somewhere between 0h and 100h in a COM file - at least that's how
it looked from debugs perspective.  I guess you know what I mean, is that
the Program Segment Prefix?



--------------------------------------------------------------
PROGRAMSMsg # 33 of 44                   Date: Mon  8/09/1997, 11:23 am
From: GURU                       Read: 15 times

     To: RASPUTIN                Fwd From: :   No, not the confectionary treat
Subject: ASM etc

>i remember that the first time I saw xor ax,ax (followed by mov bx,ax)
>I stopped and thought, Hey! that's the same as mov ax, 0 (and mov bx, 0).
>I wondered why they do that until one day I called up a mate with a program
>i wanted to write with debug, and he dictated the code over the phone and
>explained how it was quicker, and several other things.

I didn't know it was faster, just smaller (by one byte)... I learnt it off a
mate who's an ASM freak  Smile

BTW, a few weeks ago I learnt a really cool way to swap two things (say,
registers) around:

say we want to swap ax and bx:
   xor ax, bx
   xor bx, ax
   xor ax, bx
done. Now ax = what bx used to be, and bx = what ax used to be. Cool eh?

>BTW that's when I learned that there were two different ways a prog written
>with Debug could read it's command line parameters. I did it an easier way
>than the way Pascal & C do it.  DOS puts a upper-cased copy of the forst two
>arguments somewhere between 0h and 100h in a COM file - at least that's how
>it looked from debugs perspective.  I guess you know what I mean, is that
>the Program Segment Prefix?

Umm... Don't really know. I'm a bit of a fish outa water with ASM   Smile
Explainez moi...?

--------------------------------------------------------------
PROGRAMSMsg # 34 of 44                   Date: Sat 21/02/1998,  9:05 pm
From: THE FLASH                  Read: 11 times  [1 Reply]

     To: All                     Fwd From: :   No, not the confectionary treat
Subject: coding

Having been forced to write programs in C, C++, Pascal and Assembler I
can say that if you want really fast code you need assembler but it
takes forever and is a pain to write.

My recomendation for budding programmers is to use Visual C++, Visual
basic or any high level language that offers an IDE

The only down side to the modern visual stuff is the bloat code it
generates but a large HD 64 megs or more of ram and fast cpu will make
it run like assembler on an XT

On of my hobbies is microcontrollers and I have A DSP and 68hc705j1a
development kits to play with, The dsp is very cool but a right prick to
code for. The J1a's are real neet very fast and 2 bucks a shot.
---
 þ SLMR 2.1a þ All hope abandon, ye who enter messages here.

--------------------------------------------------------------
PROGRAMSMsg # 35 of 44                   Date: Wed 25/02/1998, 10:35 am
From: GURU                       Read: 9 times  [1 Reply]

     To: THE FLASH               Fwd From: :   No, not the confectionary treat
Subject: coding

 TF> Having been forced to write programs in C, C++, Pascal and Assembler
 TF> I can say that if you want really fast code you need assembler but it
 TF> takes forever and is a pain to write.

A lot of C compilers can optimise so you end up with almost the same
result as using an assembler with far less problems and you get to
use nice debugging tools. If you don't know what you're doing (eg.
if you're me Smile  , you _can_ actually be WORSE off writing in ASM.

 TF> My recomendation for budding programmers is to use Visual C++, Visual
 TF> basic or any high level language that offers an IDE

I wanna give some of them a go. Especially since Windows 95 is suposed
to have something called DirectX graphics or whatever, which means you
can do everything you always wanted without reading all the manuals on
how to program videocards   Smile   Since a great deal of the programming
I have done has been graphics code that I wish someone else had written
for me, this way of doing things sounds like a great boon.

 TF> The only down side to the modern visual stuff is the bloat code it
 TF> generates but a large HD 64 megs or more of ram and fast cpu will make
 TF> it run like assembler on an XT

Unfortunate thing about technology. Things get faster. They also get
easier to use. Which makes them bigger, and they run slower. So things
have to be made faster again to make up for it. Strangely enough the
standard BBC, Z80, and C64 lasted years, with the games getting better
and better, but the computers remaining the same. Now, you have to replace
your computer every month or so to keep up with the latest games.

 TF> On of my hobbies is microcontrollers and I have A DSP and 68hc705j1a
 TF> development kits to play with, The dsp is very cool but a right prick
 TF> to code for. The J1a's are real neet very fast and 2 bucks a shot.

Ras is the man to talk to for all your electronics guff. He might actually
understand what you're going on about   Smile

___ Blue Wave/386 v2.30 [NR]

--------------------------------------------------------------
PROGRAMSMsg # 36 of 44                   Date: Wed 25/02/1998,  8:03 pm
From: THE FLASH                  Read: 11 times  [1 Reply]

     To: GURU                    Fwd From: :   No, not the confectionary treat
Subject: coding


GU>A lot of C compilers can optimise so you end up with almost the same
GU>result as using an assembler with far less problems and you get to
GU>use nice debugging tools. If you don't know what you're doing (eg.
GU>if you're me Smile  , you _can_ actually be WORSE off writing in ASM.

You can get some good compiler like Dunfield C but if you want the best
and fastest you need to write in assembler, Size is very important in
this case as all compilers pad the files, when you want to stick your
code in the boot sector or file allocation table you need to use
assembler.

---
 þ SLMR 2.1a þ Kiss my arse, You may learn to like it.

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

PROGRAMSMsg # 37 of 44                   Date: Sat 28/02/1998,  3:10 pm
From: GURU                       Read: 12 times

     To: THE FLASH               Fwd From: :   No, not the confectionary treat
Subject: coding

 GU>A lot of C compilers can optimise so you end up with almost the same
 GU>result as using an assembler with far less problems and you get to
 GU>use nice debugging tools. If you don't know what you're doing (eg.
 GU>if you're me Smile  , you _can_ actually be WORSE off writing in ASM.
 TF> You can get some good compiler like Dunfield C but if you want the
 TF> best and fastest you need to write in assembler, Size is very important
 TF> in this case as all compilers pad the files, when you want to stick
 TF> your code in the boot sector or file allocation table you need to use
 TF> assembler.

True, it depends on what you're doing. A good example is ye olde
"Hello World!" program, which is a matter of bytes in ASM, but
can be HUGE with modern compilers, which might include all sorts
of things like going into Protected Mode, etc...
  Some of the optimisations, however, are things like alignment to
page boundaries, avoiding pipeline stalls, etc. In a lot of cases
a good compiler could do this just as well as any human could with
ASM, but would make it considerably easier. If you weren't an
absolute wizz at ASM, you could quite possibly do a worse job than
the compiler would.
  And yes, size IS very important   Smile

___ Blue Wave/386 v2.30 [NR]

--------------------------------------------------------------
PROGRAMSMsg # 38 of 44                   Date: Thu 18/03/1999, 12:53 am
From: GURU                       Read: 14 times  [2 Retorts]

     To: RAS
Subject: Re: PIC available overnight for $15.

>Sparqz, Guru...
>
>Guru: Let me know what spec is guiding your choice of micro.
>Have you a preference for Motorola (eg. HC11), Intel (eg. 8051, 80106),
>Check out Atmel's flash micro's too.
>

Coolies. Hey sorry about not getting back to you on the electronics
discussion. Went to exit chat. Thinks me: "ALT-C started chat, will prolly
stop it too... I think this button is 'C'"

Aimee, BTW (for those unenlightened), has switched all her keytops around.

"Hmm, that didn't work. Try the key next to it. Nope. What about the key on
the other side of that one? Nope... Shit. Where did the board go.
Aimee...?!!"

Ummm... yeah. Oops. How to end a conversation with style. And make the sysop
pissed off at you in the process   Smile

Anyway. The plan was work out the sort of program the robots would run, then
start to think about how this could best be done. Your PIC doesn't sound too
bad at all... it'd be pretty easy to run two or three of 'em together which
would provide heaps of power (more than enough if the brain could cope with
programming 'em).

In one of our 3rd year electronics labs we used Mac derivative chips which
sound like a slightly more expensive version of your PICs. What I liked
about them was the development kit they had with them. Emulation software
which interpreted the program you wanted to burn into the chip, then used
the parallel port to output to a 'dummy' chip. So basically instead of
burning a chip and putting it into the curcuit, you attached up this 'dummy'
chip, ran the software on the PC, and everything ran. If there was a
problem, you edit the program and have the whole lot going again before you
can blink with no need to burn. So you could perfect the program and then
finally burn the chip when you're done. Cool.
Reply
#5
PROGRAMSMsg # 39 of 44                   Date: Tue  6/04/1999,  8:52 pm

From: RAS                        Read: 13 times  [1 Reply]

     To: AIMEE                   Fwd From: Here to piss off the music ppl ;> H
Subject: Re: Windows CD player

>>  - 'grep' (yay UNIX commands) searches text files for things
>
>What, you've got a problem with "For %%f in (*.*) do find "text" %%f" ? ;>

Is that DOS? From prompt or in Batch file? Is it another dos enhancement?
BTW: Obfuscation award of the week to Aims.

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

PROGRAMSMsg # 40 of 44                   Date: Wed  7/04/1999,  4:48 pm
From: RAS                        Read: 8 times

     To: GURU
Subject: Re: PIC available overnight for $15.

>>Guru: Let me know what spec is guiding your choice of micro.
>>Have you a preference for Motorola (eg. HC11), Intel (eg. 8051, 80106),
>>Check out Atmel's flash micro's too.

Motorola: I just read that The Flash uses mc68hc705j1a (hc05) micros.
You could ask him what development kits cost, and what the micro itself
would cost.  They're industry relevant too. As are hc11. $130 for dev. kit
at Hutt Valley polytech.

Zilog: Dick Smith list the Z-80A (4MHz 8-bit CPU) at $3.95
(but they say it's an 8-pin package, which doesn't sound right...)

Microchip: PIC16f84 has FLASH program memory, plus some EEPROM.

You could even plug your robot into the parallel port antil you had an
idea what sort of things you wanted your hardware (motors, sensors...) to
do, then replace PC with PIC. Program PIC In-System too!.

>Anyway. The plan was work out the sort of program the robots would run, then
>start to think about how this could best be done. Your PIC doesn't sound too
>bad at all... it'd be pretty easy to run two or three of 'em together which
>would provide heaps of power (more than enough if the brain could cope with
>programming 'em).

Multiple PICs is definitely an option. There's an 8-pin OTP PIC
called PIC 12c509, with internal RC Osc. and 6 I/O pins,
1 microsecond instruction time, running at 4MHz, 1 Timer + WatchDog Timer,
and apparently it's dirt cheap. (A coupla bucks in quantity to mfgr's).
Just looked it up: $5 each from Farnell.

>about them was the development kit they had with them. Emulation software
>which interpreted the program you wanted to burn into the chip, then used
...
>problem, you edit the program and have the whole lot going again before you
>can blink with no need to burn. So you could perfect the program and then
>finally burn the chip when you're done. Cool.

MPSim is a PIC Simulator. (See MicroChip website).
I have seen Emulators advertised too.

Tho of course, at risk of nauseous repitition, the 'f84 has FLASH memory,
which is good for about a million burn cycles (In-Circuit, no eraser).
You could even use the f84 to test code before burning it into a 12c509.

I must photocopy some of my notes and mail 'em to you.
I'm currently making myself another programmer, and own development kit.

--------------------------------------------------------------
PROGRAMSMsg # 41 of 44                   Date: Wed  7/04/1999,  5:17 pm
From: RAS                        Read: 7 times

     To: GURU
Subject: Robotics is easy and fun!!!

>Anyway. The plan was work out the sort of program the robots would run, then
>start to think about how this could best be done.

At my current polytech (CIT -Heretaunga) there's a display board up with
this annual competition, where they unveil a maze that your 'mouse' must
navigate. The maze construction is fully standardised, but the actual
pattern is a surprise every year. There are a few photo's up, of some
robot-mice and the maze, and the rules etc...
Remind me to take note of the website for you when I go back to tech in two
weeks.


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

PROGRAMSMsg # 42 of 44                   Date: Mon 12/04/1999, 11:16 am
From: AIMEE                      Read: 5 times  [1 Reply]

     To: RAS
Subject: Re: Windows CD player

>>>  - 'grep' (yay UNIX commands) searches text files for things
>>
>>What, you've got a problem with "For %%f in (*.*) do find "text" %%f" ? ;>
>
>Is that DOS? From prompt or in Batch file? Is it another dos enhancement?
>BTW: Obfuscation award of the week to Aims.

It's a normal Dos command :>  I use the IF statement in most of my batch
files for the board... like .. IF %%1=node1 then run the drop file for node
1 for the game :>

It works quite well, but in the Win ver of SL5 it doesn't like batch files.
*sigh*

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

PROGRAMSMsg # 43 of 44                   Date: Sat  1/05/1999,  4:49 pm
From: RAS                        Read: 7 times

     To: AIMEE
Subject: Re: Windows CD player

>>>>  - 'grep' (yay UNIX commands) searches text files for things
>>>
>>>What, you've got a problem with "For %%f in (*.*) do find "text" %%f" ? ;>
>>
>>Is that DOS? From prompt or in Batch file? Is it another dos enhancement
>>BTW: Obfuscation award of the week to Aims.
>
>It's a normal Dos command :>  I use the IF statement in most of my batch
>files for the board... like .. IF %%1=node1 then run the drop file for node
>1 for the game :>
>
>It works quite well, but in the Win ver of SL5 it doesn't like batch files.
>*sigh*

At tech the Novell networks in NT4 give us so much grief...
(Only 'cause they're not set up properly) so DOS is like a real relief.
In a DOS box you can get the pc to perform...

btw they protected the system (during the break) from any modifications we
used to make... but for some reason allow us to fiddle with the registry.

--------------------------------------------------------------
PROGRAMSMsg # 44 of 44                   Date: Sun  9/05/1999,  5:20 am
From: BLOODSWORD                 Read: 2 times

     To: RAS
Subject: Windows CD player

 >It's a normal Dos command :>  I use the IF statement in most of my batch
 >files for the board... like .. IF %%1=node1 then run the drop file for node
 >1 for the game :>
 >
 >It works quite well, but in the Win ver of SL5 it doesn't like batch files.
 >*sigh*

 Ra> `[1;35mAt tech the Novell networks in NT4 give us so much grief...
 Ra> (Only 'cause they're not set up properly) so DOS is like a real
 Ra> relief. In a DOS box you can get the pc to perform...

 Ra> btw they protected the system (during the break) from any
 Ra> modifications we used to make... but for some reason allow us to fiddle
 Ra> with the registry.`[0m

Whitireia was in it's prime before the break, you couldn't do SFA...
Smile they'd put the most harshest policies (using policy editor) in
place, and had disabled regedit... Smile bastards... couldn't do
anything, most of the files were held on the remote server, so
therefore, you had to use the network stuff... I didn't want to go
hacking it. I value the $$$ I gave to them so they could teach me how
to do it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)