Enigma Z30 Machine Simulator in 6502 code running on KIM Uno
- arduinoenigma
- Posts: 9
- Joined: 12 Dec 2016
- Contact:
Enigma Z30 Machine Simulator in 6502 code running on KIM Uno
I bought a KIM Uno (a Kim 1 clone) on a whim. http://obsolescence.wixsite.com/obsoles ... mary-c1uuh
Pretty soon I realized that to make it useful, learning 6502 assembly was a must. To learn assembly, I wrote a clock program that is 53 bytes long. After that, the calculator sat waiting for another program...
Hackaday is currently running a 1kB challenge. The goal is simple, write a program in under 1kB of code, including tables and any other routines called.
My most recent program is entered in this challenge and simulates an Enigma Z30 Machine, a very rare numbers only enigma machine. The program is 460 bytes long and it uses 150 bytes of KIM ROM routines to read the keyboard and display numbers.
https://hackaday.io/project/18644-myste ... bchallenge
There is a link to the github repository in the Hackaday.IO page.
You can also see my other projects there...
Pretty soon I realized that to make it useful, learning 6502 assembly was a must. To learn assembly, I wrote a clock program that is 53 bytes long. After that, the calculator sat waiting for another program...
Hackaday is currently running a 1kB challenge. The goal is simple, write a program in under 1kB of code, including tables and any other routines called.
My most recent program is entered in this challenge and simulates an Enigma Z30 Machine, a very rare numbers only enigma machine. The program is 460 bytes long and it uses 150 bytes of KIM ROM routines to read the keyboard and display numbers.
https://hackaday.io/project/18644-myste ... bchallenge
There is a link to the github repository in the Hackaday.IO page.
You can also see my other projects there...
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
Great combination of technologies - I love it! And welcome...
- arduinoenigma
- Posts: 9
- Joined: 12 Dec 2016
- Contact:
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
I see you found [lpaseen] meinEnigma...
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
Ah yes, meinEnigma!
For a time one could buy an Enigma-E kit at the Bletchley Park museum - they were a bit expensive, and last I looked were no longer available. Or maybe they are, but not at BP.
For a time one could buy an Enigma-E kit at the Bletchley Park museum - they were a bit expensive, and last I looked were no longer available. Or maybe they are, but not at BP.
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
You you have the tables for the rotors and
the kick carries?
Dwight
the kick carries?
Dwight
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
I just watched "The Imitation Game" about Turing and Enigma.
And the thing that went through my mind watching it was "I bet the props guys had a blast building 'Christopher'", the machine used to try and break the code. I doubt it was an operating, it was just a big box of spinny things, but I bet they had fun getting that build.
And the thing that went through my mind watching it was "I bet the props guys had a blast building 'Christopher'", the machine used to try and break the code. I doubt it was an operating, it was just a big box of spinny things, but I bet they had fun getting that build.
- arduinoenigma
- Posts: 9
- Joined: 12 Dec 2016
- Contact:
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
dwight wrote:
You you have the tables for the rotors and
the kick carries?
Dwight
the kick carries?
Dwight
http://www.tandfonline.com/doi/full/10. ... 15.1055387
use http://sci-hub.cc/ to download.
The wiring is also listed in this Wikipedia article. The wikipedia page quotes the Wik article.
https://de.wikipedia.org/wiki/Enigma-Z
The stepping points are at 9 with the ring setting of 1. The article seems to imply that changing the ring setting moves the stepping point. The machine is suffers from the double stepping anomaly. The leftmost rotor, when at the stepping point, can cause the reflector to its left to step.
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
whartung wrote:
I just watched "The Imitation Game" about Turing and Enigma.
And the thing that went through my mind watching it was "I bet the props guys had a blast building 'Christopher'", the machine used to try and break the code. I doubt it was an operating, it was just a big box of spinny things, but I bet they had fun getting that build.
And the thing that went through my mind watching it was "I bet the props guys had a blast building 'Christopher'", the machine used to try and break the code. I doubt it was an operating, it was just a big box of spinny things, but I bet they had fun getting that build.
On the Engima machine (not sure about the Z30 but the 'normal' Enigmas) the double stepping is also interesting and a subtle detail. It's not actually just the middle rotor that does it. The bottom rotor does too but you don't see it because it steps every key press anyway. It's a side effect of how the mechanism works. Basically whenever a rotor steps the rotor below it also steps. The M4 (four rotor) version of the Engima doesn't have double stepping on the third rotor though because the fourth rotor doesn't have any stepping mechanism as that rotors position is only ever set manually. Then the Enigma-G machines don't have the double step at all since they used a different mechanism.
Fascinating machines!
Props making is an interesting business. I hassle the props guys at work when they make things and use random junk they find (usually our electronics bits, connectors, cables and so on) saying some poor sod in the future will be wracking their brain trying to work out exactly what that thing used in the prop is and not being able to ever work it out because it was literally just some random junk they glued on!
Simon
My 6502 related blog: http://www.asciimation.co.nz/bb/category/6502-computer
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
> The top row actually moves around a revolution and a half before stepping the middle row
Subtle indeed! Knowing to look for it, I can see it at
https://youtu.be/Dr1U7Bva6Sw?t=1m25s
but wouldn't have noticed. The other nice thing, as I understand it, is that the fast wheels can't and don't stop immediately on a stop - they are going too fast:(From here)
I note that a later, US Navy, development, used valves (tubes) to capture the stop setting and so could spin the drums very much faster: (from here)
According to the NSA Cryptologic Museum (who have one on display) this allowed the decode of four-rotor Enigma.(From here)
What intrigues me about the Bombe is the use of bidirectional steering logic - I don't know of any efficient way to do the same in software, or indeed in FPGA.
Subtle indeed! Knowing to look for it, I can see it at
https://youtu.be/Dr1U7Bva6Sw?t=1m25s
but wouldn't have noticed. The other nice thing, as I understand it, is that the fast wheels can't and don't stop immediately on a stop - they are going too fast:
Quote:
When the bombe detected a stop it recorded the position of the upper row of drums on one of 26 relays. The turning of the middle and lower rows of drums was inhibited and the motor allowed to slow down. The upper row of drums was then rotated into the position recorded by the relays. The bombe thus halted in the correct position and the stop position was noted by the operator and the bombe was restarted.
I note that a later, US Navy, development, used valves (tubes) to capture the stop setting and so could spin the drums very much faster:
Quote:
The US Navy bombes used drums for the Enigma rotors in much the same way as the British bombes. They had eight Enigma-equivalents on the front and eight on the back. The fast drum rotated at 1,725 rpm, 34 times the speed of the early British bombes. 'Stops' were detected electronically using thermionic valves (vacuum tubes)—mostly thyratrons—for the high speed circuits. When a 'stop' was found[57] the machine over-ran as it slowed, reversed to the position found and printed it out before restarting. The running time for a 4-rotor run was about 20 minutes, and for a 3-rotor run, about 50 seconds.[58] Each machine was 10 feet (3.0 m) wide, 7 feet (2.1 m) high, 2 feet (0.61 m) deep and weighed 2.5 tons.
According to the NSA Cryptologic Museum (who have one on display) this allowed the decode of four-rotor Enigma.
Quote:
Over the course of the war 121 U.S. Navy cryptanalytic Bombes would be built by Navy personnel at Dayton's National Cash Register Company and shipped to the Navy's Communications Annex in Washington, D.C.
What intrigues me about the Bombe is the use of bidirectional steering logic - I don't know of any efficient way to do the same in software, or indeed in FPGA.
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
My desktop model does the rotation and a half and also simulates the slowing down phase when a stop is found. The thing to remember about the Bletchley Bombe is that it was (is) a purely mechanical/electrical device. Physical contacts are being made and broken all the time. Must have been a lot of work keeping them running!
I think when I did mine I initially missed the fact that it was bi-directional. I approached it from a top down software type approach then only later realised that current in the machine flows everywhere, not just one direction. I did write up how my algorithm works (http://www.asciimation.co.nz/bb/2015/06 ... basic-code) but I can't really remember the details now but I do say it is inefficient!
My little machine is still one of my favourite things I have ever made but it is understood by very few people! Was a fiddly little project.
Simon
I think when I did mine I initially missed the fact that it was bi-directional. I approached it from a top down software type approach then only later realised that current in the machine flows everywhere, not just one direction. I did write up how my algorithm works (http://www.asciimation.co.nz/bb/2015/06 ... basic-code) but I can't really remember the details now but I do say it is inefficient!
My little machine is still one of my favourite things I have ever made but it is understood by very few people! Was a fiddly little project.
Simon
My 6502 related blog: http://www.asciimation.co.nz/bb/category/6502-computer
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
It's a great project! Not in any way to downplay the Enigma project that started this thread, but a Bombe project is I think a different order of complexity. (An Enigma project probably has a bigger audience, that being the nature of the difference between encryption and codebreaking.)
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
BigEd wrote:
It's a great project! Not in any way to downplay the Enigma project that started this thread, but a Bombe project is I think a different order of complexity. (An Enigma project probably has a bigger audience, that being the nature of the difference between encryption and codebreaking.)
The Bombe is still one of my favourite machines though. Beautifully complex and hard to understand but so mechanical and alive. Most people don't have the patience for that sort of thing these days. Obviously people in a forum like this are exceptions! I remember being very pleased when I finally understood exactly what the diagonal board does. I still think it was a shame they completely left Gordon Welchman out of the Imitation Game.
I would love to get to try a real Enigma machine. I have heard rumours Peter Jackson has one. If so it's probably the only one in NZ.
Simon
My 6502 related blog: http://www.asciimation.co.nz/bb/category/6502-computer
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
I bet if you contacted Jackson about your project you could get show your toys^H^H^H^H artefacts to each other (reaching out to people is surprisingly effective, and always worth a try.)
I've read a lot of negative things about The Imitation Game, and I haven't made any effort to see it, but maybe it did some good!
The diagonal board was a game-changer. I'm still struggling!
Have you read of The Dollis Hill Dragon? It was a relay-based machine for dragging cribs through ciphertexts to see if they were promising. The original was by an individual American, and worked but destroyed its relays fairly quickly, and the Dollis Hill (Post Office Research) people were able to re-implement a reliable version. (This was for Tunny, aka Lorenz, not for Enigma.)
I've read a lot of negative things about The Imitation Game, and I haven't made any effort to see it, but maybe it did some good!
The diagonal board was a game-changer. I'm still struggling!
Have you read of The Dollis Hill Dragon? It was a relay-based machine for dragging cribs through ciphertexts to see if they were promising. The original was by an individual American, and worked but destroyed its relays fairly quickly, and the Dollis Hill (Post Office Research) people were able to re-implement a reliable version. (This was for Tunny, aka Lorenz, not for Enigma.)
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
I visited a small local war museum last summer, it's just a tiny thing, one-person operated, limited opening hours, located in an old ww2 German-built bunker.
So I was very surprised when I found that they had a real Enigma machine on display.
So I was very surprised when I found that they had a real Enigma machine on display.
- arduinoenigma
- Posts: 9
- Joined: 12 Dec 2016
- Contact:
Re: Enigma Z30 Machine Simulator in 6502 code running on KIM
Tor wrote:
I visited a small local war museum last summer, it's just a tiny thing, one-person operated, limited opening hours, located in an old ww2 German-built bunker.
So I was very surprised when I found that they had a real Enigma machine on display.
So I was very surprised when I found that they had a real Enigma machine on display.