Can you please tell me in which chapter I find how to exit a program in a clean way?
Also, what debugger do you recommend using then?
Scali answered your questions. What parts are you not comprehending?
For tool usage: RTFM. You are asking that your hand be held at each and every step without obviously putting forth any effort. I'm surprised he let you go this long...
Argh? What is up with kids today? The Google generation?
Need instant answers for everything?
The world doesn't work that way. I've already spelled out way more than should be required (and I already suggested various debuggers).
It ends here. Just start reading Art of Assembly. You'll find what you're looking for soon enough.
There's a difference between wanting instant answers and coming after a long search and many frustrations, eagre to learn something. I can tell you, there is no clear answer on the internet referring to Assembly, I looked way too much, everything is so not clear, this forum was a miracle to me.
I know 4 programming languages so far: C, C++, Python, Pawn(A programming language for a game). I can ensure you that these programming languages I've learnt by myself, I had to kill my self to look after every f****** tutorial possible on the internet. I agree that these days many things are made that give instant answers, which makes people lazier and want instant answers, but you shouldn't forget how you suffered yourself when you learnt ASM at first, and how confused you were. I am a moderator on another forum myself, helping people with another programming languages, and trust me it is annoying to help eagre newbies who want to make cool things.
I think that the fact you have the answer right in your mouth, should be the reason you need to share it with everybody. It's great that you've suffered to learn, me also, don't think that I'm still going to have an easy time with Assembly, especially when programming takes big logic. If I know something I share it to the end, not give other people the idea and leave them to think. Don't think that it's teaching people that way of talk, it's just making them more frustrated and afraid to learn the topic.
Even though of all I said, you were a great help and I really appreciate your assistance man, thanks alot.
There's a difference between wanting instant answers and coming after a long search and many frustrations, eagre to learn something. I can tell you, there is no clear answer on the internet referring to Assembly, I looked way too much, everything is so not clear, this forum was a miracle to me.
And I pointed you to Art of Assembly.
But you just keep on shooting off questions. There is no way you could have read more than a handful of pages of that book since I gave you the link... Stop asking and start reading.
You see how big that book is? You expect me to keep answering your questions until we have covered everything? Clearly that is not going to happen.
Writing assembly requires a special type of person. Assembly requires a lot of digging through obscure documentation and code. It is unlike any other language, nobody is there to hold your hand.
Some people have what it takes, people who persist, find the answers and get the job done.
Then there are people who quit after 5 seconds and ask someone else to do it. Those people will never be assembly programmers. And don't expect people on the forum to do the work for you. We're not here for you, we don't get paid to answer your questions and solve your problems.
We have our own lives, our own work and commitments etc.
There's a difference between wanting instant answers and coming after a long search and many frustrations, eagre to learn something. I can tell you, there is no clear answer on the internet referring to Assembly, I looked way too much, everything is so not clear, this forum was a miracle to me.
And I pointed you to Art of Assembly.
But you just keep on shooting off questions. There is no way you could have read more than a handful of pages of that book since I gave you the link... Stop asking and start reading.
You see how big that book is? You expect me to keep answering your questions until we have covered everything? Clearly that is not going to happen.
Writing assembly requires a special type of person. Assembly requires a lot of digging through obscure documentation and code. It is unlike any other language, nobody is there to hold your hand.
Some people have what it takes, people who persist, find the answers and get the job done.
Then there are people who quit after 5 seconds and ask someone else to do it. Those people will never be assembly programmers. And don't expect people on the forum to do the work for you. We're not here for you, we don't get paid to answer your questions and solve your problems.
We have our own lives, our own work and commitments etc.
Never expected anyone to programm for me, but I can guarentee to you that in C++ for example you would also have to read a really big book (huge as that one) to answer all of your questions, I am programming for 6 years, trust me I know the logic required for such programming languages and as I said I already know assembly just need to practice.
And you can't compare such situation to "quitting after 5 seconds and telling someone to program for me", all I say is, that a pointing finger (no, pointing at the book is not as helpful as pointing for example at the chapter), would be much nicer and more helpful, and considering that I only asked you to tell me where do I need to read (again, chapter, not book, cuz this book is huge), and not that you read it for me.
I am programming for 6 years, trust me I know the logic required for such programming languages and as I said I already know assembly just need to practice.
If you have been programming for 6 years, you should be familiar with terms like 'build', and how to use tools such as a linker and a debugger.
I didn't quite get that impression.
And you can't compare such situation to "quitting after 5 seconds and telling someone to program for me", all I say is, that a pointing finger (no, pointing at the book is not as helpful as pointing for example at the chapter), would be much nicer and more helpful, and considering that I only asked you to tell me where do I need to read (again, chapter, not book, cuz this book is huge), and not that you read it for me.
What exactly do you think? I haven't looked at Art of Assembly in years. I'd actually have to read the book for you in order to find the exact chapters that answer all your questions.
So why don't you just read the book? Or at least skim it, or use the index or something... Put some effort in, you know. Because effort is required for assembly... all the time.
I'll just throw in a link to a debugger I used to like:
http://ladsoft.tripod.com/grdb.htm
It's "like DEBUG, only smarter". I'm not sure if it'll work with DosBox - worth a try...
Way back in your first post, you mentioned your reason for getting your asm up to speed. Not a good topic for discussion here, but... unless you expect the "targets" in the course you're taking to be 16-bit code, you're wasting your time learning 16-bit code. Just sayin'...
Best,
Frank
http://ladsoft.tripod.com/grdb.htm
It's "like DEBUG, only smarter". I'm not sure if it'll work with DosBox - worth a try...
; exit cleanly (dos)
mov ah, 4Ch
int 21h
Way back in your first post, you mentioned your reason for getting your asm up to speed. Not a good topic for discussion here, but... unless you expect the "targets" in the course you're taking to be 16-bit code, you're wasting your time learning 16-bit code. Just sayin'...
Best,
Frank
; exit cleanly (dos)
mov ah, 4Ch
int 21h
That's not REALLY a clean exit, as the return code is undefined here. I would not encourage programming like that, except when saving that single byte is important (size-optimizing competitions and such).
The exit code is the 66h he had in al. He doesn't show it, so I figured I'd use it as an exit code. What would you exit? "no error"? Can ya read that in dos? "echo $?" shows the exit code in Linux... You're right, of course, we really should use a "meaningful" exit code.
Best,
Frank
Best,
Frank
The exit code is the 66h he had in al. He doesn't show it, so I figured I'd use it as an exit code. What would you exit? "no error"? Can ya read that in dos? "echo $?" shows the exit code in Linux... You're right, of course, we really should use a "meaningful" exit code.
Best,
Frank
Normally you'd return 0 as 'no error'.
And yes, DOS can use error codes. I think "echo %ERRORLEVEL%" will print the exit code.
"ERRORLEVEL" is the env var that receives the exit code at any rate, and it can be used in batch files for example.
@Scali - First, I never said I don't know what a debugger is or a linker or 'build'. If you'd scroll up, I asked about which debugger should I use and not what's a debugger, as well as linker and the 'build' term. I asked how it comes in hand when you program in ASM, and when you said you should build your program or use the linker, I only asked how do I do that and how does it works because I didn't know how to do it when it comes to Assembly.
Also, I didn't say you memorized the Art of Assembly and remember all of it, all I assumed, is that you probably read it before, and might remember something, didn't ask you to read it for me or anything like that.
@Frank - Thanks for the debugger, I will try that out and see about it. Also, I thought about it, maybe you don't need a 'clean exit' ending in your code if you just use the debugger to work with it, so I might just ignore that clean exit, and work with the debugger, and not even use DosBox I guess.
About what you said of the Reversing. I am right now in a project, that are for only around 10-20 teenagers in my district. We learn high-leveled and advanced material (Networking, Programming Languages, Win Sockets, Data Secure, and other 'hacking' stuff...), we get these tools and learn the best we can, and once we reach the age of 18, we get recruited in an intelligence unit in the army, and serve for the army 5 years, then go out to the 'wild world' with the knowledge we gained. The reason I am going to learn Reverse Engineering is for the army only, intelligence purposes only, there's no going to be any bad use for it, I am probably going to be in a unit of that.
About the 16-bit, as I also said in the first post, I believed that 16-bit would be a good base to start from, and then learn the other 'bits' versions. And that's why I learn that.
Also, I didn't say you memorized the Art of Assembly and remember all of it, all I assumed, is that you probably read it before, and might remember something, didn't ask you to read it for me or anything like that.
@Frank - Thanks for the debugger, I will try that out and see about it. Also, I thought about it, maybe you don't need a 'clean exit' ending in your code if you just use the debugger to work with it, so I might just ignore that clean exit, and work with the debugger, and not even use DosBox I guess.
About what you said of the Reversing. I am right now in a project, that are for only around 10-20 teenagers in my district. We learn high-leveled and advanced material (Networking, Programming Languages, Win Sockets, Data Secure, and other 'hacking' stuff...), we get these tools and learn the best we can, and once we reach the age of 18, we get recruited in an intelligence unit in the army, and serve for the army 5 years, then go out to the 'wild world' with the knowledge we gained. The reason I am going to learn Reverse Engineering is for the army only, intelligence purposes only, there's no going to be any bad use for it, I am probably going to be in a unit of that.
About the 16-bit, as I also said in the first post, I believed that 16-bit would be a good base to start from, and then learn the other 'bits' versions. And that's why I learn that.
About what you said of the Reversing. I am right now in a project, that are for only around 10-20 teenagers in my district. We learn high-leveled and advanced material (Networking, Programming Languages, Win Sockets, Data Secure, and other 'hacking' stuff...)
None of those topics are construed as 'hacking'. They are simply discrete programming concepts required of any programmer.
...we get these tools and learn the best we can, and once we reach the age of 18, we get recruited in an intelligence unit in the army, and serve for the army 5 years, then go out to the 'wild world' with the knowledge we gained. The reason I am going to learn Reverse Engineering is for the army only, intelligence purposes only, there's no going to be any bad use for it, I am probably going to be in a unit of that.
This will be the tool you need, used by both white hats and black hats: http://www.ollydbg.de/
About what you said of the Reversing. I am right now in a project, that are for only around 10-20 teenagers in my district. We learn high-leveled and advanced material (Networking, Programming Languages, Win Sockets, Data Secure, and other 'hacking' stuff...)
None of those topics are construed as 'hacking'. They are simply discrete programming concepts required of any programmer.
...we get these tools and learn the best we can, and once we reach the age of 18, we get recruited in an intelligence unit in the army, and serve for the army 5 years, then go out to the 'wild world' with the knowledge we gained. The reason I am going to learn Reverse Engineering is for the army only, intelligence purposes only, there's no going to be any bad use for it, I am probably going to be in a unit of that.
This will be the tool you need, used by both white hats and black hats: http://www.ollydbg.de/
Indeed, none of those topics are construed as 'hacking', but are tools for hackers.
And again, all I need to know is Assembly, and good, and the rest I will be taught by that project im going to.
I gotta jump in here...
Nothing on the net to learn Assembly from? Hmmm this is today we are talking about and not 10 years ago when I started with Assembly right? You need to find a new search engine. When I started, information was scattered all about and search engines were not as good as they are today. If you cannot find info, then you should stick to one of those high level languages you know already, as Assembly takes a certain type of person as others have said.
Do yourself a favor and skip the old, dead 16 bit code. It will not run natively on modern OS's and you will get more headaches and turned off of Assembly.
Nothing on the net to learn Assembly from? Hmmm this is today we are talking about and not 10 years ago when I started with Assembly right? You need to find a new search engine. When I started, information was scattered all about and search engines were not as good as they are today. If you cannot find info, then you should stick to one of those high level languages you know already, as Assembly takes a certain type of person as others have said.
Do yourself a favor and skip the old, dead 16 bit code. It will not run natively on modern OS's and you will get more headaches and turned off of Assembly.
I gotta jump in here...
Nothing on the net to learn Assembly from? Hmmm this is today we are talking about and not 10 years ago when I started with Assembly right? You need to find a new search engine. When I started, information was scattered all about and search engines were not as good as they are today. If you cannot find info, then you should stick to one of those high level languages you know already, as Assembly takes a certain type of person as others have said.
Do yourself a favor and skip the old, dead 16 bit code. It will not run natively on modern OS's and you will get more headaches and turned off of Assembly.
Sounds true, 16 bit is dead, the thing is I learn 16-bit because of I have a book in my house that is 16-bit, and thought it would be a good base to start from, so if I learn 16-bit, I could easily learn 32-bit from there or even 64-bit, do you agree? If not, where should I learn from 32-bit then? Art of Assembly? or is it 64-bit?
Anyways... The reason I said there is nothing to find on the net to learn Assembly is because of what you said, 16 bit is dead, I can barely find any result, everything today relates to ASM 32 / 64 bit. And jesus, stop telling me to skip Assembly and that I'm not the person for it, either you're here to courage and help or you're here to let people down and make them feel stupid...
I do want to learn Assembly because I like topics with logics like that, even if im the person for it and even if im not.
Sounds true, 16 bit is dead, the thing is I learn 16-bit because of I have a book in my house that is 16-bit, and thought it would be a good base to start from, so if I learn 16-bit, I could easily learn 32-bit from there or even 64-bit, do you agree? If not, where should I learn from 32-bit then? Art of Assembly? or is it 64-bit?
16-bit, 32-bit and 64-bit x86 asm are very similar. If you know one, you can easily adapt to the others (but obviously we are talking about the assembly language here... the DOS API is entirely different from Win32 API, or other 32/64-bit OSes. But learning APIs has little to do with learning to use assembly).
But only the 16-bit DOS edition of Art of Assembly teaches you proper assembly.
The 32-bit version uses HLA instead.
And jesus, stop telling me to skip Assembly and that I'm not the person for it, either you're here to courage and help or you're here to let people down and make them feel stupid...
Well, it's true. You're asking questions that you shouldn't be asking.
I have learnt assembly mostly by myself. Before there was anything like Google or forums.
Just by reading books, trying the examples, and figuring stuff out by experimenting and looking through the help files.
That is what it takes.
(Have you even tried ML.EXE /? or LINK16.EXE /?... That's the sort of thing that I mean. If you haven't tried that, then well, apparently you lack the inquisitive nature that is required for an assembly programmer. And don't answer with "I don't know how the command line works", because you can find plenty of info on that as well.)
How ironic, I learn from a book aswell, too sad that 'actual practice' 16-bit ASM on computers is too old and so its results, and I can tell the truth and I'm not lieing, I looked alot, the fact I used you to understand the material completly is just the same as reading from a book or finding someone else's post on another forums and by that knowing the answer, think that other people who'd be looking for the same topic, would google it, and probably this thread is going to be one of the first results because it has most of the key words.
16-bit DOS code is still alive and well!
As is Amiga code: http://www.asmcommunity.net/board/index.php?topic=30761.0
As is Amiga code: http://www.asmcommunity.net/board/index.php?topic=30761.0
Maybe p1Mp needs some links more than he needs discussion about whether he asks too many questions...
This is one that a (13 year old!) guy on the Nasm Forum told me he was using. Might be some help...
http://courses.engr.illinois.edu/ece390/books/labmanual/index.html
(uses Nasm)
Here's one I just found by typing "dos assembly" into Google...
http://socoder.net/index.php?article=22174
(uses Fasm - very brief!)
Ben Lunt's site has got a ton of information!
http://www.fysnet.net/index.htm
(He uses his homemade assembler - much like Masm)
This 'un looks pretty "introductory".
http://prism2.mem.drexel.edu/~rares/asm3.htm
(appears to use Tasm - a fine assembler, but pretty "obsolete" (just like dos! :) )
Well, there's no point in listing everything I find by googling "dos assembly". Curiously, a lot of it actually refers to Linux assembly (which you might like!). What other search terms would you guys suggest p1Mp try?
You mention that you've got "a book", p1Mp. What book is that? I know you've got Randy's "Art of Assembly"... The most extensive book I know of on the subject! I've never read it all the way through, but used to use it as a reference. The 32-bit version, for better or worse, uses HLA (Randy's own High Level Assembler). Nothing wrong with that, but it's completely different from any other assembler.
One thing you'll learn right off, unlike C, the syntax isn't "standardized" and differs (a lot!) from one assembler to another. I know you've got Masm and are starting with that, but if you aren't "committed" yet, take a look at some of the others... I'm fond of Nasm, myself... You may want to decide fairly early which assembler you want to use, but it really isn't too hard to "switch".
Good luck with your studies! Hope to see you back with some more specific questions...
Best,
Frank
This is one that a (13 year old!) guy on the Nasm Forum told me he was using. Might be some help...
http://courses.engr.illinois.edu/ece390/books/labmanual/index.html
(uses Nasm)
Here's one I just found by typing "dos assembly" into Google...
http://socoder.net/index.php?article=22174
(uses Fasm - very brief!)
Ben Lunt's site has got a ton of information!
http://www.fysnet.net/index.htm
(He uses his homemade assembler - much like Masm)
This 'un looks pretty "introductory".
http://prism2.mem.drexel.edu/~rares/asm3.htm
(appears to use Tasm - a fine assembler, but pretty "obsolete" (just like dos! :) )
Well, there's no point in listing everything I find by googling "dos assembly". Curiously, a lot of it actually refers to Linux assembly (which you might like!). What other search terms would you guys suggest p1Mp try?
You mention that you've got "a book", p1Mp. What book is that? I know you've got Randy's "Art of Assembly"... The most extensive book I know of on the subject! I've never read it all the way through, but used to use it as a reference. The 32-bit version, for better or worse, uses HLA (Randy's own High Level Assembler). Nothing wrong with that, but it's completely different from any other assembler.
One thing you'll learn right off, unlike C, the syntax isn't "standardized" and differs (a lot!) from one assembler to another. I know you've got Masm and are starting with that, but if you aren't "committed" yet, take a look at some of the others... I'm fond of Nasm, myself... You may want to decide fairly early which assembler you want to use, but it really isn't too hard to "switch".
Good luck with your studies! Hope to see you back with some more specific questions...
Best,
Frank
Maybe p1Mp needs some links more than he needs discussion about whether he asks too many questions...
Bottom line is: ASM is extremely dead.
The only good resources for learning ASM were written in the 16-bit age. Back when ASM was still relevant as a programming language (because computers were too slow and compilers were not good enough, you *had* to use ASM).
There isn't a whole lot about 32-bit ASM, because in that age, it was mostly people who already knew 16-bit ASM, and most tutorials mainly concentrate on explaining how to write 32-bit applications in Windows, linux etc, rather than explaining ASM itself. Most 'normal' programmers never bothered with ASM at all anymore, and just used C/C++ or some other language. ASM was mostly a gimmick.
As for 64-bit... These days ASM is so obscure that I haven't really seen any tutorials at all. I think even on this forum hardly anyone writes 64-bit ASM. Most are stuck with 32-bit because that's what they know, and/or that's what most tools/libraries/frameworks are aimed at. Most stuff has never been ported to 64-bit anyway (eg, there is no MASM64 equivalent of MASM32, so if you want to write a 64-bit Windows app, you're on your own, and need to write your own headers with API function protos, structs etc. Good luck on that).
One thing you'll learn right off, unlike C, the syntax isn't "standardized" and differs (a lot!) from one assembler to another.
Actually, there *is* a standard, known as Intel syntax. This is the syntax that Intel has always used in its manuals. Both MASM and TASM use this syntax (although TASM also offers an 'ideal' mode, which is a slight variation).
Problem with assemblers like NASM is... I have never seen a proper definition of its syntax. Same with GAS. Yes, it uses AT&T syntax, but I've always found myself guessing what the syntax would be for some instructions. I have never seen a good reference for the entire instructionset, unlike Intel syntax, where the Intel manuals themselves ARE the reference.
For that reason I've never liked NASM. Feels like someone just thought up some assembly syntax as they went along, for no apparent reason (why would you NOT support proper Intel syntax, which had been so common in the x86 world for ages before NASM came along?), and didn't bother to document their little fantasy language.
Well... we're getting a long way from "DOS & BIOS->Assembling on DosBox". I'll leave it at that.
Best,
Frank
Best,
Frank