×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

NASM assembler

NASM assembler

NASM assembler

(OP)
Can someone help me to design a assembly language program that accept a decimal number fron the keyboard and output roman numeral number
for example you input 8 , it should output VIII
 

RE: NASM assembler

anyone who's done the homework previously?

RE: NASM assembler

Appreciate that this is some kind of tutorial, but these days (and probably for the last twenty years at least)there isn't any point in doing application development in assembler. You should restrict its use to areas where assembler is either the best or only option - device drivers, operating system exit points, and similar. This isn't just a mindless whinge about using the right tool for the job. You will find you use a whole different set of machine instructions for this kind of work, and it will be much more useful to you in the real world. Example - I've been writing mainframe assembler routines since the eighties, and I've never had cause to write a single instruction that used floating point arithmentic. But most assembler tutorials seem to want to get stuck in to this kind of thing straight away, as if they expect people to suddenly want to start writing and maintaining amortisation calculators in assembly language.

Steve

"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)

RE: NASM assembler

One still needs to be able to do those things, because assembler can be very useful for optimizations.  A profiler can be useful for these things to show where most of the time of a program run is being spent in this regard.  I agree that other languages are generally useful for most things, but assembler still has its place in general application development.

It also has its place for applications where code size is important.

So stevexff, how should someone learn assembler if you are starting cold and need to learn everything you ever need to know for any and all situations?  The best way I can think of is start cold and code logic with it.  One can always learn new or different instructions easily enough, but you still have to pick up the logic of how it works.

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy"

RE: NASM assembler

Fair point I suppose. I don't dispute that you have to learn on something, but what I was trying to get across was the need for more relevant examples. There is a lot to learn in assembly level programming, and much of it is about addressability, registers and capabilities of the processor, and interaction with the operating system. Why add to this burden by making people learn stuff they are unlikely ever to use in the real world?

Take the example above - reading a number from the terminal, and outputting the roman equivalent. Messrs. Kernighan, Ritchie, and Torvalds have written whole operating systems almost entirely in C. Hands up who thinks you will ever need to do terminal I/O from assembly level code? If we substitute the simple number conversion for a complex and time critical calculation that must be performant, and using the code size and/or optimisation rationale above, you'd still do the terminal I/O from a high level program and call the assembler subroutine to reformat the number before display. So why learn terminal I/O in assembler?

Creating a subroutine to reformat the numbers would be far more useful as a teaching example - it teaches about program linkage, addressability, parameter passing, return variables, integer and modulus arithmetic, and possibly even data validation and table handling. These are all things you need to know, and are applicable to almost every program you write.

  

Steve

"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)

RE: NASM assembler

I don't dispute any of what you say in the last post, that much.  Most people that do use assembler today will wrap it in another language via subroutine calls or inline stuff (which I've used).  

There's always a need, though, to at least be able to get to that level of all ASM at times.  If anything, to look at DOS and Windows, the interrupts in DOS are a lot like the API calls in Windows.  And if you get a Windows-centric assembler, you still can do the whole task in assembler simply by calling the API, as you would in a C program (or any other program that doesn't use any frameworks).  

From personal knowledge, though, interrupt calls aren't that tough, but are necessary in DOS for different things.  I also know that most people that teach assembler are extremely behind the curve in how they teach it.  I don't know where or how the OP got the problem (NASM is Windows-based, generally, so the terminal parts involve API calls anyway), but I know I wouldn't insist on assembler all the way through.

OTOH, my problem I find with most tutors when I was trying to learn assembler in earnest is that they don't teach the essentials accurately and well (but that's another topic) to be able to pick up any assembler you find (in other words, no assembler is very standardized).  I'll probably pick it up again when time permits though, since I want to pick up much more than I already have.

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy"

RE: NASM assembler

Interesting comments.
I am interested in learning assembly.
I use OpenBSD. I am also a newbie at C.
I am not a newbie nor a guru at perl.

The more I learn about C, the more I see why many things are the way they are in perl.

Since C is much closer to assembly, it seems appropriate to me to try and learn them both together.
I am not taking any classes nor will I probably use it at work, but I want to learn it anyway. Heck, I might even work on a device driver at some point.

But I am really having a hard time finding anything consistent for me to learn with.

There is a ton of older stuff for DOS and windows, but that is not really relevant to me.

I have found some FreeBSD stuff, but it is very limited.

I have installed fasm, nasm, yasm and intel2gas.

I like the way nasm has its syntax.

I just need some material to work with. I don't mind buying something, but not sure what to look for.

Frankly, I would be happy just to find some examples of "this " in C, "this" same thing in assembly

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close