Jump to content

Recommended Posts

I got started, recently, trying to learn some assembler, and I got to wondering something. How many are using it, and what flavor, type, etc?

I know for references, that seem to find many different "appearances" of the source, so I'm generally wondering about that. Personally, that I have five things here that take assembler code, all seem to have different rules and therefore the source appears different.

For those that are versed, any good suggestions on references to figure out a few things that I'm not finding answers to?

Link to comment
Share on other sites


Not much people write asm by hand these days. There's 2 main fields where you still see it:

-places where stuff has to be really optimized (like video codecs) -- and even then, normally it's just minimal parts that get "optimized" (profile it, see what could benefit most from it first)

-embedded systems (and even then, C is pretty mainstream there these days, and C++ is slowly being adopted -- especially on "bigger" MCUs)

I still know my x86 asm quite well, but it's been a long time since I've bothered to write any (haven't had to in many years). Most of what I write for desktops (or servers for that matter) is C#. However, I've written a fair bit of motorola-ish asm for embedded platforms.

Writing software in asm requires a LOT of time and it takes a lot of lines of code. So it's very slow to develop and costs a LOT of money.

Link to comment
Share on other sites

Not much people write asm by hand these days. There's 2 main fields where you still see it:

-places where stuff has to be really optimized (like video codecs) -- and even then, normally it's just minimal parts that get "optimized" (profile it, see what could benefit most from it first)

-embedded systems (and even then, C is pretty mainstream there these days, and C++ is slowly being adopted -- especially on "bigger" MCUs)

Writing software in asm requires a LOT of time and it takes a lot of lines of code. So it's very slow to develop and costs a LOT of money.

I'm well aware of these things. In fact, for my short experiences, I wouldn't want to code too many whole programs in assembler if I can't help it. But as you pointed out, there are still uses. I'll add a third, which is my use for it: direct access and manipulation of the system (interrupts). I'll say it probably doesn't take too much knowledge to be able to do that (I get the feeling I've learned enough to write stub routines to do that to be called by the HLL). But I say I might as well learn the whole thing if I'm going to go to the effort, so I can have it for your first point. Of course, though, it's been something I've wanted to learn for a very long time and I got the chance now...

Edit: Speaking of which, that's one of my questions. If anyone knows the Delphi asm variant, is there a good reference on how to pass variables to those ASM stub functions? And yes, Delphi (most Borland stuff too I guess) is very handy in that you can inline ASM statements within its functions.

Edited by Glenn9999
Link to comment
Share on other sites

I'll add a third, which is my use for it: direct access and manipulation of the system (interrupts)

You don't need asm for that. Direct access is possible in most languages (as long as the underlying OS lets you do it). You can also write ISR's in several languages (e.g. C and C++ -- you could even do it in turbo pascal back in the DOS days). It's nice having "lightweight" ISRs though.

I guess I won't be of any help with Delphi, I quit using Borland stuff in the Win95 days (over 10 years ago) and haven't looked back.

Anyways. Have fun :)

Edited by crahak
Link to comment
Share on other sites

You don't need asm for that. Direct access is possible in most languages (as long as the underlying OS lets you do it). You can also write ISR's in several languages (e.g. C and C++ -- you could even do it in turbo pascal back in the DOS days). It's nice having "lightweight" ISRs though.

The interface was always a bit clunky, and they always seemed to be a YMMV affair. At least in my experiences with Turbo Pascal. I never entirely *got* ISRs either in playing with them there.

Of course with the interrupt interface, it took register values as input, so one almost has to ask what the point is.

{ Interrupt $21 Function 9 - write string with "$" terminator }
Regs.Ah := 9;
Regs.Ds := Seg(astring);
Regs.Dx := Ofs(astring);
intr($21, regs);

I don't know what Intr does, exactly. There might be an advantage in that it doesn't destroy any necessary values in registers, but it seems almost as easy or easier to just throw the ASM values there. In fact, for the code I read over the years, it seems more tend to use ASM than Intr.

Just my thoughts, anyway.

Edit: Thinking on your post brought out another question. With Windows 95/98/ME I would have figured that it would insist on handling anything with hardware, but I found out on that platform that I had to have assembler in a Windows program to control the system speaker (the case one, not the sound card). Which makes me think, what can you get away with under Windows for these kinds of things? I notice the XP API is more complete (didn't need the ASM for the system speaker there), which makes me wonder if there's a difference even between Windows types/versions on this question.

Edited by Glenn9999
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...