Who codes in Assembly?
Cryophile
01 Dec 2003, 21:29Just a simple question
GameBoy
01 Dec 2003, 22:14what's Assembly?
Cryophile
01 Dec 2003, 22:20Assembly, as in the low(i think) level programming language. It manipulates the processor directly and requires no include files or additional filez. It minimizes the source code and increases speed of the program. It can be incorporated into most highlevel programming languages (c/c++, basic, etc.)
GameBoy
01 Dec 2003, 22:21how powerful is it, and what can it do? i think i've heard of it before.
Cryophile
01 Dec 2003, 22:23it's the most powerful other than binary (0s and 1s). It's extremely powerful but fairly complex. Check a search engine. It can do anything with minimal code. Source code is .asm and can be disassembled etc.
Anonymous
02 Dec 2003, 09:26I used to, but don't need to any more thank God!
Assembly language is VERY low level language, and involves you writing nmenonics that are translated direct into binary code ("assembled" - hence the name) that the processor can handle.
Biggest bugbear is that there is no generic 'assembly language', you have to learn the commands available on each specific processor and how its individual registers and accumulator etc are manpulated - e.g. (using once popular 8 bit processors as an example) the Z80 (Spectrum etc) has a completely different set of operations and completely different register architecture to the 6502/6510 (BBC/Commodore). You have complete control over the processor/ memory with assembly, but you have to do EVERYTHING yourself, right down to deciding where and how variables are stored and making sure you don't break any rules and (classic error) keep a good track on what you put on "the stack".
a chunk of Z80 assembler might look like this:-
wait: ld hl,ticks
ld a,(hl)
add a,b
wt1: cp (hl)
jp m,wt2
call foo
jr wt1
wt2: ret
This is basically a for-next loop - the reason it's here is that if you wrote the same loop in 6502 it would look entirely different because the 6502 has entirely different register structure.
Line 2 is an instruction to load the accumulator (a register) with the value held in the HL register. in 6502 you can't do that, there is no HL register - instead you have to load either the X or Y registers with the value from the memory location and then transfer this to the accumulator so line 2 is now:
TXA
See what I mean by having to know the individual processor architecture?
With assembler you tend to get no "safety net", you can very easily crash your computer writing assembly language programs - trust me on this as I've done it many, many times
The upside of assembly language is that (used expertly) it makes for blindingly fast, compact code, the downside is that it's a complete PITA to use and very very slow to write/debug.
These days, most people use higher level tools like C/C++ which gives a much more friendly (yes - really it is!) way to generate code that is compiled to executable form. Essentially you can think of it as C++ being initially processed to assembly language which is itself then compiled to an executable. The advantage is that C/C++ is (Microsoft idiocy aside) if not quite the same on all platforms, at least still recognisably the same language.
Assembly language is still useful - there is no better way to write control code for a specific device and things like graphics routines for specific video cards benefit from the added speed it brings, but for many other applications it really is re-inventing the wheel for what is often only a modest improvement over C++ generated code.
Al (a.k.a. MaDbRiT)
Assembly language is VERY low level language, and involves you writing nmenonics that are translated direct into binary code ("assembled" - hence the name) that the processor can handle.
Biggest bugbear is that there is no generic 'assembly language', you have to learn the commands available on each specific processor and how its individual registers and accumulator etc are manpulated - e.g. (using once popular 8 bit processors as an example) the Z80 (Spectrum etc) has a completely different set of operations and completely different register architecture to the 6502/6510 (BBC/Commodore). You have complete control over the processor/ memory with assembly, but you have to do EVERYTHING yourself, right down to deciding where and how variables are stored and making sure you don't break any rules and (classic error) keep a good track on what you put on "the stack".
a chunk of Z80 assembler might look like this:-
wait: ld hl,ticks
ld a,(hl)
add a,b
wt1: cp (hl)
jp m,wt2
call foo
jr wt1
wt2: ret
This is basically a for-next loop - the reason it's here is that if you wrote the same loop in 6502 it would look entirely different because the 6502 has entirely different register structure.
Line 2 is an instruction to load the accumulator (a register) with the value held in the HL register. in 6502 you can't do that, there is no HL register - instead you have to load either the X or Y registers with the value from the memory location and then transfer this to the accumulator so line 2 is now:
TXA
See what I mean by having to know the individual processor architecture?
With assembler you tend to get no "safety net", you can very easily crash your computer writing assembly language programs - trust me on this as I've done it many, many times
The upside of assembly language is that (used expertly) it makes for blindingly fast, compact code, the downside is that it's a complete PITA to use and very very slow to write/debug.
These days, most people use higher level tools like C/C++ which gives a much more friendly (yes - really it is!) way to generate code that is compiled to executable form. Essentially you can think of it as C++ being initially processed to assembly language which is itself then compiled to an executable. The advantage is that C/C++ is (Microsoft idiocy aside) if not quite the same on all platforms, at least still recognisably the same language.
Assembly language is still useful - there is no better way to write control code for a specific device and things like graphics routines for specific video cards benefit from the added speed it brings, but for many other applications it really is re-inventing the wheel for what is often only a modest improvement over C++ generated code.
Al (a.k.a. MaDbRiT)
Cryophile
02 Dec 2003, 16:17I agree of course. C++ is much easier and useful. But assembly is preferred by me for at least PART of the code. Just little snippets mostly, or a few dlls.
GameBoy
02 Dec 2003, 17:03if C++ is easier, im not even gunna TRY and understand Assembly! lol.
while we're on the subject of programming languages, does anybody know where i can read about Basic and get some sample codes? apparently ASL is like Basic, or so i read.
while we're on the subject of programming languages, does anybody know where i can read about Basic and get some sample codes? apparently ASL is like Basic, or so i read.
Alex
02 Dec 2003, 17:16ASL isn't much like Basic at all, so it won't help you much. If you don't know any other programming languages at all, though, it may help to learn one properly, because you can then apply the same sort of concepts to ASL.
kingmorgoth99
02 Dec 2003, 18:25i agree with ste learning c++ is hard enough (especially if your only 13!) so i'll stay as far away from assembly as pos.
paul_one
07 Dec 2003, 02:43I see ASL and BASIC very similarly indeed. Although it isn't like it is syntax/build etc, it's just the "feeling" of BASIC that comes through IMO.
Anyway, I voted "sort of" because I don't actually KNOW the commands for any processor/whatever but I know how it works, and (basically) everything Al said. *nods head*
Really, assembly isn't that much better than C++ nowadays. Most compilers will compile code into a file the size of an assembly-written file AND it will run at the same speed... There's even been a couple of cases where they've been smaller and/or faster than assembly written code (although I have no links to back myself up).
There may be some assembly things you want to do - you may do them in C++ (I know very little but know you can do assembly stuff in C++... Erm, is there assembly stuff you can't do?).
I thought that C++/Assem/binary all have the same "power" to them, but if there is a power difference then please go ahead and point it out.
I'd also like to add I agree C++ is easier than assembly - but only in respect to see/read/understand/debug. Assembly IMO is very simple (at least the the structure I looked into was) with the memory fetching, the registers, the writing and basic jumps. Very easy to understand BUT if you get an error in there you'd probably be better re-coding the WHOLE LOT then going through trying to get that one error.
Anyway, I voted "sort of" because I don't actually KNOW the commands for any processor/whatever but I know how it works, and (basically) everything Al said. *nods head*
Really, assembly isn't that much better than C++ nowadays. Most compilers will compile code into a file the size of an assembly-written file AND it will run at the same speed... There's even been a couple of cases where they've been smaller and/or faster than assembly written code (although I have no links to back myself up).
There may be some assembly things you want to do - you may do them in C++ (I know very little but know you can do assembly stuff in C++... Erm, is there assembly stuff you can't do?).
I thought that C++/Assem/binary all have the same "power" to them, but if there is a power difference then please go ahead and point it out.
I'd also like to add I agree C++ is easier than assembly - but only in respect to see/read/understand/debug. Assembly IMO is very simple (at least the the structure I looked into was) with the memory fetching, the registers, the writing and basic jumps. Very easy to understand BUT if you get an error in there you'd probably be better re-coding the WHOLE LOT then going through trying to get that one error.
GameBoy
07 Dec 2003, 02:46Computer Whizz wrote:BUT if you get an error in there you'd probably be better re-coding the WHOLE LOT then going through trying to get that one error.
...
Cryophile
08 Dec 2003, 20:44Actually, the rate in power, from least to greatest, would be:
C/C++ -> Assembly -> Binary
That's also the difficulty to learn lol. C++ is actually VERY easy to learn. I struggle with Assembly. Nobody in their right mind would even attempt binary because they'll fail miserably (guaranteed).
C/C++ -> Assembly -> Binary
That's also the difficulty to learn lol. C++ is actually VERY easy to learn. I struggle with Assembly. Nobody in their right mind would even attempt binary because they'll fail miserably (guaranteed).
GameBoy
08 Dec 2003, 22:51From TNO: Binary is pure machine language, it's impossible to comprehend, it just tells the microchips what to do, like turn this on and turn this off. a human couldnt sit there and try and work it out, because 1 little statement, say...........lets see, say in ASL, you know how you use msg <hello>, that would be a page of binary code when converted to machine, so say like, in VB, if i tell it to take the text box and make it say hello world when you click a button, thats almost like 3 pages of binary, it's insane, there is like noway somebody could do that, it would take too long. A machine reads binary code because that's what the microchips use, so assembly takes the assembly code and converts it into binary. Assembly is as close to binary as you can possibly get. there is nothing closer to machine code than assembly, thats why they use assembly alot to optimise programs, like... use it to make it alot faster coz its closer to machine code. thats why they teach it to you in computer science. you barly ever work in it, but what alot of people do is learn the basics, and they take, diablo 2 for example, use a dis-assembler, and change the code. You can make cracks from programs with assembly.
Cryophile
09 Dec 2003, 22:25lol i was too lazy to say that! where'd you hear that?
BTW, assembly is no longer as difficult as Al makes it seem. You can make a while loop using .repeat and .until (var != var) or similar using the newer versions of MASM (Microsoft Assembler). Also, the code is fairly easy to read, making it only a little harder than C++ and also extremely fast. It's a lot easier to debug as it's made to seem. Still difficult, of course. All in all, I prefer Assembly AND C++ for my coding.
BTW, assembly is no longer as difficult as Al makes it seem. You can make a while loop using .repeat and .until (var != var) or similar using the newer versions of MASM (Microsoft Assembler). Also, the code is fairly easy to read, making it only a little harder than C++ and also extremely fast. It's a lot easier to debug as it's made to seem. Still difficult, of course. All in all, I prefer Assembly AND C++ for my coding.
GameBoy
09 Dec 2003, 22:55Well TNO was explaining to me while i typed it out, word for word lol
Cryophile
09 Dec 2003, 23:36>_< I just realized that TNO=TheNobleOne
I thought you were quoting a book or something.
I thought you were quoting a book or something.
GameBoy
10 Dec 2003, 00:37lol! well, he is kinda like a book source, very clever guy
Anonymous
10 Dec 2003, 08:34
BTW, assembly is no longer as difficult as Al makes it seem. You can make a while loop using .repeat and .until (var != var) or similar using the newer versions of MASM (Microsoft Assembler). Also, the code is fairly easy to read, making it only a little harder than C++ and also extremely fast. It's a lot easier to debug as it's made to seem. Still difficult, of course.
In quoting old 8 bit processor instructions I was trying to illustrate a point, namely that Assembler is a lower level language than C++ and therefore not as "easy", if you can bear to describe C++ as easy that is.
I've used MASM myself in the past. I think it's an utterly horrible thing to use, but then I dislike using C++ (and especially Microsoft's VC6, VC# incarnations of it) with a passion too. It's probably me, but I find Microsoft's V.S. I.D.E. clumsy and counter-intuitive. I won't comment on the MFC framework because I can't honestly do do without using fistfuls of expletives.
On the other hand I know someone who uses the Visual Studio I.D.E to write Interactive fiction because he loves it so much - each to their own I suppose.
"object oriented programming is a fundamentally bad idea that could only have originated in California"
Can't remember which famous computer Guru said that, nor do I know who said...
"When he invented the idea of O.O.P. he was envisaging something like 'Smalltalk', he certainly didn't have C in mind, it's completely unsuitable"
So what is "the" o.o.p we ended up (mostly) saddled with? yep, 'C with objects' a.k.a. C++...
Rant over.
Al (MaDbRiT)
paul_one
10 Dec 2003, 09:14How can you say binary is "more powerful" than assembly? You're basically doing the same thing because assembly is translated INTO binary code....
... And are you sure MASM translates the code into binary and not into a similar MS Windows intermediate language?
... And are you sure MASM translates the code into binary and not into a similar MS Windows intermediate language?
Cryophile
10 Dec 2003, 21:41Uh, maybe I misinterpreted your use of 'power'. I assumed you meant speed and freedom etc. Please inform me if you meant different.
MASM, as with all assemblers, translate assembly directly into binary. C++ compilers basically add to your code (which slows it down) that which you have to do yourself in assembly. Basically, the reason the other languages are so much easier is because the compilers do the difficult (not necessarily, i'm trying to make this simple) code for you. With assembly, you do everything yourself. Still, it suffers a slight loss of speed. Binary is still slightly more powerful.
Also:
Assembly is specific to each platform. Basically, the most-used is x86/80386 assembly.
MASM, as with all assemblers, translate assembly directly into binary. C++ compilers basically add to your code (which slows it down) that which you have to do yourself in assembly. Basically, the reason the other languages are so much easier is because the compilers do the difficult (not necessarily, i'm trying to make this simple) code for you. With assembly, you do everything yourself. Still, it suffers a slight loss of speed. Binary is still slightly more powerful.
Also:
Assembly is specific to each platform. Basically, the most-used is x86/80386 assembly.
Cryophile
10 Dec 2003, 21:47I also wanted to ask Al what languages he uses.
GameBoy
10 Dec 2003, 23:39EDIT: my mistake, thought u said Alex, even though ITID is an idiot, and i hate him more than i hate anything, thanks for pointing out my mistake Merry Xmas to ya, ya big goof
I think Im Dead
11 Dec 2003, 02:24That is very close to being the most retarded thing you've ever typed.
Alex
11 Dec 2003, 08:39
With assembly, you do everything yourself. Still, it suffers a slight loss of speed. Binary is still slightly more powerful
I'm pretty sure this is completely false.
paul_one
11 Dec 2003, 09:37Yeah - I was wondering how binary could be *MORE* powerful than assembly when all assembly is, is taking the binary and turning it into text for us humans to use... It's like a go-between. At least that's the way I always understood it.
.... and I think anyone who doesn't know assembly is specific doesn't know what assembly is.
.... and I think anyone who doesn't know assembly is specific doesn't know what assembly is.
Cryophile
11 Dec 2003, 16:16Ok, ok. I correct myself. The majority of assembly around now is not PURE assembly. It is revised for easier coding and viewing. That's why there's a slight loss. It translates it to pure assembly (almost incomprehensible to most people - still fairly easy) and THEN to binary.
I think Im Dead
11 Dec 2003, 18:42DIE THREAD DIE!
paul_one
11 Dec 2003, 20:43*produces french-stick and plunges it into topic's chest*
GameBoy
12 Dec 2003, 12:52*eats french stick*
Jakk
03 Jan 2004, 21:33Fail at binary, eh slayer? 1 0 1 1 1 0 0 0 1 0!! 1 0 0 1 1 1 0 0 0 0 0!! Man... I hope alex wont ban me for that foul language...
paul_one
04 Jan 2004, 10:57Is that meant to be a total joke?
10-bit letters?
Am I meant to break that into like 3 to 5 bits and turn those into letters?
10-bit letters?
Am I meant to break that into like 3 to 5 bits and turn those into letters?
Cryophile
05 Jan 2004, 19:48Try translating this:
01110010 | 01100101 | 01110100 | 01100001 | 01110010 | 01100100
In case you can't figure it out, I just called you a retard. I also mean this as a joke, Jakk, and not as an offensive comment. Also, I only added the pipes to increase readability (as you should know)
So it should be:
011100100110010101110100011000010111001001100100
If you can't read it, find an ASCII -> Binary list.
Note:
Your comment, 101110001010011100000 roughly translates to:
,§
with five spare 0s
01110010 | 01100101 | 01110100 | 01100001 | 01110010 | 01100100
In case you can't figure it out, I just called you a retard. I also mean this as a joke, Jakk, and not as an offensive comment. Also, I only added the pipes to increase readability (as you should know)
So it should be:
011100100110010101110100011000010111001001100100
If you can't read it, find an ASCII -> Binary list.
Note:
Your comment, 101110001010011100000 roughly translates to:
,§
with five spare 0s
Cryophile
07 Jan 2004, 20:39I'm thinking of starting up a small, local bbs. Only for me and my friends.
No, Jakk, as you can see I didn't fail at binary. With the proper info, it's easy to write simple text, but programming is impossible.
No, Jakk, as you can see I didn't fail at binary. With the proper info, it's easy to write simple text, but programming is impossible.
GameBoy
08 Jan 2004, 06:13my sisters bf could do it. he knew every letter in the alphabet. i'll have to try and learn some of it, looks interesting
paul_one
08 Jan 2004, 08:19Hmmm - I can't remember the ascii thingy prefix... Isn't it 0111xxxx or something like that, where the x's are to be replaced by the number to represent the letter/number/chracter?
Also, Ste - it's NOT interesting, just one huge pain in the ass!
Also, Ste - it's NOT interesting, just one huge pain in the ass!
Alf
08 Jan 2004, 12:45A long time ago, I happened across a humorous look at Assembler. I have it somewhere in the archives of disks in my attic. If I could find it, I'd post it for y'all. Since I can't, I did a search via Google on "Assembler Humor". It yielded some *good* results. I'd post it here, but I don't know how. Anyway, when you need a laugh, and you have a nerdy sense of humor, check it out. Especially on Friday.
Fortunately for me, Assembler was one beast I didn't have to tame.
Alf
PS - No offense intended with the "nerdy" label. OK?
Fortunately for me, Assembler was one beast I didn't have to tame.
Alf
PS - No offense intended with the "nerdy" label. OK?
GameBoy
08 Jan 2004, 16:33nerdy is good.....while people are sat at home still trying to figure out how to use google, they should think about the people who gave them the opertunity to shop online, search for practically ANYTHING, gave them games to play on consoles or PC, and gave them the opertunity to communicate with friends and family and anybody who is on the other side of the world. Thinking about it in my point of view, it's pretty good being apart of the biggest thing in the world, the internet. We are able to provide a game, or a community in which ANYBODY can play. I've made a few good friends on the internet and some i could trust with my life. So nerdy IS a good thing.
Sorry, had to lecture
Sorry, had to lecture
Farvardin
08 Jan 2004, 20:26Someone talked about "microsoft asm". Does it mean Assembly language is not portable, in contrary to C++ ? Then it's better to code in C, C++ or Java...
Cryophile
08 Jan 2004, 21:53I refered to MASM (Microsoft Macro Assembler) if that's what you meant. It's only an assembler, like many, but is a little easier to use (as easy as ASM makes possible lol)
Assembly is not portable to other systems. x86 assembly, for example, is limited to pentium-style processors.
It's always a good idea to use another language. I advice that ASM be used for simple portions of code which need advanced processor/memory manipulation. It shouldn't be coded entirely in ASM. That's way too boring and can be difficult.
Assembly is not portable to other systems. x86 assembly, for example, is limited to pentium-style processors.
It's always a good idea to use another language. I advice that ASM be used for simple portions of code which need advanced processor/memory manipulation. It shouldn't be coded entirely in ASM. That's way too boring and can be difficult.