Morse Assembly Language (MAL) is an esoteric programming language where you write Assembly code using only dots (.) and dashes (-) - like Morse code
Here's "Hello" in regular assembly vs Morse Assembly:
Regular Assembly:
MOV AX, 72
OUT AXMorse Assembly:
-- --- ...- / .- -..- / --..-- / --... ..---
--- ..- - / .- -..-
Create a file program.asm:
MOV AX, 5
MOV BX, 3
ADD AX, BX
ADD AX, 48
OUT AX
HLTpy src/morse_assembler.py program.asm program.morsepy src/morse_interpreter.py program.morseOutput: 8
- Each character is encoded as dots and dashes (e.g.,
A=.-) - Characters in a word are separated by spaces
- Words are separated by " / " (space-slash-space)
Let's decode: -- --- ...- / .- -..-
- Split by " / ":
[-- --- ...-][.- -..-] - Split each word by spaces:
- First word:
[--] [---] [...-]=MOV=MOV - Second word:
[.-] [-..-]=AX=AX
- First word:
- Result:
MOV AX
MOV- Move dataADD- AdditionSUB- SubtractionOUT- OutputHLT- Stop program
LOOP:
OUT AX
INC AX
CMP AX, 10
JNE LOOP
HLTAX,BX,CX,DX- General purposeSP- Stack pointerIP- Instruction pointer
python3 src/morse_interpreter.py --decode ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."python3 src/morse_interpreter.py --encode "HELLO WORLD"- Start with regular assembly
- Use the assembler to convert to Morse
- Test with the interpreter
- For debugging, use the
--decodeflag to see what your morse code means
- Educational: Learn Assembly and Morse code
- Challenging: Try writing complex programs
- Fun: It's an esoteric language and it's assembly but harder
- Historical: Honors the legacy of Morse code
- Read through the example programs
- Modify them to do different things
- Write your own programs
- Challenge yourself to write directly in Morse!
... .- -... -.-- / -.-. --- -.. .. -. --. -.-.--