68000 Book Review (Part 2)

Continuing from Part 1 of my book review, here’s Part 2.

68000 Assembly Language: Techniques for Building Programs (Donald Krantz & James Stanley)

This is a software book with about half of the book dedicated to describing the 68000 instruction set architecture and the other half describing a text editor project.  If you already have the manuals for the 68000, the architecture content is redundant.  The text editor, YASE, however, is more interesting.  It’s a sizable project with good documentation on both design decisions and 68000-specific implementation.  YASE should be a great example for learning 68000 programming and organizing mid-sized code bases.  Also, YASE is modular, and you could reuse some components, such as the printf routines.

This a good book, but I don’t find it as timeless as the Wilcox text.  If you’re learning 68000 assembly language programming, this is an excellent resource.  Otherwise, it’s an interesting piece of history that I wouldn’t mind on my shelf.

View the table of contents.

68000 Book Review (Part 1)

The Motorola 68000 family of processors entered the market in 1979.  With a 32-bit CISC instruction set and 24-bit address bus, the 68000 was a powerful processor that spawned a long, successful line of microprocessors and microcontrollers.  The Freescale Coldfire line is the modern descendent.

My interest in the 68000 family started in college, and I’m still fond of it.  Good documentation and an orthogonal instruction set make the processor pleasant to program.  My robot, Bluebot, uses the 68332 descendant.

I’ve seen several references and positive reviews online about two books on the 68000, one by Wilcox and the other by Krantz & Stanley, but there are few online details about the contents.  I borrowed copies from the library and want to share my thoughts.  This book review comes in two parts with the second coming soon.

68000 Microcomputer Systems: Designing and Troubleshooting (Alan D. Wilcox, Ph.D., P.E.)

This is a hardware book detailing engineering design process, digital logic, and 68000 hardware with the S-100 bus.  The discussion of often overlooked digital design topics, such as loading, fanout, timing, propagation delay, and logic levels, is excellent.  The author presents several complete, well-documented 68000-based designs.  The N8VEM project is currently recreating a design from this book.

This book is excellent if you’re building or repairing 68000 systems.  It’s also a good general resource for digital logic with discrete gates.  The design process material is pretty good, too, although you’re probably better off with a more modern text if that’s your only interest.  I recommend this book and want to add it to my shelf.

View the table of contents.

Macrosoft at KansasFest 2010

I presented a tutorial introduction at KansasFest 2010 on the Mindcraft Macrosoft programming language, a macro assembler package that allows the programmer to achieve machine language speed with a high-level Applesoft BASIC-like syntax.  Macrosoft and its companion Assembler run on you favorite 8-bit Apple II.  The presentation was well received, and several people left motivated to try Macrosoft for themselves. Don’t miss the history of Macrosoft from the author, Alan Floeter, that’s part of the presentation slides (page 11).

Ken Gagne has kindly shared a recording of my presentation and posted the slides.  Watch the presentation, buy a copy of the Mindcraft Assembler & Macrosoft, and write the next blockbuster Apple II software.

USE MACROSOFT.3.1
UEN
MUL
BEGIN
PRINT "Macrosoft Rocks."
CLEANUP
END

There’s a working Macrosoft example in the presentation slides.  Also, check out my “hello world” program in Macrosoft and with the Assembler.  Finally, don’t forget my winning KansasFest 2009 HackFest entry written with Macrosoft.

KansasFest 2010 HackFest

My KansasFest 2010 HackFest entry with source code is now available for your enjoyment.  This entry took second place behind Martin’s Wizardy crack.  I used Complete Pascal 2.0 with Pegasoft Draw Tools 3.1, both of which are freely available, to create my first 16-bit Apple II program.  The program displays pictures from KansasFest and asks related trivia questions.

The photographs are used with permission from Henry Courbis of Reactive Micro.  I converted the original JPEG images to GIF files on a modern Macbook then used Super Convert on a IIgs to produce packed SHR image files.

I hope some budding programmer will find the software to be a useful starting place for the next brilliant Apple II software!

Hackfest Day 2

There are just so many fabulous things to see and do at KansasFest that Hackfest has not gotten much attention!  Where else do you get to see the worst Apple product and a disk operating system almost twice as fast as ProDOS?

I want to include full-screen bitmapped images in my entry, and I’m figuring out how to load and display images.  The toolbox does not offer a convenient “load image from file” call so I must provide code to load, parse, and decompress the image file.  I found a CSA2 post with sample code and the Pegasoft Draw Tools package.  Draw Tools provides numerous handy drawing tools, including fades, wipes, animation, and image loading.  So, I’ve installed Draw Tools and have the sample code working.  The TML Pascal samples work well with Complete Pascal since Complete Pascal is really version 2 of TML Pascal.  Work continues …

Hackfest Day 1

The annual KansasFest HackFest is on!  I’ve heard rumors of Wizardy cracking and a Rockhurst text adventure.  I’m learning Complete Pascal, learning IIGS toolbox programming, and, just in case I run out of things to do, using those skills to write a graphical Apple II/KFest trivia adventure.  I have Complete Pascal running and am ready to crank out a bit of code.  Stay tuned for more …

Saying “Hello” with Macrosoft

Following the model of Eric Shepherd’s “Some Assembly Required: Hello World” article on A2Central and my last post on the Mindcraft Assembler, I’d like to present the traditional “Hello World” program for 8-bit Apple II using Macrosoft.

Macrosoft allows the programmer to achieve machine language speed with a familiar BASIC-like syntax.  Technically, Macrosoft is a macro library for the Mindcraft Assembler.

First, follow the directions included with Macrosoft to create a working disk with The Assembler and Macrosoft.  Next, just like last week’s tutorial, slide the disk into your drive and run the BOOT.SYSTEM program.  Press “E” to enter the editor.  Press “enter” once to get a “!” insert mode prompt.  Type in the following program.  Case does matter, so watch the capitalization.  Also, make sure to begin each line with a space; otherwise, the assembler will interpret your entry as a label.  Notice that, except for a few extra “boilerplate” lines, the program appears similar to BASIC.

USE MACROSOFT.3.1
UEN
MUL
BEGIN $2000
PRINT "Hello world."
CLEANUP
END

Press the “Escape” key and enter “Hello” for the “Save Pathname.”  Press “A” to assemble to program.  If you get errors, return to the editor and correct them.

Finally, press “!” to exit back to BASIC.  Change to the directory containing the HELLO program and type “BRUN HELLO”.

Saying “Hello” with the Mindcraft Assembler

Following the model of Eric Shepherd’s “Some Assembly Required: Hello World” article on A2Central, I’d like to present the traditional “Hello World” program for 8-bit Apple II using the Mindcraft Assembler.

Slide the Assembler disk into your drive or run the BOOT.SYSTEM program.  Press “E” to enter the editor.  Press “enter” once to get a “!” insert mode prompt.  Type in the following program.  Case does matter, so watch the capitalization.

            ORG       $2000
COUT        EQU       $FDED         ;Apple II character out func.

            LDX       #0            ;Offset to first character
loop        LDA       msg,X         ;Get the next character
            BEQ       done          ;->Yes!
            JSR       COUT          ;Print it out
            INX                     ;Move on to the next character
            JMP       loop          ;And continue printing
done        RTS                     ;All finished!

msg         ASC       "Hello world."
            DSC       $8D
            DSC       $00

Press the “Escape” key and enter “Hello” for the “Save Pathname.”  Press “A” to assemble to program.  If you get errors, return to the editor and correct them.

Finally, press “!” to exit back to BASIC.  Change to the directory containing the HELLO program and type “BRUN HELLO”.

Apple IIgs development with MPW – Setup

The Apple IIgs is a great platform for software development.  Compared to 8-bit Apple II machines, the IIgs offers a faster processor, more memory, higher resolution video, and a more modern desktop graphical user interface (GUI).  The operating system, GS/OS, offers features found in modern desktop operating systems, such as a relocating system loader, dynamic memory management, networking, modular file systems, and event-driven user interfaces.

The platform has a number of excellent software development packages.  Whether you favor C, Pascal, Logo, Modula-2, Forth, BASIC, or assembly, you’re covered.

But, compared to software development on newer computers, the IIgs screen resolution and processor speed are unavoidable limitations.  A large screen allows you to see more of your code.  A fast processor cuts compile time and debugging.  Apple felt the pain of developing large programs on the IIgs and created add-ons for the Macintosh Programmer’s Workshop (MPW) that allow IIgs software development from the relatively advanced Macintosh platform.  Apple used these MPW-based development tools for some of its most complicated IIgs software projects, including GS/OS itself and Hypercard.

Let’s get MPW setup and running.

Get a Mac that runs classic MacOS or a Mac emulator

I choose the Basilisk II emulator.  Follow the directions at E-Maculation to install and setup Basilisk II with Mac OS System 7.5.5.

MPW and the IIgs add-ons run under classic MacOS, so you’ll need a suitable machine with either a PowerPC or 680×0 processor.  Your fancy new Intel-based Mac won’t work.  OSX won’t work either.  I’m not very knowledgeable about classic Macs, so I’m not sure of the “best” machine, processor, and OS version.

Given that these IIgs tools were written for a 680×0 based Mac, I figure such a Mac is the best place to start.  I don’t have the desk room or the inclination to start a classic Mac hobby, so I turn to emulation.  The E-Maculation site does a great job of identifying the options for Mac emulation.  Mini vMac and Basilisk II look to be my best options.  I choose Basilisk II because, compared to Mini vMac, Basilisk II offers higher resolution color display and networking, which I believe will be valuable for software development.

Install MPW and DiskCopy

Download MPW and Disk Copy from Apple.  Use the HFVExplorer tool included with Basilisk II to transfer to software to your emulated Mac.  You will also want StuffIt Expander, which is useful for de-compressing certain software.

Disk Copy is a self-extracting archive, so double-click the downloaded file on your emulated Mac to open the file.  Then, copy the program to a convenient location on your emulated hard drive.  Then, use Disk Copy to open the MPW image.  Copy the entire MPW folder to your emulated hard drive.  I find the Software Downloads article from Apple helpful in understanding the various Mac file formats.

Install the MPW IIgs software

Purchase the MPW IIgs Tools and MPW IIgs Assembler from Syndicomm.  Optionally, also purchase MPW IIgs Pascal, MPW IIgs C, or MPW IIgs Orca/C from Syndicomm.  Jump through a few overly complex hoops to get the software transferred to the emulated Mac.  Follow the directions in the MPW IIgs manuals (included with your purchase from Syndicomm) to install the software.

While Apple freely distributes the old MPW tools, the MPW IIgs add-ons are not free.  Syndicomm is the only authorized retailer and sells the pieces both individually and part of a package.  The APDA Software Library seems to be a good deal if you’re interested in some of the other included software.  If you only care about MPW, the MPW IIgs Collection is the best deal.

For reasons I don’t understand, the Disk Copy disk images from Syndicomm are difficult to use with Basilisk II.  The emulator does not support mounting these disk images as emulated disks.  I tried, and Mac OS offered to format the unrecognized volumes.  Next, I tried transferring the images into another disk image with HFVExplorer.  Disk Copy 6, unfortunately, fails to mount the images complaining that the images are corrupt.  Third, I tried creating a new image on my OSX laptop and copying the contents of the MPW images to the new image, but OSX 10.6 does not support writing to HFS disk images so this approach didn’t get very far.  OSX 10.6 does mount the MPW add-on images read-only, so I know the images are usable.  Finally, I used Sweet16 to create a Disk Copy 6 image, mounted the image in Sweet16, booted GS/OS, formatted the image with HFS, mounted the MPW images in Sweet16, and copied the MPW IIgs software to the new disk image.  Then, I transferred the new disk image containing all of the MPW IIgs collection to the emulated Mac filesystem with HFVExplorer.  Disk Copy 6 on the emulated Mac finally opened the image.

Sweet16 Create Image dialog

The manuals for the MPW IIgs software describe the installation steps.  I did have a minor problem with the install script for the MPW IIgs Tools.  The script contains a reference to a directory named “SR.71”, and I had to edit the script to remove that reference.

Use MPW to develop IIgs software

There are plenty of documentation and samples.  I’m still learning.

MPW with the IIgs add-ons running in Basilisk II

MPW and the MPW IIgs software include excellent documentation.  There are a few example programs included with MPW IIgs, but they’re generally outdated and probably not very good models.  The IIgs Source Code Sampler package, available from Syndicomm and elsewhere on the Internet, is more up to date and provides several good assembly language examples.

What’s Next

I’m left with a few questions that I’m still exploring:

  1. Is Basilisk II stable enough?  I’ve had a few emulator crashes, but, so far, Basilisk II seems sufficiently stable.
  2. How will I transfer compiled/assembled software to the IIgs?  There are several options, including networking, but I haven’t experimented to find the best option yet.
  3. I’m using an emulated classic Mac to develop software for the Apple IIgs.  Does this make any sense?  Will I be happier developing directly on the IIgs?  A2Central just started a series on selecting a IIgs assembler.

Overall, I’m pleased with using MPW to develop software for the IIgs.  I still have a lot to learn, and I’m not yet certain I’ll stick with using MPW.  My next post will be a tutorial “writing your first IIgs program with MPW.”

BlueBot Brings Home the Rookie Award

BlueBot brought home the Rookie Award!  Check out the classy styrene rain jacket, too.  A local authority (Peter’s Wife) observes that “Peter’s robot is awesome.”

BlueBot did well in the AVC but did not finish.  The ‘bot successfully extricated itself from encounters with rocks, sticks, dirt clods, pine needles, and curbs.  The wheels, however, ended up being too small and too slick to keep going.  The software and basic approach are sound.  Next year, BlueBot will return with better wheels, bigger motors, and a few more sensors to help detect obstacles from greater distance.

Here’s a nifty flyer about BlueBot:  BlueBot Flyer

Thank you to everybody, both SparkFun employees and other participants, who made the AVC possible.