barrettotte / c64-tea

Tiny Encryption Algorithm (TEA) for Commodore 64 using BASIC and 6502 ASM

Repository from Github https://github.combarrettotte/c64-teaRepository from Github https://github.combarrettotte/c64-tea

c64-tea

Tiny Encryption Algorithm (TEA) for Commodore 64 using BASIC and 6502 ASM.

I saw this was called "Tiny Encryption Algorithm" and wanted to test if it was "tiny" enough to run on a Commodore 64. I also wanted to get practice with using machine code in BASIC programs and refresh on 6502 assembly.

The BASIC is just the user interface and the 6502 assembly is for all the heavy lifting for TEA.

Technically I could have compiled a C implementation to the 6502 architecture, but I like to mess around with assembly when I get the chance and LARP as a 1980s developer.

Running

python build.py

This does the following

  • compiles tea.bas to build/tea.bas.prg using petcat
  • compiles tea.asm to build/tea.asm.prg using kickassembler
  • combines tea.bas.prg and tea.asm.prg into tea.prg
  • launches VICE emulator with tea.prg

Encryption

./docs/encrypt.png

Decryption

./docs/decrypt.png

Development

Install development dependencies:

Examples of TEA in C and simple BASIC/ASM programs can be found in ./learn/.

Debug PRG Loading

# Verify PRGs loading correctly from D64

LOAD "TEABAS",8
LIST 10-50

LOAD "TEAASM",8,1
LIST 10-50

# monitor: verify assembly prg loaded correctly
m c000 c01f

# monitor: verify basic prg loaded correctly
m 0801 081f

# check BASIC pointers
#   $2B-$2C start of BASIC (01 08)
#   $2D-$2E start of vars (VARTAB), should point right after TEAMAIN
#   $2F-$30 start of arrays
#   $31-$32 end of arrays
m 2b 32

References

About

Tiny Encryption Algorithm (TEA) for Commodore 64 using BASIC and 6502 ASM

License:MIT License


Languages

Language:Assembly 41.1%Language:Python 22.5%Language:C 20.0%Language:BASIC 16.4%