In what ways the assembly language can help us?

Programming, for all ages and all languages.
User avatar
IdiotOS
Posts: 9
Joined: Tue Jun 25, 2013 7:14 pm
Location: India

Re: In what ways the assembly language can help us?

Post by IdiotOS »

Is it possible to add GUI in assembly language?
User avatar
Minoto
Member
Member
Posts: 89
Joined: Thu May 12, 2011 7:24 pm

Re: In what ways the assembly language can help us?

Post by Minoto »

It's possible to write any program a computer is capable of executing in assembly. It just takes more effort than it's worth most of the time.
Those who understand Unix are doomed to copy it, poorly.
User avatar
XanClic
Member
Member
Posts: 138
Joined: Wed Feb 13, 2008 9:38 am

Re: In what ways the assembly language can help us?

Post by XanClic »

Casm wrote:
I don't see the point why access to CPU control registers, I/O ports* or the creation of interrupt handlers should actually be impossible in all high level languages.
Because that is not what high level languages do. The whole point of them is to use high level instructions which hide (and are not tied to) the underlying hardware.
They hide it, if you don't want to see it. I don't know why it should be forbidden to be visible if necessary.
Casm wrote:
JAAman wrote:ultimately everything becomes assembly
That's the point. Since everything becomes assembly, your compiler is theoretically capable of emitting every assembly code you could also write yourself.
The compiler emits whatever the compiler writer decided it should emit. Unless you are the person who wrote the code generator, you have no control over that.
GCC is free software, so of course I do have control if I really badly want to.
Casm wrote:
JAAman wrote:in other languages, you are not directly controlling the CPU, you are controlling the logic, therefore there can be nothing inherently in the language that can directly control the CPU...
And this, on the other hand, is wrong. Of course there can. There is no fundamental reason to restrict a compiler to emit only arithmetic-logical and branching instructions.
A "high level" language which could do every thing you can do in assembly language would almost by definition not be a high level language. It would at least have to be some kind of strange hybrid.
I don't see how that relates to my argument you've cited.

As I've pointed out, there actually is a way to access CPU registers with GCC (without inline assembly, although the “asm” keyword is indeed reused). GCC however only allows access to the GPRs, so access of CR3 is forbidden there. I guess it'd be pretty easy to change that, though.

I have a hard time understanding that a language can't be both high and low level at the same time (the hybrid you mentioned). If it can abstract the whole “low level” stuff, it is high level. If it doesn't, it is low level, obviously. In pure C (read: C without abusing undefined constructs), I'm stuck at high level (with a pretty “basic” set of functionality). In assembly, I'm stuck at low level. What's the problem with having languages that allow you to access low level stuff in a high level manner and not having to deal with that low level if you don't need to?

I do see your point if you forbid the existence of such languages. I however don't see why they should be forbidden.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: In what ways the assembly language can help us?

Post by Kevin »

XanClic wrote:This is already ignoring the fact that most of us (if not all) are horribly abusing C/C++ already by doing basically completely undefined pointer operations (ever casted an integer to a pointer that wasn't created by casting a pointer to an integer?).
They are implementation defined, not undefined. Otherwise we'd be in big trouble.

Glad that you already found on your own how the gcc syntax for binding variables to registers works, that would have been my second comment. ;)
Developer of tyndur - community OS of Lowlevel (German)
User avatar
XanClic
Member
Member
Posts: 138
Joined: Wed Feb 13, 2008 9:38 am

Re: In what ways the assembly language can help us?

Post by XanClic »

Kevin wrote:
XanClic wrote:This is already ignoring the fact that most of us (if not all) are horribly abusing C/C++ already by doing basically completely undefined pointer operations (ever casted an integer to a pointer that wasn't created by casting a pointer to an integer?).
They are implementation defined, not undefined. Otherwise we'd be in big trouble.
Oh, yes, you're right. I'll take back the “horribly”, then.

This doesn't change my point, though: Then we're not using undefined C but rather implementation-defined C. I do have to amend one of my previous statements:
XanClic wrote:What's the problem with having languages that allow you to access low level stuff in a high level manner and not having to deal with that low level if you don't need to?
The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: In what ways the assembly language can help us?

Post by VolTeK »

m12 wrote:
IdiotOS wrote:In what ways Assembly Language can specially help us to make an operating system ,when comparing to other programming languages like c,c++..?

For example: Controlling fan speed,data handling...
Here's a comprehensive list:


Other than that
Your experience is showing again
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: In what ways the assembly language can help us?

Post by Kevin »

XanClic wrote:The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).
Then you'll have a hard time finding any natively compiled language that isn't.
Developer of tyndur - community OS of Lowlevel (German)
User avatar
XanClic
Member
Member
Posts: 138
Joined: Wed Feb 13, 2008 9:38 am

Re: In what ways the assembly language can help us?

Post by XanClic »

Kevin wrote:
XanClic wrote:The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).
Then you'll have a hard time finding any natively compiled language that isn't.
Why would I bother? I said I don't see why such languages shouldn't exist and, in fact, I like such “hybrid” languages. :wink:
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: In what ways the assembly language can help us?

Post by Kevin »

Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.
Developer of tyndur - community OS of Lowlevel (German)
Prochamber
Member
Member
Posts: 100
Joined: Wed Mar 13, 2013 2:27 am

Re: In what ways the assembly language can help us?

Post by Prochamber »

Kevin wrote:Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.
It's true most compiled language have some kind of 'low level' functionality; but often languages that attempt to create a higher level interface have little or no low level capabilities because the creators see no need to incorporate them. So in this sense there aren't as many "hybrid" languages as it seems at first glance.
i.e. Simply having the ability to do inline assembly would not qualify a language to be a low/high level hybrid.
TachyonOS - Violates causality on 95% of attempts. Runs at approximately 1.5c.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: In what ways the assembly language can help us?

Post by Mikemk »

Prochamber wrote:
Kevin wrote:Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.
It's true most compiled language have some kind of 'low level' functionality; but often languages that attempt to create a higher level interface have little or no low level capabilities because the creators see no need to incorporate them. So in this sense there aren't as many "hybrid" languages as it seems at first glance.
i.e. Simply having the ability to do inline assembly would not qualify a language to be a low/high level hybrid.
I agree with this in the same way that javascript and html are not the same language, even though they're typically embedded in one another.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply