Welcome to the first issue of "The best of Pokey...

"The menu: Use the cursor keys or joystick to select the text you want to read. If you press the fire button or the return key you will get back to the main menu. Press the 'H' key for more information.

Articles: In this magazine you will find articles for programmers, game freaks and hardware freaks. A part of the selection of articles has been published before on Pokey Magazine and the ANG Magazine. Other articles are new and will appear as well on this as on ANG Magazine.

This month you will find on this magazine:

-Turbo course How to program in Turbo Basic
-Machine code for beginners Speaks for itself
-Packers & crunchers First steps into reducing data
-Sampling theory What is sampling and what can you do with it?
-The making of video games What you should know and what to do
-Game tips & hints Finally that one code word
-Mailbag Readers mail from all over Europe
-Issue special This time it's about sorting data

This issues contributors:

John Maris (TML)
Erik Stok (TCC)
Freddy Offenga (Frankenstein)
Fred Meijer
John aan de Wiel

Of course we would very much appreciate your articles and programs. If we use them for our magazine we will reward you with ANG credit notes.

I hope you will enjoy reading the articles, using the programs and of course playing the commercial game on the a-side of this magazine.

I would like to notify you that the texts on this magazine are translated from Dutch to English. This is being done by TCC who's from Holland too, so it's very likely a lot of weird English will appear in some articles. We hope you'll understand, after all it's the information that counts, not the art of language. If it really irritates you we are always willing to hear your comments.

See you next month!

John Maris


This part is empty now, but if we could help it it would be the biggest article in the whole magazine. Here you can ask all questions concerning the Atari 8-bit computer. Whether it's about solving a game, programming techniques, sampling, music software, applications, ANG products, etc. We'll do our very best to answer your questions.

Also you can advertise in this articles. You would like an international contact, you would like to buy something, sell something? Send in your advert an it'll be automatically put on next issue and on ANG Pokey Magazine. All this is of course free for all subscribers of this magazine.

Atari news

We can still brings you latest news from the Atari scene. This month there's news from Germany, Holland and Poland.

Klaus Peters
On the JHV in Herten I saw the prototype of the Speedy XF551. The Speedy for the XF551 is probably, against all expectations, 100% compatible with the Speedy 1050. Next to that the Speedy has more capabilities specified for the XF551. All densities (even quad) can be used under ultra speed. Extra in Speedy XF551:

Setup in ROM
Cache memory for directory and boot sectors
Copier (quad compatible) in ROM
32 kb RAM (1050 has 8 kb)

Unfortunately some soldering has to be done if you want to use a Speedy in your XF551. The price of the Speedy (which will be released half November 1993) will in Germany be about 179,00 DM. Maybe for Holland (and ANG Magazine readers) there will be a slightly better price.

Strange invasion
A German (lingual) Public Domain disk magazine. Everybody who is willing to pay 5 DM (including postage) can contact:

Stefan Lausberg
Korchstrasse 58
70559 Stuttgart

In the magazine you can expect:
Assembly course
Programming display lists
ARGS hardware
Powersoft advertisement (ANG Germany)
Questions and answers
Exodus zum roten Planeten (science fiction story)

ANG Holland
This month (november 1993) there were several new software products released. That is:

Special forces (Operation Blood II)
Battle Ships
Bang! Bank! (available again)
Sound Tracker Player (European version)
Hans Kloss (available again)
Deimos (very good Montezuma clone)
Drop it 3d color Tetris
Dark Abyss (shoot 'em up)
Neron (platform game)

ANG made several agreements with Mirage from Poland. We now have the rights of nearly all Mirage products. Programs which are not finished yet but soon will be issued in Holland and Poland are:

Music Pro Tracker (4 channel editor with digi sounds)
Tommies (Lemmings)
Top Secret

All titles will be available soon for the normal ANG prices which are for England about 4.50 English Pounds. Very short news this moths because next month we will get back at several products mentioned.


Welcome to the first part of Pokey's Turbo basic course.

This part we will discuss:

1. What is basic?
2. What is a basic program?
3. The 'GOTO' instruction.
4. The 'PRINT' instruction.
5. The 'END' instruction.

What is basic?
Basic is a language which is quite easy to understand for both computer and human. Humans communicate with words, a computer only understands two conditions: 0 and 1. Basic is a sort of interpreter between human and computer. Of course it is known that talking via a interpreter always slows down conversation.

What is a basic program?
A basic program is a list of commands which can be executed by the computer. These commands are in a specific order. This has to be done otherwise strange things would happen. When you, for example, would like to learn a child how to cross the street, you would have to give the kid a list of commands. These commands also have a significant order. First look, then cross the street.

A list of commands could be something like this:

1 Walk to the side of the road
2 Look right
3 Look left
4 Look right again
5 if there is no traffic approaching from both sides, cross the street
6 if there is traffic approaching from one of both sides the go to
point 2 of the list

A long as this list can be used everything will be okay. A basic program is just like this list.

Basic lines also have numbers so you can easily 'move' in the program (like in line 6 of the example). This brings us to the first instruction.

The 'GOTO' instruction
GOTO can also be written as GO TO.

Normally the computer executes the program line by line. First line 1 will be executed, then line 2, etc.

With the GOTO instruction we can change this order. Look at the following example.

1 execute command x
2 GOTO 4
3 execute command y
4 quit this program

In this example command y will not be executed. The computer executes command x, comes to line 2 and sees it has to continue at line 4. Line 3 is skipped.

The 'PRINT' instruction
The PRINT instruction enables us to put something on screen. Texts which have to be printed on screen literally have to be between quotes (").

The program
1 PRINT "Hello"

This shows on screen


In stead of PRINT we are also allowed to use the question mark (?). The program also could have been like this:

1 ? "Hello"

The function of , and ;
The ','
Every time the computer executes another PRINT command it start at a new line.

1 PRINT "Hello"
2 PRINT "Peter"

Will show on screen


The program
1 PRINT "Hello",
2 PRINT "Peter"

Will show on screen

Hello Peter

Because of the comma behind the first PRINT instruction the computer does not start at a new line but a bit behind last PRINTed text.

The ;

The program
1 PRINT "Hello";
2 PRINT "Peter"

Will show on screen


Because of the ; behind the first PRINT instruction causes the computer to print directly behind the first PRINTed text.

The program
1 PRINT "Hello",
2 PRINT "Peter"
3 GOTO 5
4 PRINT "Hello";
5 PRINT "Eric"

It shows us clearly what we've just discussed.

The program will first print 'Hello' (line 1). A bit behind that the program will print 'Peter' (line 2). In line 3 the computer is told to GO TO line 5. In line 5 the computer is told to print 'Eric' on a new line. In line 4 there is a ; behind the PRINT instruction, but because of the GO TO command the computer does not know what had to be done in line 4.

The 'END' instruction
I will discuss this instruction briefly. If the computer find an END instruction, it will simply stop executing the program.

1 PRINT "Pokey"
3 PRINT "Atari"

In the program above the computer will stop at line 2. The text 'Atari' will not appear on screen because line 3 is never executed.

For everybody who wants to start programming a bit after all this I will discuss 2 more instructions briefly.

If you want to enter a new program., first type NEW and press RETURN. This instruction clear the computers memory so no old program information, which will cause problems, remains in memory. If you have entered a program and you would like to execute it, type RUN and press RETURN.

I can advice everybody to practice a bit what has been discussed this lessen.

Until next part of the Turbo Basic

Machinecode for beginners

I can hear you thinking: 'Oh no, another machine language course?' The answer is: 'Yes indeed!' First I'll explain why programming is so important.

If a computer is successful or not depends a great deal on the software available for it. That's why it is important new software is developed for your own computer. New software puts new life in to using the computer. Without programmers there is no new software, and so we need a few programmers!

A second reason is programming can be, if you're interested, a lot of fun! You define a problem, create software and solve it. It's just like a jigsaw puzzle, only programming needs a bit more learning.

We would like to pay attention to programming each issue. We will not discuss instruction by instruction because other courses have already done that. This series of articles will be about programming your Atari 8-bit and will have the following subjects:

Use of ram disk
Use of DOS
Memory map
ROM routines
And so on

This issue, this first 2 subjects will be mentioned.

Part one:
To be able to program in assembly you'll always need a utility. This can be: basic (machine code in data lines en poking it in to memory), a monitor (entering machine code directly) or an assembler.

The first two options we won't even mention any further because nobody can work with that. We focus on the assembler. An assembler convert 'text' or 'source' to a machine code program. The power of the assembler lies in:
-you can put as program in any part of the memory
-you can insert instructions, use labels
-use macros (standard routines)
-work fast
-program structured

The how and what will be discussed later on. The assembler most used are:
-Atmas II
-130xe assembler (shareware)
-Assembler editor

Of course there are a lot more assemblers, but those are the ones most used. Programmers from Holland use the following:

Erik Stok (TCC) - Mac65
John Maris (TML/ANG) - Mac65
Freddy Offenga (HTT/Megazine) - ST65, Atmas
Yeb Havinga (HTT) - 130xe, Atmas
Arjan Slaager (Alphasys) - Biboassembler
Ivo van Poorten (The Gatekeeper) - Atmas, Mac65
Kaj de Vos - Mac65, ST65
Jack de Bruijn - Mac65

Every assembler has it's (dis)advantages. We will not see which assembler is good and which is not. Mac65 seems to be rather popular. Because most people have this assembler, we will use this assembler for this article (that I also use it and that I'm too lazy to convert programs to other assembler is also a very good argument of course).

An assembler (on Atari 8-bit) usually consists of 2 elements. The editor and the assembler. The editor is used to enter for us readable commands in the computer so it can convert it to machine code (assemble) it with the assembler. If we take a look at the program we see why we should be glad we have this editor. Take a look at a source file. Use a DOS command (copy file.ext, S:) to view this file. As you can see it makes no sense. That's what the editor is there for.

Part two:
In this part we take a short look at the Mac65 and we take a look at the memory of the Atari 8-bit and how it works with numbers.

The mac65
MAC65 is a Macro Assembler which was made and published by OSS. The assembler is available on cartridge but not in Europe. If you would like to buy an original, you'll have to get it from America. The MAC65 and the 'Machine code for Beginners' is for 90% compatible with the Assembler Editor.

Mac65 mini manual
As mentioned before we'll not discuss how assemblers work. But we'll give you a few mac65 commands:

NUM (START, STEP) Auto line number on. Put off by pressing BREAK.
RENUM (START, STEP) Renumber the listing.
LIST (FROM, TO) List the program on screen.
SAVE #D:FILE.EXT Save listing to disk.
LOAD #D:FILE.EXT Load a listing from disk.
ASM,,#D:FILE.EXT Assemble a file to disk.

A bit a mathematics
Programming a computer requires a bit of calculating. For those who do not have a certain degree of mathematics, we'll explain some important things. If you know how the decimal system works and you know how powers work then you can skip this part, but it might refresh things too.

A number consists of several figures. These numbers represent a certain value. Let's take a look at the number 6452. Everybody knows what number it represents.

If we take a close look of how this number is constructed:

4X 100
5X 10
2X 1

Or from right to left:

2X 1
5X 10
4X 100

This is quite clear. In our normal system we have ones, tens, hundreds, thousands etc. Every time a 0 is added. To get to the mathematics point of view we have to know how to calculate powers. I'll try to explain how it works.

The notation for powers on the computer is:


This means the third power of 2 (3 time 2 multiplied). You can write it like this: 2X2X2=8.

2^5 equals 2X2X2X2X2=32
5^2 equals 5^5=25
6^3 equals 6X6X6=216

You might have noticed that with the 6^3 a six is used 3 times, with multiply sign between them. That's the way to work with powers.

Given is the following rule: if the power is 0, it always gives 1. So:


If the power is 1, it always gives the number under the power:


Now we'll check if you understand what I have explained to you. The solutions can be found later on in the article. Calculate these numbers and see if you did it correctly. If so, I congratulate you, because you understand powers. If not, read the text about powers again and try to find where you went wrong. If it keeps going wrong, send us your calculations and we'll explain what went wrong. You can also ask somebody you know who does understand powers.

Try this:

The solution.


You understand powers. We'll get back on this later...

The memory of the computer
Our computer has 64kb Ram. One kb (kilobyte) represents 1024 bytes. A byte is nothing but a compartment in the memory of the computer where you can store a number. Of course you can also take a look at a byte what number it is. Such a compartment is called an address. Every address in the computer has it's own number. Because we have 64kb in our computer we have 64x1024 addresses in our computer. That is 65536 addresses. These are numbered 0 to 65535.

In practice we see that we cannot use all addresses for our programs because the operating system takes up 14kb and DOS also uses a piece of memory. There are a lot of tricks to still use these parts of memory, but for beginning programmers we'll say it's occupied. Normally you are able to use address $2000 to $BFFF. The numbering $2000 and $BFFF will be explained later on.

The memory of the computer really consists of switches which can be in two states: ON or OFF. In practice we can put a switch off (=0 state) or on (=1 state). Every switch can be 0 or 1.

These are actually the only numbers the computer works with. In the earlier part we discussed addresses. An address consists of 8 switches. We'll call the switches 'bits' from now on. Every byte (or address) consists of 8 bits. That's why we call our Atari an 8-bit computer.

If we take 8 bits, we can make 256 different combinations with those bits. Take a look at this:

1 bit = 2 combinations:

2 bits = 4 combinations:

3 bits = 8 combinations:

I could go on until we see that with 8 bits 256 combinations can be made, but it can be explained with use of powers (here they are):

1 bit gives 2^1 combinations
2 bits give 2^2 combinations
3 bits give 2^3 combinations

We check that:

2^1=2 (1 bit, 2 combinations)
2^2=4 (2 bits, 4 combinations)
2^3=8 (3 bits, 8 combinations)

So far it all works with numbers I showed you. If 1 bit gives 2^1 combinations, and 2 bits give 2^2 combinations, 8 bits could give 2^8 combinations.


Check it yourself by calculating the eighth power of 2.

So every address can hold a value from 0 to 255 (0 to 255 is 256 combinations, right! Don't forget...). The value (or contents) of an address depends on the values of the switches of the byte. Since every bit can be 0 or 1, the byte can be written like this:


8 times a 0 or 1 with a % in front of it. The %-character tells us the number is a binary number (binary means two states). For us binary number are difficult to read, because we are use to decimal numbers. It is important to get to know binary numbers. In the beginning you will not use them very often, but these numbers are the only way to recognise the bit pattern of a byte. A simple example where we need the bit pattern of a byte:

Take a look at the characters on the screen. The shape of these characters is stored somewhere in the computers memory. We would like to change the shape, so we have to change the bit pattern in memory. For characters this can be done quite simple if we take a look at bit patterns. Let's for example take a look at the 'A' character. A character consists of 8 bytes and the 8 bytes of the 'A' are like this:


The '-' means 0 and the 'x' means 1. By changing the addresses where these
bits are located we can change the shape of the 'A'. If we would have
done this via decimal numbers we never would have seen the shape of
the 'A'. The decimal values of the bytes above:


We would not recognise an 'A' in these numbers, but we do recognise it in the binary numbers! There are more reasons for knowing how binary numbers work, but I won't mention them here. By now you might have noticed a binary number can be replaced by a decimal equivalent. Glad so, because working in binary numbers only would be very difficult.

Binary to decimal conversion
As mentioned before a byte consists of 8 bits which can al be 0 or 1. To convert a binary number to a decimal number, we should work like this:

% 0 0 0 0 0 0 0 0
x x x x x x x x
128 64 32 16 8 4 2 1

Add all numbers and given example represents 0 (because 0x128 + 0x64 .... + 0x1 = 0).

% 0 1 0 1 0 0 1 1
x x x x x x x x
128 64 32 16 8 4 2 1

Add all numbers and given example represents 64+16+2+1.

%01010011 equals 83.

The number 1, 2, 4, 8, 16, 32, 64, 128 are not just chosen of course. There is some logic behind that. A binary number has 2 state figures: 0 and 1. So you have 2 possibilities for each figure. We use powers

2^0= 1
2^1= 2
2^2= 4
2^3= 8
2^4= 16
2^5= 32
2^6= 64

On the right we see the numbers mentioned before: 1, 2, 4, 8, 16, 32, 64 and 128. On the left we see a 2 every time. In the middle we see the numbers 0 to 7. These are the so called bit positions in the byte. In a binary number the bit position 0 can be found at the most right and position 7 can be found at the most left. A bit strange, you look from right to left:

Bit position 76543210
number %00000000

The calculate the value of every bit, we'll have to use powers again. Let's put the bit on top of each other and add all values:

0x(2^6)=0x 64= 0
0x(2^5)=0x 32= 0
1x(2^4)=1x 16= 16
1x(2^3)=1x 8= 8
1x(2^2)=1x 4= 4
0x(2^1)=0x 2= 0
1x(2^0)=1x 1= 1
--- +
%10011101 157

Maybe a short explanation will clear some things up. Our decimal numbers work with 10 figures (0 to 9). Binary numbers use 2 figures (0 and 1). To convert a decimal number to a binary number we have to do the same as with binary to decimal. Here we also read from top to bottom and use powers. Only now it's a power of 10 we use, because of the 10 figures of the decimal number.

3429, a decimal number:
3 is on position 3
4 is on position 2
2 is on position 1
9 is on position 0

4x(10^2)=4x 100= 400
2x(10^1)=2x 10= 20
9x(10^0)=9x 1= 9
---- +

Now try to convert the following binary numbers to decimal numbers:


The answer are near....


Decimal to binary
To convert decimal numbers to binary numbers we have to reverse the process. First we take a look if we can subtract 128 of the number. If that's the case the bit will be set to 1, if not the bit will be 0. If we can subtract 128 we continue with the result and try to subtract 64, and so on If 128 could not be subtracted, we try to see if we can subtract 64, and so on.

An example with the number 212:

212 - 128 = 84 bit is 1
84 - 64 = 20 bit is 1
20 - 32 = <0 bit is 0
20 - 16 = 4 bit is 1
4 - 8 = <0 bit is 0
4 - 4 = 0 bit is 1
0 - 2 = <0 bit is 0
0 - 1 = <0 bit is 0

If we put the 0's and the 1's (from top to bottom) behind each other we get: %11010100

We check by going back to decimal:

1x 64= 64
0x 32= 0
1x 16= 16
0x 8= 0
1x 4= 4
0x 2= 0
0x 1= 0
--- +

Everything seems to be okay! You now know how binary numbers work. Try to practice a bit on paper with some numbers. Decimal to binary and the other way around. It may seem useless, but it'll come in handy soon!

Next issue we'll calculate a bit more....

The Missing Link

The making of "VIDEO GAMES" part 1

Welcome to part 1 of this series. In this series I would like to tell you what it takes to make a "VIDEO GAME", what sorts of games there are, how they are developed, etc.


Computers can be found in several different forms. They are used for word processing, process control, computer animation and simulation, graphics (CAD/CAM), music and entertainment. Entertainment is often not taken seriously and Atari itself thinks it has destroyed the image of nowadays Atari computers (ST/PC). For me it's like this: if a computer can be used for playing games, it can also be used for other purposes.

Yes, XL/XE has still got the image of "game computer". Anyway, we all know the Atari is a good computer for video games but we also know the Atari is also good for all other purposes mentioned above.

A bit of history

18 years ago the American Nolan Bushnell developed one of the first game computers which was a big success in the commercial circuit. It was a very simple game, but the success wasn't less because of that. This game was called "PONG". Later Bushnell decided to start his own company for developing and producing VIDEO GAMES (including hardware). Maybe the name of the company sound familiar: ATARI!

ATARI started to produce simple TV games. A game was a complete machine, with inside a chip with the GAME on it. For other games, other machines, with different chips, were needed.

Then Atari made (in 1978) a revolutionary product: the VCS (Video Computer System). This machine was a square box, with a micro processor in it, with several switches. The instructions for the micro processor were stored in a small separate box (a cartridge). This was THE solution. The VCS was only bought once, and several cartridges could be bought if different games were desired. The VCS became a big success. Also other companies (Activision!) started to develop software for this system. And yes, competitors appeared: Audio Sonic and Phillips. In Holland their systems were available earlier than the ones of Atari. The amount of software for the systems increased and the systems themselves were improved to. In 1983 Atari issued the VCS 5200 and a few years later the VCS 7800 was made. In the mean time people already had home computers.

The first computer freaks were born and software houses were established. First software for the Atari 8 bit was made on cartridge of course. Later on cassette software was made, and much later software on disk was being sold too. Nowadays the disk drive can't be missed. It is said in America software is sold on floppy disk only, while in Europe people are still running around with cassettes. Who's got an explanation for that?

With the introduction of the home computer everybody had the ability to create their own games. Take a look at the public domain software of a computer club. The quality of those games varies from very bad to very well. But home programmers often do not own the 'TOOLS' of the 'PROFESSIONAL' game programmers and that's why developing a game takes a lot more time for them.

Different sorts of games

Of course I cannot give you a list of all sorts of existing game types. I give you a list a the main types. Games can be a mix of several types.

- Text adventure
- Simulators
- Thinking and board games
- Strategic games
- Arcade action

The first four I'll discuss briefly. Arcade action will be discussed thoroughly in the following parts of this series.

Text adventures

This type has 3 forms:

- Text adventure (just text)
- Text adventure + pictures
- Text adventure + animation

A text adventure always has a goal and when it's achieved, the game is finished and fun is gone. text adventures try to create a certain atmosphere by describing things with text. Everything can happen in a realistic world, or in complete imagination, everything is possible. If the creator of the game think all figures in the story have three legs in stead of two, that's possible! It all depends on imagination and creativity of the game creator. Two examples of a text adventure are below. First shows us a realistic atmosphere, second shows us a fantasy world.

'In front of you you see a big building with a parking lot. The building is surrounded by a big metal fence with sharp points.'

'Next to the hollow tree a goblin with a dangerous big knife is standing. It looks like you're not wanted here. You see something blink at the entrance of the tree.'

As you can see the game invites you to explore the game further. By typing words as 'climb fence, jump, talk, talk to goblin' or by simply typing a direction you want to go (north, east, south, west) you can tell the program what you want. The program acts on that. The more the program understands what you want, the more fun (and more complex) the game is.

A text adventure is full of puzzles. In first example you can ask yourself how to get in the building, how to climb the fence, etc. The program can help you by telling if it's possible or not. It can also give you a tip. Something like 'good idea, but I wouldn't do that with all those sharp points'. This should make the player think. Maybe the points have to be removed with the saw found earlier in the game? It is possible you find objects in the game that can be picked up, or used. Maybe you find a ladder so you can get passed the fence. Maybe it's all a distraction and it's not needed to climb the fence?

To help the player imagine the atmosphere of the game pictures can be included in the game. These pictures appear at certain points in the adventure so the player gets a better impression of the situation the player approaches. A real adventurer always makes a map of where he has and hasn't been.

To show the player some more than just text and pictures it's also possible to animate the leading person (that's you of course) as a little character on screen so it looks if the person is really in the described and drawn situation. It's not to be confused with arcade games, where monsters attack you etc. Some adventures are starting to look like that, but the difference is the action missing in the adventures.

Well, this already is the end of part 1. I hope it's all a bit clear to you. Next time we'll continue with the other types of VIDEO GAMES. See you than!

The serious game freak

Sense and non-sense about packing

A series of articles about a popular item: packing!

This issue will start simple. We'll see what packing really is and what we can do with it. We'll pack data files.

A data file can be anything, as long as it's not a program. For example it can be text, a picture or some numbers.

With packing we achieve a goal: reducing file size. A picture often contains 62 sectors on disk. Even if we haven't draw a thing, the picture will be saved a a 62 sector sized data file. Of course this costs way to much valuable disk space. Let's say we would like to make a slide show. On a medium density formatted disk we have 1040 free sectors. DOS 2.5 is only able to use 1024 sectors. DOS uses 37 sectors, let's say we also use turbo basic which uses 145 sectors. The slide show program (in turbo basic), another 15 sectors? We now have 1024-37-145-15=827 sectors left to store picture data. If a picture uses 62 sectors we could put 827/62=13 pictures on this disk. Imagine we could reduce the size of the pictures with 30%. A picture would have a size of 43 sectors. So now we can have 19 pictures in our slide show. As you can see packing has its use....

The texts on this magazine are also packed so we are able to put more text on a magazine. That means more information for the same amount of money. That's the use of packing.

Also people who create something and do not like other people modifying it pack their data. This has two advantages. It reduces file length and it protects the data (data makes no sense).

Let's start at the beginning and see how we can pack pictures in a very simple way.

Most of us have drawn a picture on the computer. Still most people do not know how this picture is stored in the memory of the computers memory. So here's a bit of information about how it is done.

Our computer always works with number from 0 to 255. A picture in for example graphics mode 8 (design master) or graphics mode 15 (blazing paddles, xl art) the picture consists of 7680 of those numbers. In the file these numbers are simply put one after another. On your screen each horizontal line 40 of those numbers are put next to each other. We have 192 horizontal lines on one screen, that gives us 192*40=7680 numbers.

If a piece of screen is empty, the number representing that part of the screen will be 0. A lot of pictures contain those 0's. Knowing this we can reduce a lot of pictures in size.

How to do this? First we read a picture from disk in memory. How to do this you can see in the program. We now have 7680 bytes of our memory filled with picture data. Now we reserve another 7680 bytes for the packed picture (which of course can be shorter). We would like to get rid of the 0's.

We now have to transfer the picture to the packed picture byte by byte. As long as we do not find a 0 we'll simply transfer the bytes. If we find a 0, we'll get a byte and check if this is also a 0. Those 0's we will not put in the packed picture! We keep looking for 0's until we find a different value or we passed 255 0's.

When this situation has occurred, we put a 0 in the packed picture. After that we put the number of 0's we found. Let's say we found 30 0's after another in the picture. This will take only 2 bytes in the packed picture, a 0 and a 30! We search the complete picture for those 0's until we have reached the end. Then we have to write the packed picture to disk.

An example of packing this way is on this magazine.

Now you think 'well, I have packed my picture, but how to get it on screen?' That is very simple. We read the picture from disk and put it on screen byte by byte. A soon as we find a 0, we read the next value. That number of 0's we put on screen and we proceed putting the picture on screen. That's all! Also an example of this is on the magazine.

You will notice this is not very fast, because all of this was made in Turbo Basic. If we convert it to machine code you can pack a picture in about 2 seconds and also depack it in about 2 seconds. This is done in the third example program. It's the combined packer/depacker. Take a good look at the routines used and use them in your own programs. Mind the following. No other program than yours will be able to read your pictures! If you would like to be able to read the pictures in other programs again, make sure there is a program to convert the data back to normal again!

The mentioned 0-packer is the most simple 0-packer there is. In one of the following issues we'll improve the routine so we can reduce the picture even more.

See you next issue.

The Missing Link

Sampling, simple theory

With nowadays computer, audio and video technology we see more and more digital techniques. One of those techniques is sampling. Simply said sampling is nothing more than converting an analogue signal to a digital signal. If you're interested in how things really work, read on....

Everywhere around us we hear (at least the people who can hear) sounds. Sounds consist of so called sound waves. The volume depends on the peaks (upwards and downwards) of these waves and pitch depends on the distance between the waves. This is called frequency. Later on we'll get back at how these waves work and which kind of waves we know but for now we just take a look at the sound that consists of waves.

Using a microphone we can pick up sounds. The membrane inside the microphone start to vibrate because of the sound it picks up. Again the peaks and distance set volume and pitch. Vibrations in the microphone are converted to pulses. These pulses are send to for example a tape deck or amplifier via a cable. Right now we can understand the name of an amplifier. It simply amplifies pulses. He passes them on to the speakers. The speaker is also a membrane that is vibrated by pulses. Because of the vibrations new sound waves are created which we can hear. A speaker is basically a reversed microphone.

Storing sound
As I mentioned before we can transfer picked up sounds via a cable as pulses to for example a cassette recorder and record the sound on tape. Such a tape is a strip of magnetic material on which 'part' are arranged in certain way so they can replay the recorded sound when playing the tape. When we copy the original every 'part' has to be read, converted to pulses, send through a cable, brought to the head of the recorder and written back on the magnetic tape. Because of all these steps we lose quality. The cable and recorder heads and sometimes the amplifier between them reduce the quality because of their own limited possibilities. To reduce this problem the digital system was invented: ones and zeros. These can be copied as many times as you want, they'll remain (if you copy correctly) ones and zeros! This is done in for example the compact disc and picture discs.

Next time we take a look how to convert sound to ones and zeros etc. And we'll talk about things like 4-bits sound, 16-bits samples, oversampling, etc.

See you next time! TML

Preview T-34

Title: T-34, the battle Creator: Doomsday developments
Sold at: Not yet available

This time we'll review a game that has not yet been released (too bad). ANG Software has got a preview version of this game and I got to take a look at this game and play it.

T-34 is a Polish product, but the game and manual are in English. It's a game for two players. The game is quite simple. Every player owns a tank. The tank are somewhere in a landscape, for example some flats. The only thing you have to do is destroy the tank of you opponent. You can fire one at a time. Before you fire you will have to aim. This is done by setting under what angle and at what speed the bullet has to be fired. Then you can fire and hope it gets close. After a few shots you are able to guess what angle and at what speed you have to fire. The tanks can also be moved a bit. The opponent is also shooting at you, so it's important to be the first to know where to shoot first!

The game has good graphics and sound. You can already see it in the intro. After loading a while you see an intro that strongly reminds you of the movie Terminator 2 (or T-2). Just like in the movie you see silver panels shifting and closing. In the movie on the panels you read "T-2, judgement day", in this game it says (in the same font) "T-34, the battle". No very original, but it looks great. After that the intro continues. You see a scrolling landscape with two tanks in it and you hear the sound of singing birds. A tank fires a shot and the game starts loading.

130XE owners will get a message that extra memory has been found. After a while the main menu appears. Here you can enter the names of the players and select several options concerning landscape, wind, gravity etc. After that the game can begin. The game also looks great. While shooting the screen scrolls along in a three layer landscape. If it's night a beautiful moon appears in the sky.

Sound is also very good. Next to good music a lot of good samples are used. For example just before you fire you hear a certain scream. if you miss, you hear a sample. They even use different samples. You can hear a cat, big explosions or windows crashing in. If you hit, you also hear several different sounds.

I would say this game is great. I have never seen such a good game in the 8 years that I have my Atari. A big 10 overall! On the JHV ANG demonstrated this game and all visitors who played it wanted the game. I hope it'll be available soon (because I want it!).

Fred Meijer

Cheats! (1)

This column is for tips and cheats for playing your favourite game better or easier. Next to that you can find level codes and hints here.

It's meant to be a column for you and by you. It would be nice if you would send in your hints, tips and cheat of your favourite games. Old games, new games, famous or not famous games, it doesn't matter. Also you can send us you questions concerning several games. There are always game-players who do know the answers.

A nice price will given away by us to one of the contributors each issue. Another reason to send your game knowledge to us.

Since this is the first time, I'll start with some things I found myself.

We start with the game 'Tac tic'. The option 'Password cheat' in the main menu enables you to skip levels. To start at level 10 you have to enter the word 'MENTOS'. For level 20 the word 'MARZENA' and for level 30 the word 'LEVEL UP' help a lot.

The same thing for the game 'Shit!'. The password for level 10 is 'BHURP'.

Also it's very simple to finally see the end of the game 'Mission Zircon' of Tiger developments. By pressing the keys TAB CONTROL SHIFT simultaneously you go to the next level. This can be done 8 times. After that you see the princess which you have (very easily) rescued.

Solving the game 'Zebuland' should be no problem with these level codes:

1. ZEBU 18. ZATZ 35. MATT
2. BLAP 19. BLOY 36. DOAD
3. ZOFF 20. ARGH 37. HAHA
4. BONK 21. HEPP 38. LOGI
5. BAFF 22. SUPP 39. DEPP
6. BING 23. JUPP 40. SACK
7. HOPP 24. ZSCH 41. XERO
8. FLAM 25. PCHH 42. FATZ
9. PENG 26. YARG 43. GULP
10. BANG 27. SNAG 44. BAUF
11. PLOP 28. NGOZ 45. ONKO
12. BEEP 29. NAJA 46. WAPP
13. MOEP 30. HUTY 47. LINK
14. UGLE 31. WEST 48. DRAG
15. ZIPF 32. NORD 49. AETZ
16. MONK 33. SUED 50. HELP
17. TOON 34. TOLL

The PD game 'Megablast' (published on ANG Pokey Magazine 21) will be a lot easier if you type 'HAVE FUN' on keyboard. You will then see a menu where you can for example give yourself extra lives.

In the game 'Thinx' you can reach a high score quite easy. Press start, select, control and s simultaneously and your score will get higher and higher.

Last tip is for the game 'Conan the barbarian'. If you keep the T key pressed while loading the game, you'll live forever.

That's all for this issue. next issue your hints, tips and cheat will be here. Send your hints, tips and cheats to:

A New Generation Software
Ridderkerksestraat 60
3114 RK Schiedam

See you next issue,


The Best Of Pokey Software

All software published on this magazine is copyright (c) ANG Software unless mentioned otherwise in the software. Without permission of the author and/or ANG Software it is prohibited to publish this software in a magazine, upload it on a BBS, or duplicate it in any form whatsoever.

This moth we selected the following software for you:

An arkanoid clone which is better than it's commercial original. It has a 1 or 2 player option (human and computer). This game is public domain.

A simple but nice game, where it is your goal to keep the ball in the field. Can you beat the computer? Good luck! This game is NOT public domain!

Five to five
Music/graphics demo by Mirage from Poland. Jakub Husak (Johny's Trouble) also worked on this demo. This demo is public domain.

Disk to tape
Nearly all disk users have tape users in their surroundings. With this utility you can easily convert files (machine code) to a boot tape. Select the file, insert cassette and save the file. Can it be more simple?? Follow instructions on screen. The utility is NOT public domain!

Four in a row (menu 2)
Turbo basic version from 1990 of the famous game. Try to beat the computer by being the first who has four in a row. This game is NOT public domain!

PC to XL
A map how to build an interface which enables you to connect your Atari 8-bit to a PC via PC's RS232. You will need the software for PC which is available from ANG software. This program simulates a disk drive and a printer interface/buffer on your PC. Simply transfer files from one computer to another. You'll need some soldering experience before you can build the interface!

Sorting in turbo basic
Program examples. For more information, see article on this magazine.

Packing and depacking
Program examples. For more information, see article on this magazine.

We think we succeeded in giving you a very varied disk with the game on the A-side and 13 texts on the B-side. I hope you'll enjoy all software and articles. Have fun and see you next issue!

John Maris

Sorting it out

A technique which is very often used in programs is sorting. Because it is a quite difficult subject (especially when you've never programmed a sort routine) I think it's useful to discuss it so you'll understand this technique of manipulating data.

There are a lot of ways to sort data. I won't discuss all methods but I'll discuss the methods most frequently used. In this article I'll always use a list of characters which I want to sort. Of course this list can contain any type of information in any data type (however, sometimes the compares will have to be changed etc., but that speaks for itself).

SELECTION SORT (smallest to front)

Imagine the following problem:

We have a list of numbers (we'll call it list R) which looks like this: R: [6,3,4,2,1,9,5]
We would like to sort this list from the smallest number to the biggest (rising). How to do that?

If you would do it manually you would find this: de smallest is 1, after that there's 2, after that 3, etc. That's something a computer also can do for you. It goes like this:

Find the smallest value in list R(1) to R(7),
Swap that smallest value with the first value (=R(1)),
Find the smallest value in list R(2) to R(7),
Swap that smallest value with the first value (=R(2)),
Find the smallest value in list R(3) to R(7),
Swap.... etc.

You'll see this happening:

R: [6,3,4,2,1,9,5], smallest in R(1) to R(7)=1
R: [1,3,4,2,6,9,5], smallest in R(2) to R(7)=2
R: [1,2,4,3,6,9,5], smallest in R(3) to R(7)=3
R: [1,2,3,4,6,9,5], smallest in R(4) to R(7)=4
R: [1,2,3,4,5,9,6], smallest in R(5) to R(7)=5
R: [1,2,3,4,5,6,9], smallest in R(6) to R(7)=6

Mind the swapping. You find the smallest number (call it's position in the list MIN for example, than R(MIN) is the smallest value!) and swap R(BEGIN) with R(MIN), where BEGIN keeps increasing until you reach the end of the list.

Quite simple. In turbo basic it could look like this: (with variable I as BEGIN)

150 END
160 ------------------------------
180 ITEMS=7
190 DIM R(ITEMS-1)
210 ------------------------------
240 ? "GIVE LIST:"
260 ------------------------------
280 FOR I=0 TO ITEMS-1
310 NEXT I
330 ------------------------------
350 FOR I=0 TO ITEMS-2
360 MIN=I
380 IF R(J)390 MIN=J
410 NEXT J
430 NEXT I
450 ------------------------------
470 HLP=R(I)
480 R(I)=R(MIN)
490 R(MIN)=HLP
510 ------------------------------
530 ? "SORTED:"
540 FOR I=0 TO ITEMS-1
550 ? R(I);" ";
560 NEXT I

Of course the minimum length of a list is 2 otherwise there cannot be a swap, so items has to be greater than or equal to 2.


There are other ways to sort our list. A nice one is insertion sort. This method is based on inserting number at the correct place.

Let's say we have a list of length N of which R(1) to R(I-1) is already sorted.
Take R: [1,2,5,8,7,9,6], N=7, I=5
Already sorted is R: [1,2,5,8], to be inserted: R(5)=7.

The algorithm says:
Insert R(I) in list R(1) to R(I-1) at the right place and R(1) to R(I) is now sorted. Increase I until I equals N and the complete list R(1) to R(N) is sorted.

This is what happens:
R(I)=7, to be inserted between 5 and 8 (=R(3) and R(4)).
That gives R:[1,2,5,7,8,9,6], sorted part is R(1) to R(I):
R: [1,2,5,7,8] Increase I and continue.

A disadvantage of this method is that we have to move R(X) to R(I-1) one place to the right if we want to insert at place X. This takes a lot of time and slows down sorting, so I did not program this for you, because on XL it's simply too slow.

BUBBLE SORT (bubbling upwards)

Another algorithm is the bubble sort algorithm. This method is based on moving the smallest value to the left. The idea is like this:

Imagine we have a list R [3, 5, 7, 6, 4, 8, 1, 2], length N (here N=8). We'll walk through the list from N-1 to I (with I decreasing from 1 to N) with index J. We compare every 2 elements of the list and put two smallest of the 2 on the left, and the biggest on the right. After that we decrease J and after one run (going through the list from R(N-1) to R(I) that is) R(1) to R(I) is sorted. I can be increased and next run can be done.

Sorting is done like this:
Run 1: (in steps)
[3,5,7,6,4,8,1,2], I=1, compare R(N-1) with R(N)
[3,5,7,6,4,8,1,2], I=1, compare R(N-2) with R(N-1)
[3,5,7,6,4,1,8,2], I=1, R(N-3) with R(N-2)
[3,5,7,6,1,4,8,2], etc.

There are several steps where no swapping takes place. That doesn't matter because compares take less time than swapping. The smallest value has now bubbled to the top (the left of the list).

That was 1 RUN. Sorting consists of several RUNs.

Sorting the list: (in runs)


In Turbo Basic:

150 END
160 ------------------------------
180 ITEMS=7
190 DIM R(ITEMS-1)
210 ------------------------------
240 ? "ENTER LIST:"
260 ------------------------------
280 FOR I=0 TO ITEMS-1
310 NEXT I
330 ------------------------------
350 FOR I=0 TO ITEMS-1
370 IF R(J+1)380 EXEC SWAP
400 NEXT J
410 NEXT I
430 ------------------------------
450 HLP=R(J)
460 R(J)=R(J+1)
470 R(J+1)=HLP
490 ------------------------------
510 ? "SORTED:"
520 FOR I=0 TO ITEMS-1
530 ? R(I);" ";
540 NEXT I

It seems good to improve the bubble sort with a flag that checks if there was a swap operation in one run. Because if not, the list is already sorted and no further action is needed. But I've tested this and this slowed things down a lot. But it depends on your data type, because with some data type comparing takes a lot of time and then it could really speed things up. I've tested three sorts of bubble sorts with lists of numbers.

1. Bubble sort bubbling all small numbers upwards together (slow!).
2. Bubble sort as above.
3. Bubble sort as above, with flag.

I've sorted 4 types of lists with them:
1. A short, random list (N=7).
2. Worst case list (30 to 1).
3. A long list, nearly sorted (N=30).
4. A long random list (N=30).

Here are the results: (times in seconds)

List: BS1 BS2 BS3
1- 00.38 00.26 00.32
2- 10.66 06.12 07.34
3- 04.28 02.42 00.60 (wow!)
4- 07.47 04.18 05.14

Bubble sort 2 is overall the best of the 3.

That's all about sorting. I hope I helped some people with programming their own software. If somebody would like to add something to this article (for example the quick sort, of which I think it's not good for XL), don't hesitate and write to ANG.