Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learning Assembly on Windows & Linux (& OSX too)
#1
Any suggestions as to learning basic assembly for Linux or Windows - GAS first or MASM first? This is a project to help people with Auditory Verbal Agnosia (AVA*). One of the steps requires cheap, simple, fast computation, and assembly should be free, simple and fast. Right?

best, jabney

(*AVA is also called 'Word Deafness' which is not the same as 'deafness.')
Reply
#2
I only did a few years of professionnal assembly programming, so I'm not an expert as others can be. Assembly in your case would be confined to calculations hence to basically know how a CPU can do that. And how to get arguments from the high-level language and how to return results. Which could possibly mean knowing about the C stack (if C is used) and representation of C structures in asm, as well as format of floating point numbers.

In those times I was not running Linux so I used MASM, with every asm function using a C stack calling procedure.

In Linux the assembler is NASM. The Gnu assembler (GAS) seems more like a utility of the binutils package. NASM would be the full-fledged assembler.

http://www.nasm.us/

Here's a free 540 pages book on assembly programming in Linux:

https://doc.lagout.org/programmation/asm...-15%5D.pdf

This said the gcc compiler is very much optimized. You could try proving first with actual numbers and tests that you really need assembly. As for Linux/Windows, it depends on your customers.
Reply
#3
(02-20-2018, 05:47 PM)jonetsu Wrote: I only did a few years of professionnal assembly programming, so I'm not an expert as others can be. Assembly in your case would be confined to calculations hence to basically know how a CPU can do that. And how to get arguments from the high-level language and how to return results. Which could possibly mean knowing about the C stack (if C is used) and representation of C structures in asm, as well as format of floating point numbers.

In those times I was not running Linux so I used MASM, with every asm function using a C stack calling procedure.

In Linux the assembler is NASM. The Gnu assembler (GAS) seems more like a utility of the binutils package. NASM would be the full-fledged assembler.

http://www.nasm.us/

Here's a free 540 pages book on assembly programming in Linux:

https://doc.lagout.org/programmation/asm...-15%5D.pdf

This said the gcc compiler is very much optimized. You could try proving first with actual numbers and tests that you really need assembly. As for Linux/Windows, it depends on your customers.

Thanks! The AVA 'community' is minuscule and my invention is unofficial. But the need is there, and as far as I know I'm the only person working on my version of a software+technical solution.
Reply
#4
I noticed that the link I provided yielded a 404. Here's a shortcut that works:

goo.gl/mKB2uC
Reply
#5
(02-23-2018, 12:21 PM)jonetsu Wrote: I noticed that the link I provided yielded a 404. Here's a shortcut that works:

goo.gl/mKB2uC

Thanks! Perfect timing. Just finished installing AVL64 and running APT-Dist-Upgrade AV Linux. I think it worked.

A question; what should I call each section? For example, if I enter the assembly source to print "Hello World" on my screen, what do I call it? I've seen wording that talks about 'going back to my program', after printing "Hello World" so I'm a little confused about naming things.
Reply
#6
Hmmm... I'm not sure what you mean by that. You can give any name to your source code as it does not matter at all as long as you're using the same name when assembling and linking.

One very useful thing is that your assembler program can call high level libc functions. And this is where I think there could be a misunderstanding. This is useful for testing since the core of the work is done in assembly and then to print out results, a simple call to printf() is made. That means that the assembly program calls libc, then goes back after the call is done.

In a real application it would be the other way around. The high level language would call assembly objects to perform calculations. Then again, even though assembly is quite interesting, you should try to back up your use of it by actual performance numbers. The gcc compiler is optimized and is pretty good as writing CPU instructions. So if you have your calculation algorithms you might want to give it a try in C first and see what the performance is like before coding any in assembly.

The following page gives a few examples. Note that 64-bit binary format is used. You might see some examples out there that do not specify that.

NASM Examples
Reply
#7
That is very noble to address this condition. I hope you will be successful.

I spent a big part of my life on Risc based assembler and embedded systems.
Since Risc has died off on the desktop I cant be of much help.

(02-20-2018, 05:19 PM)jabney Wrote: Any suggestions as to learning basic assembly for Linux or Windows - GAS first or MASM first? This is a project to help people with Auditory Verbal Agnosia (AVA*). One of the steps requires cheap, simple, fast computation, and assembly should be free, simple and fast. Right?

best, jabney

(*AVA is also called 'Word Deafness' which is not the same as 'deafness.')
Reply
#8
jabney - it's interesting that you posted on an audio forum rather than on a programming forum - but it sounds like you need to give this some thought and make sure you're not trying to build a modern house out of lego bricks (i.e. you'll end up with an inferior product that's also impossible to maintain).

For example, if your project will involve writing a GUI, there are much better languages available than assembler. Likewise if the same program will need to run on all 3 platforms, you'll really struggle if you don't use a higher level language like C++ or whatever. Embedded systems are one of the few remaining areas where assembly language programming can deliver an advantage.

Give this some serious thought and make sure you're using the right tools for the job. Like I said at the start, the fact that you've posted on a non-programming forum kinda suggests that you haven't... Sad
Knowledge is knowing a tomato is a fruit...
Wisdom is knowing you don't put tomatoes in a fruit salad !!
Reply
#9
(12-05-2018, 07:34 PM)zimbodel Wrote: That is very noble to address this condition. I hope you will be successful....

Thanks. Though the word, "Noble," bothers me. "Nurse Ratched" treats 'conditions' -

Quote:Nurse Mildred Ratched (also known as "Big Nurse") is a fictional character and the main antagonist of Ken Kesey's 1962 novel One Flew Over the Cuckoo's Nest as well as the 1975 film. A cold, heartless, and passive-aggressive tyrant, Nurse Ratched became the stereotype of the nurse as a battleaxe. She has also become a popular metaphor for the corrupting influence of power and authority in bureaucracies...

- while the 'good guy' McMurphy (played by Jack Nicholson) just tries to inject a little fun -

Quote:Eventually McMurphy sneaks his prostitute girlfriend into the asylum, and encourages her to relieve fellow patient Billy Bibbitt of his virginity. When Ratched discovers what has happened, she threatens to tell Billy's mother about the transgression. Mortified, Billy commits suicide. Enraged, McMurphy attacks Ratched and very nearly chokes her to death.

In retribution, Ratched has McMurphy lobotomized. Chief Bromden, another patient and the narrator of the novel, later smothers McMurphy as a mercy killing.

That sort of drama is why I want to avoid the 'medicalness' of the situation. Having a major stroke is already an invitation to every "Nurse Ratched" around. When AVA happens with the stroke and with Aphasia it's a problem, but it can be an interesting problem. And interesting problems are fun to work on.

johne53 Wrote:jabney - it's interesting that you posted on an audio forum rather than on a programming forum - but it sounds like you need to give this some thought and make sure you're not trying to build a modern house out of lego bricks (i.e. you'll end up with an inferior product that's also impossible to maintain).

For example, if your project will involve writing a GUI, there are much better languages available than assembler. Likewise if the same program will need to run on all 3 platforms, you'll really struggle if you don't use a higher level language like C++ or whatever. Embedded systems are one of the few remaining areas where assembly language programming can deliver an advantage.

Give this some serious thought and make sure you're using the right tools for the job. Like I said at the start, the fact that you've posted on a non-programming forum kinda suggests that you haven't...

AVA is an interesting problem - but that's because it happened to me. And AVA doesn't have a community behind it - fortunately (see Nurse Ratched). Basically, I guess I'm the AVA community - at least until somebody else joins.

I think there are a few reasons why there is not much of an AVA community: first, AVA is not usually considered life-threatening (loneliness is not considered life-threatening); second, there is no recognized pharmaceutical cure for AVA (so no way to make big money from it).

I'm approaching the AVA situation as a low/no profit mechanical problem. 'Lego bricks' are perfect for me. In this case, the 'lego bricks' are the shapes of various words as spoken. That's why I thought assembly could work to translate simple spoken words to printed text. I typed an Amiga program from a magazine article years ago that could magnify a section of a display. Fast? Oh yes. And short. So that was behind my idea about using assembly.

As far as the rest of it, I trust that at some point others will join. In the meantime, the miniaturizing (done by others working on their own - unrelated - projects) needed to make the whole thing practical should continue - unless civilization collapses completely.

best, john
Reply
#10
(12-06-2018, 09:07 AM)johne53 Wrote: For example, if your project will involve writing a GUI, there are much better languages available than assembler. Likewise if the same program will need to run on all 3 platforms, you'll really struggle if you don't use a higher level language like C++ or whatever. Embedded systems are one of the few remaining areas where assembly language programming can deliver an advantage.

I was actually thinking the same thing, but you posted it first, as I didn't want to say that and be entirely wrong, as I have never programmed in assembly language before. I always knew it was very processor specific and if you wanted any portability at all, just don't use it. C++ should come very close to assembly speeds, with modern CPUs.
ASUS M5A99FX PRO R2.0 w/AMD FX™-8350 Eight-Core Processor 32GB RAM
M-Audio Delta 1010 / Echo AudioFire 12
Mixbus v7.x on Fedora 33 64bit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)