Tuesday, April 26, 2011

Book Review - Applesoft BASIC Subroutines & Secrets - Jeanette and Dave Sullivan


Hello again,

Well, its review time and I wanted to talk about one of the programming books I've been reading.  The book is "Applesoft BASIC Subroutines & Secrets" by Jeanette and Dave Sullivan. This is one rather remarkable programming book.  Published in 1987 and coming in at a beefy 305 pages, this book is packed with great programming information and tips.  Jeanette and Dave have crammed everything but the kitchen sink in this book.  Page after page is one code example after another, giving credence to the phrase, "when is enough really enough!"  I love the way they setup each programming example with a clear, bold catch-phrase title that tells what the programming example is about.  Then right below the title is a one-line tip phase that explains exactly what the program does.  Each example has an “Explanation” paragraph with a detail discussion of how the program works and what certain line do in the program.  Each program is accompanied with the example code in easy to read numbered lines statements.  Each program includes REM statements for further code breakdown.  Some programming examples even include a “Modification” paragraph for ways to enhance the program or tweak it for different results.
I tested a large majority of the programs and didn’t find any errors, which is truly remarkable because editing in programming books was atrocious in the 80’s.  You wouldn’t believe how many times I would enter a program example and when you type RUN, you get hit with an error.  Well how crappy is that when you are just learning and now you are the one trying to figure out what doesn’t work in a program you just typed in!  So, believe me when I say it’s nice to have code that works.

Topics covered in the book are as follows:

            Program entry and disk access
            Data entry and error trapping
            Output format
            Special Effects
            Sorting, Searching, and Scrambling
            Low Resolution Graphics
            High Resolution Graphics
            Circles, Sines, Cosines, and Designs
            Slide Show
            Bells, Clicks, Sounds, and Tunes

Depending on what you are interested in, you should find anything and everything your heart desires in this book.  I especially like the sections on Graphics, where the programs were creative and informative.  Actually the Low and High Graphics sections had the most information and took up most of the bulk of the book.

The book includes a number of example outputs from programs which are mostly geared to the graphics programming section.  A number of “Sample Output” is shown in the Data Entry section, which shows examples of column and text formats.  To see most of the examples you must enter the code and test the program yourself. 

There are a small number of illustrations in the book to give you that 80’s feel but not really enough to talk about.

There is a great section on Bit Mapping that does a good job of explaining how to create shapes or character examples in a 7x8 bit format.  Another cool group of examples cover Special Effects with Machine Language Routines!  This section gave me the most fun because it really delved into Machine Language coding using the all purpose PEEK, POKE, and CALL statements.  Some of the examples included screen wrapping, shifting, flipping, and scrolling, which is similar to how the movement in the Ulima world maps functions.  Be prepared to enter a large number of data statements when covering this section!

Each chapter gives a cute little illustration and a nice synopsis of what the section will cover and what is to be expected.

The last section of the book covers the appendix, which has some extremely valuable information regarding ASCII codes, Apple Memory Map, Color Charts, PEEK, POKE, CALL commands, and summary of commands to Save Graphics or Text.

All in all this is a great programming book for the Apple II and IIe covering Applesoft Basic and Machine Language coding.  This book does what it set out to do, give clear, concise programming example without the fluff and storytelling.  I highly recommend this book if you are looking for good, real world programming examples for your Applesoft basic programs.

Price    - $19.95

Rating is on a 1 to 10 scale with 10 being the highest.

Depth - 8
Programming – 9
Sample codes - 6
Quality – 8
Bulk - 8
Information – 9
Humor – 4
Overall rating – 7.5

Detailed rating description:

Depth – This represents the depth and detail of the information given in the book.
Programming – This represents the programming code examples given and how useful and usable they are to the reader.
Sample code – This represents the amount of sample output given from each program in the book.
Quality – This represents the quality and craftsmanship of the book.
Bulk – This represents the amount of pages within the book.
Information – This represents the quality of the information given in the book such as, the code examples, the explanation of program examples, the description of what to expect, code modifications and tweaks, and the overall detail of the contents of the book.
Humor – This represents the cartoons, illustrations, or funny anecdotes given within the text or storyline of the book.  This may or may not be a factor to most readers!

Sunday, April 24, 2011

Tile Graphics....

ok, so what is this “Tile Graphics” deal?  I know, I know… Tile graphics were used in the ultima games to allow a player to travel throughout the land of Brittania. 
Well, here is the funny thing… NO ONE KNOWS WHAT TILE GRAPHICS REALLY ARE!
I search throughout the web googling tile graphics, Ultima tiles, Ultima graphics and nothing out there really explains what tile graphics are and how you get them to work!  Ok, so I did some research on my own and found this little blurb in “The Official Book of Ultima” by Shay Addams.  Oh, and by the way this book is freakin expensive on eBay! I’m so glad I had my original copy from long ago.  Actually, everything concerning Ultima is expensive on eBay!  But I digress…
In Shay’s book on page 13 under the paragraph titled “The First Tile Graphics”!
Richard talks about creating the shapes, not tiles, in the game.
   “Tile graphics, so called because they’re square and placed on the surface of the game world one by one like pieces of tile, are essentially little pictures of everything that appears in the game.  Several tiles that look like grass-covered land, for example, would be placed side by side to fabricate a meadow, while a string of other tiles would form a mountain range.”
   “We had to actually enter all the shapes in HEX”
   “First he and Ken Arnold would draw them out on graph paper, then convert the graphs into binary, which in turn had to be reversed because the pixels appeared on the screen backwards.  After converting it into HEX, they entered the tile as data, stored in on the disk, and then ran it to see if it looked right on the screen.”
See, so they didn’t create tile graphics per say, they created Shapes!  On the Apple IIe you can create shapes and shape tables to make images almost similar to icons.  These shapes could be from 7x8 pixels to multiple scales of this size.  The process is archaic at best!  Here is a little example of what you have to do to create a simple shape of a box that is 5x5!
First, you draw out the box on a piece of graph paper.  The box is 5 pixels wide by 5 pixels high.  Then you start in the middle of the box and write numbers and arrow starting with 1 to describe the path of the points that will be plotted for the shape of the box.  To create the box you have to tell the computer how you are plotting the points by moving in vectors. 
You have create draw vectors and move vectors.
Draw vectors           100     up
                             101     right
                             110     down
                             111     left
Move vectors           000     up
                             001     right
                             010     down
                             011     left

The numbers are the binary code for the direction.  These codes must be entered into a byte of 8-bit word.  So back to the example, you start from the middle of the box and plot each draw and move vector.

1              move down/no plot        010
2              move down/no plot        010
3              move right/plot             101
4              move right/plot             101
5              move up/plot                100
6              move up/plot                100
7              move up/plot                100
8              move up/plot                100
9              move left/plot               111
etc…

You do this until you have the entire box plotted.  Once you have all the binary codes for the box you have to place them in the 8-bit word.

          00010010
          00101101
          00100100
          00100100
          00111111
          00111111
          00110110
          00110110
          00101101
00000000= 0

Now, you have to convert this information into HEX!  So the byte information in HEX is as follows:

          0001 0010     = 12
          0010 1101     = 2D
          0010 0100     = 24
          0010 0100     = 24
          0011 1111     = 3F
          0011 1111     = 3F
          0011 0110     = 36
          0011 0110     = 36
          0010 1101     = 2D
          0000 0000     = 00

This information is the definition of the box shape which needs to be saved on disk and entered into memory.  This shape can be retrieved from memory and a DRAW function can place in on the screen!

Wow!  Was that one big pain in the A$$!  All that work for just a simple 5x5 box!  Now image having to create 16x16 size shapes like the trees, mountains, water, dungeon entrances, player characters, monsters and so on…

Richard must have been incredibly patient because just imagine how much work went into creating all those shapes!  Just off the top of my head I can picture over 40 shapes.
Well this is exactly what I have to do!  I have to recreate all the shapes used in Ultima 1!  I must first plot them out on graph paper one at a time and then figure out the draw and move vector pattern, then create the binary draw and move numbers, convert these numbers to HEX and then save these shapes to disk!  Whew, what a mouthful!

So as you can see this is going to take quite a while and the one good piece of news is at least I won’t have to do it all by hand.  I have a program called “Shapes in Color” for the Apple IIe.  This little baby is going to make my life much easier.  This program is used to not only create shapes but is places them all in a shape table for you and saves them onto disk!  I still need to create the initial plots on graph paper so I can see what they look like but after that it’s Shapes in Color time!
So I’m off to start recreating all the shapes, excuse me, Tiles for my Ultima 1 program!  I will update you all when I have the shapes created and saved in a shape table.  After this I need to figure out how he got them to move so smooth across the screen but we will work on that later.

Well there you have it, Tile Graphics is really just Shapes created and organized in a massize grid! Go figure.
For now its shape time!

My first program...

April 23, 2011
Ok, here is my first program…
10 PRINT “HELLO ULTIMA WORLD”
20 END
Just kidding, I do have some basic programming experience in Applesoft and a little in Machine Language.  Boy, you were probably thinking this is going to take a long time!
Don’t worry, I am a fast reader and a quick learner.

Apple II Programming manuals

April 23, 2011
Hello all,
Well here we are again continuing our journey to the realm of Ultima 1.  I have gathered together my entire collection of old Apple programming books and manuals to help me master the ancient art of basic programming!
I plan on reading, digesting, and reviewing all the programming books I have.
Here is a list of the books I have:
Apple II User’s Guide 3rd Edt. – Lon Poole
Apple Machine Language – Don Inman/Kurt Inman
Apple Graphics & Arcade Game Design – Jeffrey Stanton
Intermediate-Level Apple II handbook – David L. Heiserman
How to write an Apple program – Ed Faulk
How to write a Program II Advanced – Ed Faulk
Games Apple Play – Mark James Capella
Apple Basic Data File Programming – LeRoy Finkel
Apple II basic – David Goodfellow
A Beginner’s Guide to the Apple – Bruce Presely
Art and Graphics on the Apple II/IIe – William Dewitt
Apple II reference manual
Apple IIe User’s Handbook – Weber Systems
Applesoft Basic Subroutines & Secrets – Jeanette and Dave Sullivan
Apple II Computer Graphics - Ken Williams
These books should give me enough information to lead me in the right direction.  My plan is to read through these books, type in the examples, and learn from the programs.  This is going to be pretty intense and I have a feeling it will take a long time to get a working copy of Ultima 1.  Hey, what’s the fun in trying if you don’t have to stumble along the way?  They never said it would be easy.  LOL.

Ultima 1 Revisited

April 22, 2011!
Today marks the beginning of a journey that will take me back to the early 80’s and relive those wonderful days programming on my Apple IIe computer! These were simpler times, when Sony Walkman’s were all the craze and cell phones were non-existent.  But what I remember most about the 80’s is Richard Garriott’s Ultima 1! 
This game changed my life!  Not only did it steer me into a career in Computer Science and Electronics, but it showed me what the Apple IIe computer could do when you had drive, commitment, and an adventures heart!  Richard spoke volumes with this game and his hard work and dedication would lead many young lads to trekking through treacherous dungeons or through Lord Brittish’s realm.
So today I embark on a journey to bring back those wonderful days when life was simple and all I worried about was playing and trying to program Richard Garriott’s Ultima 1 adventure.
I dusted off my old Apple IIe computer and pulled out all the old Apple programming books and manuals that I could find.  To my ultimate surprise, “no pun intended”, the old girl sparked to life with a single flick of the switch.  Once I slid in my DOS 3.3 disk and Reset the system, I was presented with the ultimate gift, “again, no pun intended” the magical ] symbol.
Now that I know I have a working Apple IIe computer I plan on reliving, no… revisiting if you will, those magical days when Richard Garriott had a dream to programming a game unlike no other game out there.  Ultima 1 was that game!  Those days when he sat in his closet programming in Applesoft Basic to the wee hours of the night!  I shall be embarking on the same journey, to not only relearn the Apple IIe computer but to relearn to program in Applesoft Basic and Machine Language!  My goal is to recreate the entire Ultima 1 program in Applesoft Basic and Assebly on my Apple IIe computer!  I hope to relive the excitement of creating a masterpiece of code and adventure. 
I will be blogging about my progress with learning Basic and Machine Language.  I will be reviewing some of the old Apple programming books that Richard may have read to increase his knowledge in the art of programming.  I will also be posting my code and examples as I travel along this quest to recreate the entire Ultima 1 game from scratch.
No code has ever been available on the web and no information has been posted regarding the Applesoft basic code for the Ultima games.  I do know that Richard programmed the first Ultima games using only Applesoft Basic.  My plan is to use Assembly language as much as possible and suppliment the rest with Basic.
So if you have any interest in the History of Ultima 1 and/or the basic program codes that helped launch an industry stay tuned and follow along as I take you back to the wonderful days of computer programming and gaming on the Apple IIe computer.
Enjoy….