Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

hardware is still coded with machine/assembly language for efficiency, speed, etc.

Status
Not open for further replies.
I'm not sure how this applies to what I was saying at all, you're comparing hand optimized ASM code designed for a specific purpose to a general purpose operating system, there is no relevant comparison to be had they have nothing to do with each other. ...

Any code Linus Torvald wrote can still be improved by recoding it in ASM for the specific platform. ...

The only modern reboots to the OS so far have been IOS, Android, and Microsoft is starting to edge in slowly. They achieved this via a complete reset of the entire system. Going to be a rough next 10 years for software developers.

I was showing each language at it's optimum level in the comparison. CPU bound "ASM" demo and DATA bound "HLL" OS.

Your words were, "higher level programming languages are only required for complex problems if the person that's programming it has a simple mind" as a predicate.

The code base for Linux will not be improved by recoding as it's speed on bare metal hardware is as good as native performance when tuned for RTOS mode.

BTW, Android is a Linux fork. https://en.wikipedia.org/wiki/Android_(operating_system)#Linux
 
Last edited:
Back in the mid 70's, high school era+, part of a team that of two that added scope rubouts for VT100 terminals to the PDP-11 RSTS operating system time sharing terminal handler. RSTS was a 32 user time sharing Operating system.

Well, I had to do button and display multiplexing in 6800 assembly as part of a class.

Then I did a motorized gantry crane for a model crane (COSMAC 1802 Assembly): 3 rows of 9 boxcars, a motorized oval loading dock and Z was a motorized electromagnet. Everything was compiled by hand. It was just about the time the PC came out. Later I did the same project with a single board basic computer and managed to get X and Y moving at the same time.
 
Last edited:
I was showing each language at it's optimum level in the comparison. CPU bound "ASM" demo and DATA bound "HLL" OS.
There is no 'optimum level' I can't even quiet figure out how you can rationalize the statements CPU bound ASM demo and DATA bound higher level languages, what do you even mean by data bound or cpu bound? There's nothing that can't be done in ASM that can only be done with a HLL or vs versa and ASM will always be faster given enough time is put into optimizing the ASM, the only reason for HLL's is to save time and reduce the amount of detailed information required by the programmer to obtain a given set of functional software abilities. In modern times due to hardware fragmentation it's impossible to practically program in ASM due to the diverse hardware that things are run on.

The code base for Linux will not be improved by recoding as it's speed on bare metal hardware is as good as native performance when tuned for RTOS mode.
This is blatantly false, the reason it's speed on bare hardware is so good is because so much of it is based on good assembly programming foundations and a reduced as much as possible amount of overhead. Given any static system you could recode many things with inline assembly to increase system speed, but again it's at time/effort vs payback potential that is the only reason it doesn't occur more.

I'm well aware Android is a Linux fork it has the same problem as all Linux distributions because of it of hardware/software fragmentation. Even though there are more Android devices developers still prefer IOS because programming for Android requires a higher number of programming hours for the same product due to the different Android versions, and difference in device hardware support for various features, but this is neither here nor there in relation to ASM vs higher level languages.
 
Last edited:
hello pg1995,

The real difference between assembler and a high level language is that with assembler there is one step to generate hex code for your program. High level language must compile your program from libraries written by someone else then assemble the compiled program to hex.

You have a far more control and precision with assembler.

You are relying on someone else's programming with high level programming.

This is my first post. Hope it helps.

jlpelect5
 
Hello misterT,

Not the most complex but, wrote a program to modulate varying pulse widths at 38khz with a 25% duty cycle.

jlpelect5
 
Hello KeepItSimpleStupid,

Yes it is. The circuit has the ability to read any remote button by button and then store them in eeprom.
Through a rf trigger (433mhz) the circuit will output the stored info with preproggrammed delay's .

Reading one of your post, i was roflmao when I saw PDP-11

jlpelect5
 
Last edited:
If you have a bike and need to cross the street it's better just to run.

10 yards: legs
But at
100 yards: ?
1000 yards: ?
1 mile: ?

Clearly there is a point where effort (mental or physical), speed, efficiency and the ability to maintain and improve favor a mechanical advantage. Yes there are exceptional people who can run 100 miles but is that the best way to get there?
The process of computer programming operates on the same level.

On the topic of what have you done in ASM. My first real taste of a large ASM coded project was the OS for the H-series machines called VULCAN. It was a total maintenance nightmare. Not because it was poorly written but over the years the specifications for it had become so complex it became almost impossible to verify and had become totally dependent on the hardware quirks in the cpu platform during the process of making it run faster when features were added over the years.

I wrote special device drivers using "system services" on a interface project with custom hardware in assembler and FORTRAN.
https://www.electro-tech-online.com/custompdfs/2012/04/AA61770-0_VULCAN_Spec_Jan75.pdf
https://www.electro-tech-online.com/custompdfs/2012/04/0862005-003_vulcanOvr_May78.pdf
 
Last edited:
You have a far more control and precision with assembler.
You are relying on someone else's programming with high level programming.

Have you ever programmed microcontrollers with C? Can you show an example where ASM "has far more control and precision" than C.

Ok. C is not a very high level programming language, so in that respect the above is true. If I use something like Java or C# then I would quite heavily rely on someone else's programming.
 
Last edited:
The process of computer programming operates on the same level.
No it does not, the difference is that exceptional programmers can make a computer run dozens, hundreds, if not thousands of times more efficiently if they're applied properly. The comparison to the human example you gave would be a runner that can run 1000 miles per hour.

I liken it to more towards the spectrum of light, where it starts going into the UV range. Outside of the direct heating effects no matter how brightly you shine a light on a bacteria or a mold you can not kill it until the frequency of the light breaks past a certain point which is in the low UV range. You can toss a hundred dumb programmers and make something work, but if you toss one great programmer it will work better and faster.

The problem actually is our demand for software advancement and functionality in the short term is so high in relation to the time it would take to do it properly that the only way to get software products on the market is to use higher level languages. ASM is still superior in every way at being able to fully utilize available resources. The issue is mollified by Moores law staying roughly true.
 
MisterT said:
Have you ever programmed microcontrollers with C? Can you show an example where ASM "has far more control and precision" than C.
A very specific and absolute example is in measurement and calculation, as the number of measurements or calculations approaches the time constant of the procoessor that the program is running on ASM becomes more and more desirable, and after a certain point I'm unable to define doing high precision timing and measurement applications become impossible in C and only ASM can work.

We're spoiled because of Moores law as I stated in my last post. We can do more and more with C not because it's good efficient or powerful, but because the hardware is so much faster nowdays that ASM doesn't have as much of a practical application until the absolute limits of current technology.

This is the heart of why the demoscene exists, is to show what can be done in ASM with modern hardware. In order to do these types of real time visual effects using modern C based software would require (and does) room and building sized super computers. Seriously, actually run a few demo's on your computer (better be a fast one) and compare that to what you visually see in movies and the like that take weeks, months or years to render on sever farms.
 
Last edited:
We can do more and more with C not because it's good efficient or powerful, but because the hardware is so much faster nowdays that ASM doesn't have as much of a practical application until the absolute limits of current technology.

I do not understand why you think C is a high level language.. it really is not far away from ASM. C is the next closest thing to "hardware level" programming. It is very efficient and powerful.. if you would just take some time and learn the language before comparing it to asm.
 
hello pg1995,

The real difference between assembler and a high level language is that with assembler there is one step to generate hex code for your program. High level language must compile your program from libraries written by someone else then assemble the compiled program to hex.

You have a far more control and precision with assembler.

You are relying on someone else's programming with high level programming.

This is my first post. Hope it helps.

jlpelect5

Hi Jlpelect5

Thank you for the input and welcome to the forums! :) I'm sure you are going to have a good time here and let me tell you it's one of few forums where people are really nice and helpful without being arrogant and snobbish.

Regards
PG
 
There is no 'optimum level' I can't even quiet figure out how you can rationalize the statements CPU bound ASM demo and DATA bound higher level languages, what do you even mean by data bound or cpu bound?

In a CPU bound process the speed of the entire process increases with a more efficent coding and/or processor. When a process is DATA bound the speed of processing does not increase with more processor or efficent coding because the time to complete the task is not a simple linear math problem but could be a control problem with asynchronous data dependencies like a OS.

A simple example.
A data system written in C reads a byte of data from a port due to an interrupt once every 1ms from a sensor, sends a byte to another system that also reads data from a interrupt once every 1ms from a sensor, waits for the reply, processes the result and then sends it to another port when it receives a interrupt request every 10ms from that system for possible new data sent to a logging device.

Once the program speed is sufficently fast to handle the tasks for a correct result in the time period needed recoding it in ASM, BASIC, COBOL or even a faster processor will not make it faster.
 
Last edited:
misterT,

I do not understand why you think C is a high level language.. it really is not far away from ASM.

I am a little rusty in C, but can't you add two arrays of the same size and shape together with one statement? Of course with ASM, you have to set up a loop counter whose value is the same size as the arrays, then add each element of the array and store it back. C does the same thing, of course, but you don't have to worry about the details. That's why I would call C "high level".

Ratch
 
nsaspook,

Once the program speed is sufficently fast to handle the tasks for a correct result in the time period needed recoding it in ASM, BASIC, COBOL or even a faster processor will not make it faster.

Yes, a computer is only as fast as its slowest operation, whether it is memory access or I/O. Having a Gee Whiz CPU does no good it unless its support systems are able to keep up with its speed.

Ratch
 
C is very close to assembly. I know a guy that tends to debug his C programs by looking at the assembly code that C produces.
 
MisterT said:
I do not understand why you think C is a high level language.. it really is not far away from ASM. C is the next closest thing to "hardware level" programming. It is very efficient and powerful.. if you would just take some time and learn the language before comparing it to asm.
There are four levels of programming language.
Machine code, which is what actually exists in classical processors. ASM, which is one step above that attempts to make this human understandable by naming things in human language as opposed to raw byte values, and then everything else above that which increase the level of abstraction and distance from ASM. Then there are hardware description languages for CPLD and FPGA type devices that are bellow even ASM, though abstracted because they're not clasic devices, you define them.

nsaspook said:
Once the program speed is sufficently fast to handle the tasks for a correct result in the time period needed recoding it in ASM, BASIC, COBOL or even a faster processor will not make it faster.
I never said it would, it will however make it more efficient which will use fewer cycles meaning less power.

A simple example.
A data system written in C reads a byte of data from a port due to an interrupt once every 1ms from a sensor, sends a byte to another system that also reads data from a interrupt once every 1ms from a sensor, waits for the reply, processes the result and then sends it to another port when it receives a interrupt request every 10ms from that system for possible new data sent to a logging device.
This is what I was trying to get at with my statement that the need for use of ASM vs higher level languages follows a gradient vs the available resources.
C is used because the available resources are astonishing. If we used them well we could do more with what we have.

Machine code is absolute, (outside of the programmable logic alternative) ASM is good the real killer to efficiency with that is macros which improperly used cause massive code bloat. This bloat extends into higher level languages.
 
Last edited:
KISS,

C is very close to assembly. I know a guy that tends to debug his C programs by looking at the assembly code that C produces.

That is an insufficient reason to call C "close" to assembly.

Ratch
 
Hello misterT,

I started out with microsoft assembler using MASM611 programming 8086, 286 and 386. Then I dabbled with C++ and Visual C++, was not long before I went back to assembly.
Was not impressed with overhead and using someone else's programs that I had no control of or limited amount of control.

Programming in assembly language can be precise to one clk. In the debug mode I can step my program one
instruction at a time.
The achitecture of the atmel microcontrollers is called "pipeling", which means when I execute an instruction
the next instrution is being loaded at the same time. Therefore almost every clk is a instruction.

If the odd few instructions needs more than one clock cycle I will see that in the debugger.

For example, using a 4mhz clock, I can see what is happening every 1/4 million'th of a second, and that is slow as
the chip is capable of 20mhz, (.05 million'ths of a sec)

jlpelect5
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top