Author Archives: jrand

Halloween 2014

P1100288Here is a picture of Matthew and Samantha a couple hours before going out to do some “trick or treating” this year.  Matthew is dressed as a hobbit.  Cynthia tried to curl his hair to more closely match the hair of the hobbits from the movies but it just didn’t work.  His hair is straight and is going to stay straight it seems.  Samantha is dressed as princess Ariel from The Little Mermaid.

The pumpkin came out pretty good this year also.  There was a diagonal ridge on one side which we thought looked good as a scar.  So, we made it look like our pumpkin lost his right eye in some kind of accident leaving an odd hole and the diagonal scar.

The weather cooperated.  It was about as cold an evening as we have had this fall but it didn’t rain on us or worse – snow.  Samantha went around our block for the first time.  In the past, she would give up before completing the circuit but she made it this time.  Matthew scoured the neighbourhood and brought home two large bags of candy.

And we seemed to have fewer kids come to our door.  We have ran out of candy the last couple of years so we had more than ever.  I think we have candy enough for Halloween 2015 and then some.

Tobogganing with James

Steve, Katherine and James came to visit us this winter and we spent much of the time at the local tobogganing hill.  I grabbed some video of the kids as they enjoyed the day with their sleds.

Joey Joe Joe Junior Shabadoo

We got a cat a couple months ago and named him Joey Joe Joe Junior Shabadoo.  I had something to do with that name but the kids were definitely on board.  And Cynthia puts up with us.  We call him Joey for short but at formal occasions, we sometimes call him Mr. Shabadoo.

But not long after we got him, I found him chasing his tail.  Check out this video with the appropriate musical accompanyment.

KansasFest 2012

IMG_0210This story begins early in 2012. I was listening to the latest episode of Retro Computing Roundtable, a podcast about old computers, when they started talking about KansasFest. KansasFest is a gathering of Apple // enthusiasts which has been happening yearly for many years. The 2012 event would be their 24th and the hosts of the Retro Computing Roundtable announced on their podcast that they would all be attending.

Among the hosts is Earl Evans who had often talked about wanting to attend KansasFest the same way that I had over the years. In university, I just didn’t have the money. After university, I was focused on my BeBox and BeOS. And then I was married and Matthew and Samantha arrived. There always seemed to be a good reason why I couldn’t go.

But Earl and the rest of the hosts found a way. I literally paused the podcast and started thinking “why couldn’t I go this year”. Maybe it would be too costly? But I have lots of air miles – enough to get me a flight there for free. And the cost of the event itself is cheap considering that meals and lodging is included. Would my family be OK with me going on a “vacation” by myself? And there is the problem that our wedding anniversary happens during KansasFest.

So, I asked the boss and after a bit of negotiating, I had my OK. I booked my flight and registered. I was going to KansasFest!

I subscribed to the KansasFest mailing list and as the date drew closer, the traffic on the list increased along with my excitement. At one point, someone sent an email asking who was going to be bringing real Apple //’s to the event. I was surprised to see how many people were bringing their old computers. I really wanted to bring my Replica One or my Apple //e but I didn’t trust the airline to treat them properly. I was only planning to bring my MacBook and an iPad.

But everyone seemed to be bringing a pile of cool old hardware. I needed to bring something so I looked around my room and saw my Curta mechanical calculator. That was something I could easily transport and people should be interested in that. So, I replied to the mailing list that I wasn’t bringing any of my Apple //’s but I would have my Curta.

Soon enough, I was in Kansas City and meeting people who I had heard of by watching the Apple // community. People like Ken Gagne, Tony Diaz, Geoff Weiss and more. I listened to John Romero describe the early days of game programming on the Apple // and the strange characters who wrote some of those classics. Randy Brandt talked about Beagle Bros. and the story of AppleWorks. Randy is a Canadian originally from Manitoba and we chatted for a short time about that. I met Vince Briel who created the Replica One which I built. I demonstrated the Curta to many people and it was definitely a unique bit of hardware at KansasFest.

At meals, people would often ask if I was working on a HackFest entry. HackFest is a programming competition where you create something during KansasFest and on the last day, everyone demonstrates their program. They are judged and winners are selected. I had a big project I was working on before KansasFest which was not eligible under HackFest rules and I planned to continue working on it throughout KansasFest. But everyone was encouraging me to do something for HackFest.

Walking back to the dorms afterwards, I started to think what I might do for HackFest if I was going to enter. Then I realized that what I should do is write a simulator of a Curta calculator for the Apple //. The Curta has a crank as its primary interface and I could simulate a crank using the joystick. With a bit of graphics and sound, I could make a pretty good simulation of a Cuta.

I started working on it right away. I used my MacBook and coded it in C using the cc65 cross compiler. I tested it using the Virtual ][ emulator. First, I got a basic simulation of the Curta working. I controlled the calculator using the keyboard on the first version and the output was just text. But that was the basics. I had something which worked and if all else failed, this could be my HackFest entry.

CurtaSimNext, I added graphics. I used the 280×150 resolution Apple // hi-res screen. The bottom of the screen has four lines of text which I used to display the output of the calculator. The graphical display allowed you to see the settings of the dials on the Curta. I coded this between sessions or in the evenings. While waiting for another session to start, I would open up my MacBook and code a bit more. Soon enough, I had graphics working.

But the controls were still through the keyboard. I really wanted it to be fully controlled using the joystick. So, I started coding those interfaces. I could adjust the dials. I could crank the calculator. Soon enough, I only used the keyboard to signal the program to quit. Everything else was controlled using the joystick which was kind of similar to the real Curta.

CurtaSimIt still wasn’t quite enough. It didn’t make any of the grinding and clicking sounds of a real Curta doing calculations. The Apple // is actually pretty good at making grinding sounds. A bit more work and I had something approximating the sound of a Curta coming out of the speakers. I pretty much built the application I envisioned while walking back from breakfast a couple of days before.

On the final day, I sat nervously in my room waiting for the judges to come and see my entry. Before the public demonstration, the judges spent some time looking at the entrants. Once they arrived, I announced that “Lots of effort had been put into emulating the Apple // on newer platforms but I thought it was time that the Apple // emulate an older computing machine”. I gave a demo of the simulator and answered a few questions about how I coded it. They seemed impressed and I thought I did well.

CurtaSimA little while later, I had to demonstrate my simulator to all of the attendees. I was the first entrant to demonstrate and I did calculations on the real Curta and on my simulation. Then, I watched as people demonstrated their entries. There was a cool lo-res game. There were a couple of entries on the Apple /// demonstrating graphics and sound. There was a great modification to Applesoft Basic which allowed you to jump to subroutines by name instead of by line number. And many more great programs.

The winners were announced and I thought I might place. Third place when to the named subroutine utility. And second place was the lo-res game. And then they said that I had won first place! I was really taken aback. While still trying to absorb that I had won, I was asked which of several prizes I would like. I opted for a $50 gift certificate to Think Geek but I am not sure I really knew what my options were. I was still kind of shocked I had won. Since then, I used that gift certificate to pick up a couple shirts and some new puzzles like a 7x7x7 Rubik’s cube (not solved, yet).

Since then, I have published the source code to my program on github, was a guest on the Open Apple Podcast talking about my experience at KansasFest. I even wrote an article for JuicedGS about my HackFest entry. JuicedGS is the longest running Apple // publication and is still in print (I am ashamed to admit I only became a subscriber after KansasFest). I even was mentioned online in more mainstream computer news. There is an article at ComputerWorld about KansasFest and HackFest where my CurtaSim is among those featured.

Will I be going to KansasFest 2013? I sure hope so.

Tic-Tac-Toe

Tic-Tac-ToeAt work one day, I walked past my director’s desk and noticed he had an editor open and was typing some C code. That was strange (not as strange as it might be in other companies – our director definitely is capable of coding but generally doesn’t). So I asked him what he was up to.

We were looking to grow the team and he was considering asking candidates to code up an implementation of tic-tac-toe as a test. That way, we can see how they approach problems and their coding style. But he wanted to see how difficult the task was before asking anyone to do it so he was trying it out.

Intrigued, I went home that night planning to write my own. I decided to do my implementation in Perl. I didn’t want to write any code for data structures so I just wanted to use a language which had basic arrays and hashes built in. After a short time, I had an implementation which worked and would never lose. It computed all possible moves and scored them. If you weren’t careful, it would beat you. But it was pretty slow. The first move took a couple of minutes on my iMac which is a pretty fast machine.

The other feature of my implementation was that the size of the board was configurable. I decided to try a 4×4 game and it was unplayable. After a couple hours, it still hadn’t made a move.

But, that was enough of a proof of concept. At work though, others started talking about writing their own implementations. People were going to try Python, or C++ or raw C. People said they were going to make an implementation which was faster than mine and still search all possible moves. I needed to do better before I was beaten.

So, I tried again. I ported my implementation to C. And I started adding more smarts. I noticed that I could skip several board configurations. Perhaps the board is a mirror image of one I have already looked at. Or maybe a rotation of one already investigated. So, I added a cache to keep the best move given a board configuration and added code to recognize that one board state is symmetrical with another. That significantly shrunk the space of moves to search.

Then, I added “Grand Central Dispatch” support. On the Mac, this allows you to schedule tasks to multiple cores on the processor. That way, I could investigate multiple board configurations concurrently. With these changes, a 4×4 game became playable. It took my Mac a couple of minutes to make the first move but once it had pre-calculated everything, it was fast.

And as a challenge, I decided I would see if I could get the 3×3 game working well enough on some of my older machines. I have a C cross compiler for my Apple //e and my Replica One. I ripped out the “Grand Central Dispatch” code because that would never work on these old machines. I shrunk the data structures and did a bit of math in my head to see if they would fit. I needed to store enough state for all possible games on my Replica One which had 32K of memory. After a bit of optimization, I decided it would fit.

I compiled the program for the //e and the Replica One and they worked. Again, it took a couple of minutes to make the first move as it investigated all possible games but after that it was fast. And this was on a 8-bit processor running at 1MHz with as little as 32K of memory. I figured I had done enough to defend my reputation since I had a usable version working on nearly 40 year old hardware. More than that, I had a version of tic tac toe running on hardware nearly 40 years old which I assembled myself with a soldering iron. I win the title of “king of the geeks” and none shall challenge me.

And to this day, I don’t think anyone has even attempted their own implementations. If anyone does come to challenge me, I think I will learn OpenCL which will let me put the game search on the GPU in my iMac and then I can get a huge amount of parallelism. Maybe 5×5 becomes playable that way. Maybe…

Matthew Learns to Type

Matthew’s handwriting leaves something to be desired. So does mine for that matter but it was becoming a problem at school. It was slowing him down and keeping him from getting his work done. The school suggested that he could have access to a laptop so he could type some of his work instead of writing it if only he could type quickly. Matthew needed to learn to type.

My first stop was the Mac App store. I searched for a good typing tutor and started with “UltraKey”. It seemed to be well reviewed so we tried that. He worked with that for a bit but he quickly got bored. UltraKey was definitely targeting an older user and Matthew wanted something more dynamic.

So, I picked up “Typing Tournament”. This was highly graphical with little games you play by being able to press the right key in time. It was definitely a good program for him and he started improving when using it.

But after a while, it seemed like his biggest problem was the keyboard. We have a wired Apple keyboard hooked up to our iMac. The keyboard actually is very much like a laptop keyboard. The keys are very shallow and one false move and you will type the wrong key. I figured Matthew might need to practice on an easier keyboard.

I have no shortage of computers and keyboard handy and the first one I thought of was the Apple //e I have. I have an old typing tutor on a 5 1/4″ disk and I pulled it out and booted up the machine. Matthew tried typing on the Apple //e for a short time and he did seem better. But then he moved to the machine to his left and just tried that keyboard. He said he really liked that keyboard and would like to use a typing tutor on that one.

Well, that was my Replica One which is a reproduction of an Apple 1 from the mid 1970’s. As far as I knew, there never was a typing tutor written for the Apple 1. But Matthew insisted that he liked that keyboard best. What should I do?

What I did is I wrote a typing tutor for the Apple 1. I had a C compiler working for that computer so I quickly coded something in C. It starts with a menu. One item on the menu allows you to select the set of keys you want to work with. You can focus on the home row, all letters, letters and numbers or all keys. Then you can either do a typing drill or the typing game.

The drill gives you eight characters randomly from the set of keys you are working with for you to type back. You type them and it tells you how many you got right and then gives you eight more until you decide to quit and press escape.

The game just prints a random character from the set you have selected over and over again until you press it. Once you press it, it prints a new random character. The goal is to press the key as quickly as you can and get as few characters printed as possible.

Matthew used the program a few times but he gravitated back to the Typing Tournament on the Mac. I guess the simple text based output couldn’t compete with the colourful graphics in that program. But Samantha liked using my typing tutor and probably used it more than Matthew.

I posted my program online for other people with a Replica One or maybe even a real Apple 1. According to the forums, my program has been downloaded 38 times which is pretty good I think.

Steve Wozniak at iPhone 4S Launch

IMG_0115I happened to be in Mountain View, CA for a short time on a business trip during the launch of the iPhone 4S. It was later in the day and I was thinking of leaving the office to get some dinner. Before I left though, I checked my news feeds to see if anything interesting was happening. That is when I read this article.

Steve Wozniak, the creator of the Apple // and one of the founders of Apple was in line to buy an iPhone 4S at the Los Gatos Apple Store. That was only about a 20 minute drive from where I was. This was my chance to meet someone who had seriously influenced the direction of my life.

I recently finished building my Replica One which is a replica of one of Woz’s first computer designs, the Apple 1. I grabbed a copy of a schematic of the Apple 1 and printed it out before leaving the office. My plan was to see if I could get him to sign it for me.

Once I arrived, I found Woz surrounded by a dozen or so people. And true to form, he seemed to be spending most of his time talking to the kids who were asking him what they should do be an engineer and build cool things. He gave great advice and I wish I recorded some video of what he was saying. I used my phone to get some pictures of him but it was tough with the low light and the crowds. Only two pictures ended up almost reasonable.

After he talked to a bunch of the kids, someone asked him for a picture and then another person on the crowd asked for him to sign something. I had my schematic, an iPad 2 which I was going to use as a surface for him to sign on and my pen in my hand. After a couple more people got their pictures or something signed, I got his attention and asked him to sign my document. I passed him the iPad 2 and schematic but he had a pen ready to go.

After starting to sign, his eyes focused more on what he was signing and he said “Hey, this is my design!”. I said it was significant to me because I had just assembled a Replica One and I planned to put the signed document next to my little piece of computer history. He said he loved the Replica One and thought it was great that some people still put systems together like they did back then with a soldering iron.

He finished signing the schematic and passed it back to me. I thanked him and probably had a crazy grin on my face and he went on to posing for more pictures or signing anything people brought to him.

Once I got home, we bought a frame for the signed schematic and it sits right now next to my Replica One and it reminds me often of the chance I had to meet Woz.

A Case for the Replica One

Replica OneI had already assembled my Replica One and powered it up to see that it worked. But, it was just a bare board. I had it connected to a power supply and a small USB keyboard. The Replica One didn’t have USB so I had it connected through a USB to PS2 adaptor. The whole thing sat on top of a piece of cardboard. It worked but it looked more like a bomb from a movie than a working computer. It needed a case.

Years ago, my dad and I build the Rand X computer together and that is where my hobby and my profession work in software began. I assembled the Replica One with help from Matthew. But I wanted a nice wooden case and for that, I wanted help from my dad.

We were planning a visit to Tillsonburg that summer so I prepared by drawing out a basic plan. I measured the key components. The motherboard is rectangular and I decided it would be best to have the long edge of the board run along the length of the case. The power supply would be to the left of the motherboard. Unfortunately, the power switch, serial port and video output would then have to come out the right hand side of the case. In the end, it seemed to be the best compromise so that is what we went with.

I arrived in Tillsonburg with some rough plans. It called for a shape which is more or less a rectangular box except the front, top slopes down where the keyboard is mounted. This approximated the shape of the Apple //. Also, I wanted the top of the case to be plexiglass so the board would be visible.

We sourced the plexi in London and went to pick up a piece. They cut it to the size we specified and when I asked, “how much?” they said not to worry about it. They had scraps bigger than that. We cut the panels to the appropriate sizes and shapes and screwed it together. We cut a large hole in the back panel for the power supply fan and power connector. We also cut a smaller opening on the right edge for the connectors on the motherboard.

We probably struggled the most with finding a good way to mount the board to our case. We ended up with small spacers which we screwed into the board and then screwed the spacers into the bottom of the case. It wouldn’t be too convenient to remove the board from the case but I didn’t plan to do that very often.

We drilled a small hole for the keyboard cable to pass through into the case so it could be connected to the board. Mom had some velcro which we often uses for their boat projects and we used to that connect the keyboard and the plexi to the case. After a couple of coats of varnish, we had a beautiful case for my Replica One.

Once I got the system home again after our trip, I remove the old piece of cardboard that everything used to sit on and cleared a spot for it on my desk. I hooked up the serial cable to the iMac and started loading programs onto it. I even got a C compiler working for the Replica One and I have coded a few things for it since then (more stories coming about that soon).

So, it sits beside me now in my computer room. I have many old computers here but it has a special place physically on my desk but also it means so much to me because of the work which went into it by Matthew, my dad and I.

Learning To Swim

IMG_2642Matthew and Samantha took some swimming lessons this summer. Some good friends of ours have a pool and wanted to put their son, Alex in some private lessons. Matthew and Samantha had the opportunity to join in also. Samantha had one on one lessons with the instructor and Matthew and Alex both had instruction at the same time. Both Matthew and Samantha showed great improvement in only one week of intensive lessons.

Samantha’s lessons were mostly about being more comfortable in the water. She spent much of her time jumping in and swimming around with a bit of flotation. Matthew made great improvements and by the end of the week, he could jump in the water from the deep end and then swim all the way to the shallow end and grab the far edge without any extra flotation.

Cynthia and I would like to get them in some more lessons this summer. Perhaps if they can get to be better swimmers, we may even consider getting a pool of our own.