Speech and writing were separate, and then came together in syllabaries and alphabets, to produce the complexity that became a written and spoken language.
Language is only one, if complex, method of communicating. Other methods include pictoral signs (an obvious link between the sign what it represents), signs understood by culture and convention (otherwise not obvious), vocal gestures, body and face gestures, touching, involuntary gestures (like body language) and gestures of paralanguage (where more complex meaning is transmitted by gestures according to convention).
Speech and language are not the same. Language is an abstract constructed system, and speech just conveys this. Speech is given and then fades away to memory only. And so language is also carried by writing, which is a fixed form (for some time period) and can be consulted again. Writing followed speech and art in human development, and took many variations and each took a long time to develop and refine.
Art was developed in order to record, a principal function of language. We imagine that the first humans who ran and hunted needed to picture the animals of their area. There may have been sacred overtones to picturing too.
Writing developed from picturing objects. The Sumerians in Mesopotamia developed writing around 5000 years ago with the use of pictograms called cuneiform as did the Egyptians with hieroglyphics. Writing was limited to recording on natural materials. The images used there and elsewhere became stylised and a little divorced, if still connected, from the object. However, there was also a need for signs to convey mental constructs without pictoral reference. A shortcut was to makes signs of objects to convey someone's name, called the rhebus principle.
Up to this point the use of signs was for communication but language is a more complex affair, full of its own internal rules for subtlety of meaning. Signs are developed to pronounce sounds in order to have building blocks of subtlety as indeed in language.
The first alphabets were therefore in fact syllabaries, where a sign represents a syllable. Japanese is like this. Syllabaries seem economic in use, but become clumsy, especially with accents and similar sounding but different words, and the need for plurals means it is simpler to add on a mark which is not a syllable sound in itself.
Thus alphabets proper are created. The simplest have one letter for one sound (phoneme). Words are therefore certain in their pronounciation. This is the case with Russian in Cyrillic and Welsh (where because Welsh has more letters that English two letters represent what would be one in some cases. Incidentally where the Roman alphabet is used for Russian on the Internet, Russian has added markings as it has 33 letters).
More complex alphabets developed a distance between spellings and sounds. This is the case with the English alphabet, and even the bowlderised American equivalent.
After this, there is a requirement of codes, often mistaken as alternative alphabets when they are codes of an existing alphabet. The signs of the alphabet simply cannot transmit in certain circumstances.
The purpose of code is to be reconstitued back into the alphabet and thus easily understood under the same language. ASCII is a computer code that draws on the necessity of binary (0 or 1, off or on), and then the fonts reproduce the letter, letter and addition, number, space or punctuation that is the code.
Rather than hold up big letters on ships (!) flags were used in a semaphore code (illustrated below).
So for the purposes of early electrical transmission of the alphabet a suitable code was created for its rapid reconstruction at the receiving end. This was morse code (illustrated below).
It was far easier to use raised dots than raised typescript for the blind reader (illustrated below).
Thus the alphabet was developed as far as it could go - until mobile phones and email have now brought about a situation where, for speed, new syllabaries, acronyms and smilies (pictograms) have been developed by users to add to the alphabet, in order to to speed up typing on a limited telephone keyboard and add emotions and qualities to the blunt presentation of simple text.
Source: Tinkel, A. J. (1988), Explorations in Language, Cambridge University Press.