Diecom light gun in MESS

MESS bug #971 is a feature request for adding a Diecom light gun adaptor emulation to mess. It was committed this morning. Woo, hoo!

But I’d like to take a moment to explain some of the deficiencies of my emulation. As is usual, I only implement enough of the converter box to get the two written games working: Iron Forest and Medieval Madness.

Here is how the games work. When the light gun trigger is pressed, the CoCo clocks the device to state 6 and waits for the start of a video frame. After vertical retrace, all of the palette registers are set to white and the device is clocked to state 7. This starts the 9 bit timer. The 9 bits are timed to roll-over every horizontal refresh. At every horizontal refresh the device is polled to determine if there was a “hit”. A “hit”" is when the gun senses the light of a white pixel on the screen. Further more, when a hit is detected the internal timer is stopped automatically. Clocking the device’s state from 8 to 15 make the nine bits of timer data available to the CoCo. A low timer value says the hit was early in the scan line, a high timer value says the hit was late in the scan line.

Since the CoCo is counting off scan lines it knows the vertical axis of the hit. Since the CoCo reads the nine bit timer value it knows the horizontal axis of the hit. Thus the hit is pin-pointed on the screen.

Let me describe another method of using the device, one which isn’t emulated. This other method is what is used in the Nintendo Entertainments System’s Duck Hunt game. When the gun’s trigger is pressed the screen is blacked out and at the end of the frame, the device is queried for a hit. If there was a hit, then the game player must have been pointing the gun at a bright light source (not the TV) so the game registers a miss. If there was no hit, an object is painted white at the start of the next video frame, then at the end of the frame the device is queried for another hit. This is not emulated because I do not sample the video buffer, looking for a bright light. I score a “hit” whenever the device is sampled and scan line matches the mouse vertical position.

If people start writing new games and they want to use the second method I will add it to the emulation.

Arbitrary GDB

Just now I read about a new release of Xcode for Mac OS X. In part of the new release notes was this:

    opening a maliciously-crafted DWARF binary with GDB could lead to arbitrary code execution.

That is the funniest thing I have read in a long time. Every GDB session leads to arbitrary code execution.

John Hodgman

A few weeks ago I went to the John Hodgman book signing/performance in San Francisco. He was fantastic. Jonathan Coulton was also very good. Here is a little bit of video I took:

Asking for forgivness

> >Would it upset you in any way if I registered MacMESS.org?
>
> No, I don’t have any objection as long as you do use the name
> for sites related to MacMESS.

I am guessing a personal blog under macmess.org would be against this term he set out for me. So I hope a sub domain is enough separation.

Welcome to my new blog. I’ll be copying all of the old content to this new blog. But it’ll take some time, there is no “export” in my old blog software.

My Summer Vacation

Last week I spent my Summer vacation in the Sequoia national forrest. I went to diabetes camp; family camp. My youngest daughter was diagnosed about three years ago, it was quite a life altering event.

In my youth I went to a camp called Camp Odyssey. It was somewhere in the Sierra Nevada mountains near a lake called Ice House Lake. I can never remembered exactly where it was, but I went for three years in a row. It was so much fun.

This year my wife informs me that we are going to diebetes camp. The drive to Bear Skin Meadows was going to be about five hours. I knew about regular camp, but I had no idea what to expect in this situation. The idea of Family Camp seemed kind of weird. But it turned out to be another life altering event.

At camp we were about thirty families spread out over a couple of acres. We were grouped to about four or five families per deck. The sleeping arrangements were 40 x 40 foot decks with a small covered area for storage. We slept under the stars. Thankfully, there was no rain. In fact the weather was perfect the whole week.

The schedule was very planned, but not ridged. Usually after breakfast the parents would separate from their children (both diabetic and non-diabetic). The parents would go for an 90 minute education class and the kids had a rotating schedule of swimming, sports and games, archery, crafts, and drama. Then a communal snack, then more education for the parents and another event for the children. Then lunch was served, then free time where parents could do one of the above activities with their children, or go off camp. Later would be another snack and then dinner.

On some nights the children would be taken back to the decks by their counselors and other staff would stay with the parents and we could talk in the dining hall.
Parents come with their children to family diabetes camp because there is no way we would ever think of leaving our children in the charge of strangers. Usually friends and family have to go thru a twenty to thirty minute teaching lesson before we will leave our diabetic child with them. And forget about sleep overs. But at Bear Skin Meadows the first night everyone is gathered around the stage and the counselors are introduced and the children in their group are called down. And then they go off. For me this caused a little bit of panic. Who are these teenagers and young adults taking my diabetic child? The camp director tells everyone that 90% of the counselors have diabetes and they are all trained in emergency procedures, they all have “low bags” that include blood glucose checking kits and candy. After a week of this schedule and being around the staff and counselors I can attest that this is true. I have never before been around a group of young adults that have my implicit trust.

I’ve found a place where, for a week each summer, I don’t have to worry about my daughter’s diabetes.

My Next Project

I recently wrote up how my next programming project is going to behave. The program will be called Imager. It’ll be used for scanning old floppy disks and tapes.
First I am going to acquire a PCI Catweasel card so I can write this software for my Mac.
When you first open the software you’ll be presented with a blank window. From the file menu you’ll choose “Read from Catweasel” from a menu and you’ll be presented with a dialog for which tracks and sides you want to read. You’ll confirm the dialog and it will read in the data and present it to you without any post processing. I am talking flux transistions. They will be presented as a wave form for each track/side.
It’s very difficult for a human to understand flux transistions, so you’ll need to add a “signal to block” data converter. You’ll choose a IBM3410/MFM “signal to block” converter. This will collapse the flux transistion pane and insert a new pane below it that shows all of the disk blocks found. The IBM3410 format contains two kinds of blocks: ID blocks and data blocks.
Now add a new WD1779x “Block to Block” converted pane to inturpet the ID and data blocks and combine them into named sectors.
Now you’ll be able to add another “Block to Block” converter. This one will be called “Microsoft DECB allocation unit”. This converter knows how to take sectors and combine them to granules. So you get a list of named granules that you can inspect. It will also alert you if there are incomplete granules since it knows how many sectors are in each granule.
Now for another pane. A “Block to Block” converter called “DECB Files”. This one will know how to read the directory track and granules to find all of the allocated files. It will present you with their name, the ganules they reside on, and the length and any other meta data included on the directory track. You be presented with any error conditions like missing/damaged granules.
That about does it for a DECB disk. But I can further imagine writing format converters for files. If there is a picture on a DECB disk in some obscure format, it’ll be possible to write an image converter so you can see the image in another pane.
Also imagine a cassette tape “signal to block” converter. Imagine being able to decode one track as FM and the other tracks as MFM to get around crude copy-protection implenentations. Imagine a whole stack of OS-9 “Block to Block” converters to verify the contents of those disks. Imagine being able to write your own “Signal to Block” and “Block to Block” converters in a scripting language so you can make the program even more powerful. And finally image every pane being editable, and when edits are made they propagate back up thru the stack all the way to the flux transistion pane. Now you’ll be able to correct errors.
Imagine every pane able to export it’s data so a file can be saved to a native file. Or the sectors can be dumped so the disk image can be used in an emulator.
I have a lot of expectations for this program.

Copyrights

In 1999 I rejoined the Tandy Color Computer community after an absence of 13 years. I joined every USENET group, mailing list, and message board I could find dedicated to discussing the CoCo. I bought all my hardware and software back from the person I gave it to so many years ago. I even used EBAY to add to my collection. All in an effort to reclaim my youth.

Whenever I joined a new group I would look over the past archives and get a sense of what the people there thought of copyright. Generally there used to be quite a lot consternation regarding the copying of copyrighted material. It seemed it was generally frowned upon.

Personally, I believe copyright (specifically in the U.S., and generally around the world) lasts way too long. I like the idea of tying the length of copyright to the length of a patent. There are powerful commercial pressures to keep patent terms relatively short. Pressures that don’t exist for copyrights. The Copyright Cartel (I’m looking at you, Mickey) is taking advantage of this.

I’m OK with the idea of trademarks lasting (effectively) forever.

I actively engage in civil disobedience with regard to copyright. If a work has been copyrighted longer than the term of a patent, I have no qualms copying the work. I license my own work under various generous terms ranging from GNU GPL to BSD licenses.

The attitudes on the forums I belong to seemed to also have swayed in this direction. People who suggest copying materials are not immediately lambasted.

I should note some exceptions. First of all a vast majority of copyright owners who are able to be contacted gladly give permission for the non commercial distribution of their work. Thus allowing the dissemination of their property on the internet.

A counter example to the above is Lonnie Falk’s The Rainbow. The Rainbow was the most influential Color Computer periodical. It was the most colorful, and lasted the longest. Lonnie stopped publishing The Rainbow in the early 1990s and became mayor of Prospect, Kentucky, the same town where The Rainbow was published. In the late 1990s he set up an internet store to sell back issues of The Rainbow. Wholesale scanning and distribution of this publication was regarded by the community as a bad idea, even to this day.

But there is hope for this publication. A deal was struck with Mr. Falk. to allow the copying of scanned versions of The Rainbow for the price of $0.25 per issue. A very reasonable sum. A small group of volunteers are working on completing the scanning and archiving of this publication. They hope to be finished sometime next year. They plan to charge just a little more than the license fee to cover the costs expended in the endeavor.

So, it turns out even my attitude of copyright is not as unyielding as I first thought.

Alaska and Hawaii

Last Saturday I took the kids to see the movie Cars. We all enjoyed it, but on the drive home my oldest daughter (Bethany) asked there were really small towns like that. Heck I grew up in one. Except it was highway 33 not route 66. So I said there must have been hundreds of places like that.
Then she asked where did route 66 start and finish? After I told her (Chicago to Los Angeles) I said I was partial to Interstate 5. I had to explain it goes from Mexico to Canada, then on into Alaska.
She she said in the most dead-pan voice, you can drive to Alaska? Sure I said, just go thru Canada and you’ll end up in Alaska.
She insisted, you can’t drive to Alaska because it is down by Hawaii. I thought that was a strange thing to say. But then I realized what she meant. I said to her she needs to spend more time in front of a globe, and less time in front of that flat map of the United States.

Apple vs Apple vs Microware

Sometimes Apple Computer really amazes me. In 1980 a small operating system company from Des Moines, Iowa created an operating system called OS-9. It was a good operating system geared specifically for the new 6809 microprocessor. Microware would port their OS to new chips as they came out. 68000, x86, MIPS, whatever.
Then Apple created an operating system called Mac OS 9. Microware sued Apple claiming that they were stealing their trademark. Trademarks are given only for a specific market segment. That is why one company can have a Mac trademark for a computer product, and another company can have a Mac trademark for a cosmetics product.
But Microware had the OS-9 trademark for the computer operating system market segment. This required them to litigate Apple. If they didn’t they might loose their trademark.
It turned out Apple won that lawsuit, Apple convinced a judge that Microware actually had a trademark in the realtime operating system market segment and Apple had a trademark in the desktop operating system market segment. This argument was a bold move by Apple that worked. I was amazed.
Now I learn that Apple has won their trademark lawsuit (and a breach of contract lawsuit) against Apple Corp. The judge said Apple Computer is in the business of selling music and Apple Corp. is in the business of selling the Beatles. Again, I am absolutely amazed.