This program is written in Netwide Assembler syntax for Intel x86 Architecture. It utilizes the 32-bit Linux System Calls. The program can be used for converting Latin Alphabet to the Morse Alphabet.
If you are using Windows, you can use WSL. Click here to learn how to install WSL in your system. If you are using a Unix-Like system, you do not need much if system calls are matching. Otherwise, you should modify the system calls.
nasm -f elf morse.asm
ld -m elf_i386 morse.o -o morse
orld -m elf_i386 morse.asm
(the output file will be a.out)
The program will work when you open the output file.
If you'd like to use the program without an OS but BIOS, you can use Ralf Brown's Interrupt List
Simply it gets a string and manipulates it. From there, finds the corresponding character sequence in morse alphabet of the bytes in this string from mapped data. Then starts to print the characters.
In morse alphabet, there are 2 sounds dit and dah. We use dot (".") for dit and dash ("-") for dah. Also, in morse alphabet, every letter becomes split by space. And every word becomes split by slash ("/").
Hello World in Morse: .... . .-.. .-.. --- / .-- --- .-. .-.. -..
Since the program is a prototype of advanced version of itself, it does not get input from the console but the text you want to convert is hardcoded. Also, it only converts uppercase English letters.
If you want to feed the program via console, you can add somethings like these:
SECTION .bss
input resb 255 ; adjust the 255
mov edx, 255
mov ecx, input
mov ebx, 0
mov eax, 3
int 0x80
mov esi, input
In that way, the source index will be set as the bytes which are input from console.
Sources