Old Languages and New Hardware

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Hello,

I only know Java which I consider to be a fairly modern language- it is an internet era language after all. So, I understand how Java has GUI functionality, and packages for input/output and networking.

But what about old languages? C is a good example. C is very popular and powerful, but it was designed before the internet and modern hardware existed.

How would you use a language like C to write software that communicates with a modern device like a DVD player for example if that language was written before DVD players even existed?

Do these languages have standard libraries that get updated by upkeepers?

Is that the metric for when / how a language dies? When no one updates it any longer?

Thanks.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
13
81
www.markbetz.net
First of all, remember that everything ultimately happens in machine language. In other words, regardless of what language and runtime are used to execute a set of instructions, ultimately they have to be translated down to opcodes that the processor can run.

At that level communication with devices, file systems, memory, etc., is accomplished using very primitive operations like moving a word of memory to a port, or a register, or writing it to a location in memory. The old 8042 keyboard controller chip on the PC, for example, was communicated with using two IO ports (60 and 61 I think), one to send commands and one to receive data back.

So if you have a language that can be compiled down to opcodes for a particular processor, then you can use it to do pretty much anything that processor and system are capable of doing. You could use C or assembly today to write code to run directly on a new Core i7 chip and do whatever you want to it and the peripherals.

But of course very few people are actually capable of doing that, so what you can accomplish is more typically limited by the capabilities of higher level libraries and frameworks of code that has already been written. I don't have to write code to control the 8042 keyboard chip (which no longer exists discretely anyway), because standard high level methods for that have existed in the C library for years, and in every library and framework that deals with user input since.

And yes, languages like C are still kept current, and they have standard packages that are maintained. C is still a very important language in system development, and especially in embedded systems (firmware in your router, for example) where tolerances and resources are very tight.

And yes, I would say that is as good a metric for language death as any: when use drops to the point where nobody is willing to put in the effort to keep the language and related libraries up to date.
 

LevelSea

Senior member
Jan 29, 2013
943
53
91
There are even languages older than C that are still kicking, COBOL and Fortran for example. Most of these you'll find in niche markets though, like COBOL in business apps and Fortran for scientific computing.
 

Merad

Platinum Member
May 31, 2010
2,586
19
81
You don't communicate with devices using "C" or "Java" you typically communicate with some system of messages whose exact format depends on the device. I can't tell you precisely how it works for something like a DVD drive, but conceptually this is what's going on:

Let's say that I have a program that uses microcontrollers to obtain sensor data. We decide ahead of time that all communication will happen using several serial ports at 9600 baud using 8N1 configuration. The exact sensor configuration can vary.

When my program starts up and initializes, it needs to determine what configuration is attached to the machine. So it polls each of the possible serial ports with a query message, "Hello, is anyone there?" No answer on port 1. So we assume nothing is attached to port 1. On port 2 we get a reply, "Hello, I am sensor unit J57". Ok, there is something on port 2. Now we need to know what it can do, so we ask, "Hello J57, what are your features?". We get a reply along the lines of "I have can control 5 temperature sensors, however only sensors 1, 2, and 5 are currently connected." Then at some later point in the program when we want information we send messages like "What is the temperature of sensor 2?" or "Send me the reading from sensor 5 every 10 minutes", and we'll get responses with the information we need.

In the real world these message are usually sent in binary, so you can send them from almost any programming language (though it tends to be easier in stuff like C/C++).

In normal usage you are using the operating system to make general requests from a device like "open this file on the DVD". The operating system sends the request to the device driver, which translates the request into the specific messages that the device recognizes. Finally the firmware on the device receives the message, performs the actions necessary to carry out the request, and sends back any data.