Close

Key to Lookup Index Algorithm in 6502 code

A project log for Mystery 6502 program for the Kim Uno #1kBChallenge

The #1kBChallenge inspired me to dust off the Kim-Uno and write an Enigma Z30 simulator. This is a very rare numbers only Enigma Machine.

Arduino Enigma 12/04/2016 at 13:530 Comments

The algorithm shown in the table below ends up being 18 bytes of code...

Key In 7
Add Rotor 8
Add 1 9
Over 9? Sub 10 9
Sub RingSt 4
Negative? Add 10 4

;CALL_WITH_A_KEY_TO_ENCODE ;CALL_WITH_X_OFFSET_TO_ROTOR ;REM_SUB_ENRING 0103 ENRING 0103 SEC 38 0104 ADC *ROTORS,X 75 57 0106 CMP #$0A C9 0A 0108 BCC ENRIK1 90 02 010A SBC #$0A E9 0A 010C ENRIK1 010C SEC 38 010D SBC *RINGST,X F5 53 010F BCS ENRIK2 B0 02 0111 ADC #$0A 69 0A 0113 ENRIK2 0113 CLC 18 0114 RTS 60

Discussions