flat assembler
Message board for the users of flat assembler.

Index > Heap > The Compiler Returns! (Vs The mummy returns)

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Quote:
[15:31] shash^clp: asm isn't easier
[15:31] Kohlrak: how isn't it?
[15:31] snkmad: its not i can figure
[15:31] snkmad: i just stoped at that chapter
[15:31] shash^clp: it's always easier to use a higher level language
[15:31] snkmad: havent come back in a week or so
[15:32] Kohlrak: easier if you're not concerned about what's going on in your pograms
[15:32] shash^clp: XD
[15:32] shash^clp: with C
[15:32] shash^clp: you know in every single line what's going on
[15:32] snkmad: i still need to write some switch statements samples, to see if i got it right
[15:32] snkmad: then while do
[15:32] shash^clp: writing assembler these days, is plain stupid
[15:32] Kohlrak: not always
[15:33] shash^clp: a compiler can beat you every time
[15:33] shash^clp: on speed related stuff, surely
[15:33] shash^clp: and on size, most times
[15:33] Kohlrak: WITH A COMPILER!?
[15:33] Kohlrak: who are you kidding!?
[15:33] shash^clp: XD
[15:33] Kohlrak: a compiler compiles to asm
[15:33] Kohlrak: then converted to machine code
[15:33] shash^clp: no one, I can demostrate that anytime
[15:33] Kohlrak: go ahead
[15:33] Kohlrak: i'm all years
[15:34] Kohlrak: ears*
[15:34] shash^clp: the compiler can beat your assembler code for speed related stuff
[15:34] Kohlrak: i made a program in less than 5 kb that is over 100 kb in visual studio
[15:34] shash^clp: anytime
[15:34] snkmad: about opengl, would it be hard to make desmume fullscreen using OGL?
[15:34] shash^clp: it's basic pc design
[15:34] shash^clp: Kohlrak: that's laughable too
[15:35] shash^clp: I mean, I've been coding 4k intros for almost 5 years now
[15:35] shash^clp: with plain C
[15:36] Kohlrak: You probably have a decent compiler then, but since compiler converts code to asm then converts it to machine code, it can't do anything better than asm because it's only as good as it's weakest link.
[15:36] shash^clp: XDDDDDDD
[15:36] shash^clp: hell
[15:36] shash^clp: learn to code
[15:36] shash^clp: then go back here
[15:36] Kohlrak: dude
[15:36] shash^clp: you're saying nonsense
[15:36] Kohlrak: i code in both C++ and ASM
[15:36] Kohlrak: don't tell me i don't know how to code
[15:36] shash^clp: well, clearly you need to learn more
[15:36] Kohlrak: you said you could prove it
[15:36] Kohlrak: i'm still waiting for the proof
[15:37] shash^clp: well, a simple vector normalizer
[15:37] snkmad: omg more 2 hours of updates for the game....
[15:37] shash^clp: I can write one that runs like your finest FPU asm code
[15:37] shash^clp: in over 2 seconds
[15:37] shash^clp: in C
[15:37] shash^clp: not to mention, same size
[15:37] snkmad: err 3 hours, this sux
[15:38] shash^clp: in fact, it would probably compress better due to the compiler generating same patters
[15:38] Kohlrak: Let's use the most simple example
[15:38] snkmad: i already waited 30 hours to dl the client
[15:38] Kohlrak: make a program that prints "hello" to the screen using printf
[15:38] shash^clp: why use printf ?
[15:38] shash^clp: printf means that I've to use the crt
[15:39] Kohlrak: easily accessable in C, and after how many times i'm sure we've all used it into the past it's the first thing that came to my mind and i don't have much time to code anything more complicated
[15:39] shash^clp: which is a lot of stuff which is stupid to use on size optimized programs
[15:40] shash^clp: I guess, if you code optimized programs, that you don't rely on the crt
[15:40] shash^clp: *size optimized
[15:40] Kohlrak: i don't rely on it, i just don't have time to use anything more complex
[15:40] Kohlrak: but you have me fired up enough now to make a program to prove the point
[15:40] shash^clp: XD
[15:40] shash^clp: using printf
[15:40] shash^clp: thus using the crt
[15:41] shash^clp: thus proving that you don't have the slighest idea of optimizing in C++
[15:41] shash^clp: thus ditching something you don't have the slighest idea
[15:41] Kohlrak: There's always writeconsole if you'll complain that much
[15:41] shash^clp: XD
[15:41] shash^clp: this is getting funnier
[15:42] shash^clp: ok, whatever
[15:42] shash^clp: I complain
[15:42] shash^clp: because you don't know what you're speaking about
[15:42] shash^clp: ditching C++ because it gets translated to asm
[15:43] shash^clp: is a weak argument, to say the least
[15:43] Kohlrak: asm is faster, my beaf with C++ is the fact that just about everything htere is invisible to everyone
[15:43] shash^clp: XDD
[15:43] shash^clp: yeah, sure
[15:43] shash^clp: ok, asm is faster
[15:43] shash^clp: why ?
[15:43] shash^clp: do you have any good argument ?
[15:45] Kohlrak: More control, less junk code (assuming you know hwo to code properly in asm), and if you have a better understanding you can make better choices of functions to use.
[15:45] shash^clp: XDDDDDDDDDD
[15:45] shash^clp: more control, is rather improbably
[15:45] shash^clp: improbable
[15:45] shash^clp: due to current cpu design
[15:45] shash^clp: you don't know half the time how the pipeline is interpreting your code
[15:45] shash^clp: less junk code
[15:46] shash^clp: well, just look at the asm output of a modern compiler, and you'll why you're wrong
[15:46] snkmad: code lessons for free! XD
[15:46] shash^clp: and the better understanding/functions stuff, is such a bad argument
[15:46] shash^clp: that I don't need to even say anything against it
[15:47] shash^clp: snkmad: hehe
[15:47] snkmad: i just need to stop being lazy, i know i can code
[15:47] shash^clp: well
[15:48] snkmad: idk about OGL and math
[15:48] snkmad: but general stuff
[15:48] snkmad: should be ok
[15:48] shash^clp: yep
[15:49] shash^clp: first the language, then APIs or whatever
[15:49] snkmad: ah i just got my vs2k5 into my hdd
[15:49] snkmad: had to put into my bro ipod, than transfer back here
[15:49] snkmad: since i got no dvd drive atm
[15:49] shash^clp: hehe
[15:50] snkmad: and in the middle of the operation, while coping more files
[15:50] shash^clp: I did the same for vc2k3 in my laptop
[15:50] snkmad: the battery run out
[15:50] snkmad: and the ipod hanged
[15:50] snkmad: hes gonna kill me
[15:50] shash^clp: ouch
[15:50] snkmad: Smile
[15:50] snkmad: this has happened before
[15:51] snkmad: i think it needs to let the battery runs out again, or to manually unplug it
[15:51] shash^clp: amh
[15:52] Kohlrak: ;assembles to 1,536 bytes
format PE console

include '%fasminc%\win32ax.inc'

entry START

section '.idata' readable writeable import

library crt, 'crtdll.dll',\
kernel, 'kernel32.dll'

import kernel, Sleep, 'Sleep',\
ExitProcess, 'ExitProcess'

import crt, printf, 'printf'

section '.code' readable writeable executable
START:
cinvoke printf, <"HELLO", 0>
invoke Sleep, 10000
invoke ExitProcess, 0
[15:52] Kohlrak: beat that...
[15:52] Kohlrak: i dare you
[15:52] snkmad: err pastebin please?
[15:52] shash^clp: XD
[15:52] shash^clp: this is getting funny
[15:53] Kohlrak: i'm still waiting
[15:53] shash^clp: what I've to beat?
[15:53] snkmad: code wars, w000t
[15:53] shash^clp: snkmad: stupid code wars
[15:54] Kohlrak: Make a runable exe that calls printf printing "HELLO" to the screen and have it sleep for 10 seconds so we don't have to use cmd to view the output
[15:54] shash^clp: XD
[15:54] shash^clp: I told you
[15:54] shash^clp: I'm not using printf
[15:54] Kohlrak: why not?
[15:54] Kohlrak: it's the same printf
[15:54] shash^clp: because you've to link the crt
[15:54] Kohlrak: so?
[15:54] Kohlrak: you can do that in C++ too
[15:54] Kohlrak: or c
[15:54] shash^clp: linking the crt, for size optimized programs is stupid
[15:54] shash^clp: but you're free to do so
[15:55] shash^clp: so go ahead with asm
[15:55] Kohlrak: funny
[15:55] Kohlrak: you don't back your arguments
[15:55] shash^clp: and writing a full engine in assembler
[15:55] shash^clp: while I write 10 engines
[15:55] shash^clp: that run faster, are smaller
[15:56] Kohlrak: you talk the talk but not walk the walk
[15:56] shash^clp: and are way more complex
[15:56] snkmad: id rather see shash^clp make desmume a fullscreen option using OGL Razz
[15:57] Kohlrak: but show me it's better shash
[15:57] Kohlrak: or can't you?
[15:57] shash^clp: 1 second
[15:58] shash^clp: void _cdecl WinMainCRTStartup() { MessageBox (NULL, "Hello", "", MB_OK); }
[15:58] shash^clp: Razz
[15:58] shash^clp: here you have
[15:58] shash^clp: 1 import
[15:58] shash^clp: no crt
[15:59] Kohlrak: exe size?
[15:59] shash^clp: about 6XXb
[15:59] shash^clp: why ?
[15:59] Kohlrak: using a different function merits another example on my part
[15:59] shash^clp: XD
[15:59] shash^clp: whatever
[16:00] shash^clp: is not needed
[16:00] shash^clp: you're just making my point
[16:00] shash^clp: about how to lose time, on worst code
[16:01] shash^clp: 100% assembler is stupid nowadays
[16:01] shash^clp: it was ok on the 80's
[16:01] shash^clp: but now, is losing time, and having worst performing programs
[16:02] *** Psy has signed off IRC ().
[16:02] Kohlrak: ;assembles to 1,536 bytes
format PE GUI

include '%fasminc%\win32ax.inc'

entry START

section '.idata' readable writeable import

library user, 'user32.dll',\
kernel, 'kernel32.dll'

import kernel, ExitProcess, 'ExitProcess'

import user, MessageBox, 'MessageBoxA'

section '.code' readable writeable executable
START:
invoke MessageBox, HWND_DESKTOP, <"HELLO", 0>, <"", 0>, MB_OK
invoke ExitProcess, 0

[16:03] shash^clp: yeah, that's readable
[16:03] Kohlrak: actually, the printf example took less space when loaded
[16:03] shash^clp: yeaaah, you're so elite
[16:03] shash^clp: XD
[16:04] shash^clp: and the filesize ?
[16:04] Kohlrak: and your exe which is better?
[16:04] Kohlrak: filesize is 1536
[16:04] shash^clp: XDDDDDDDDDDDDD
[16:04] Kohlrak: bytes
[16:04] Kohlrak: yours?
[16:04] shash^clp: mine 600-700 bytes
[16:04] Kohlrak: alignment error
[16:04] shash^clp: well
[16:04] Kohlrak: all exes have to have sizes divisible by 512
[16:04] shash^clp: XDDDDDDDDDD
[16:04] shash^clp: nope
[16:05] shash^clp: at least for winXP/vista PE loaders
[16:05] Kohlrak: then give me the exe and i'll test it myself
[16:05] shash^clp: ok, I'll upload
[16:05] shash^clp: gimme a second
[16:06] shash^clp: you really want to show everyone how wrong you're, aren't you?
[16:06] *** PsyMan has joined #desmume.
[16:06] Kohlrak: sure
[16:06] Kohlrak: if that's what you call it
[16:06] shash^clp: well
[16:06] shash^clp: I beat you in size
[16:06] shash^clp: in time to write the program
[16:07] shash^clp: and in readability
[16:07] Kohlrak: nested ifs in C are really readable.... (sarcasm)
[16:07] shash^clp: XD
[16:07] shash^clp: really, you need to go learn
[16:08] Kohlrak: riiiiiiiiiight
[16:09] Kohlrak: still waitin' for that exe
[16:10] shash^clp: in fact
[16:10] shash^clp: it's 583 bytes
[16:10] shash^clp: XD
[16:10] Kohlrak: so what's takin' it so long to upload? =p
[16:10] shash^clp: I was writing the program
[16:10] shash^clp: and creating the project
[16:11] Kohlrak: i thought it was already written
[16:11] Kohlrak: how else would you know how big the exe is?
[16:11] shash^clp: because I've been writing 4k intros for 5 years
[16:11] Kohlrak: ooooooooh, riiiiiiiiight
[16:11] shash^clp: and know how much does a simple sample like that
[16:20] shash^clp: I crashed mega upload
[16:20] shash^clp: due to the file being 600bytes
[16:20] shash^clp: XD
[16:21] shash^clp: it says uploading 99%
[16:21] shash^clp: and doesn't finish Sad
[16:21] Kohlrak: it just so happens that i have an upload for you =p
[16:21] shash^clp: go ahead, then
[16:21] Kohlrak: hold on, enabling
[16:22] Kohlrak: http://upload.kohlrak.shorturl.com
[16:22] snkmad: bush hacked hotmail: http://i8.tinypic.com/2ewcpw1.jpg
[16:22] shash^clp: at last
[16:22] shash^clp: file_upload worked Very Happy
[16:22] shash^clp: http://files-upload.com/es/268781/tiny.zip.html
[16:23] shash^clp: executable is 577b
[16:23] shash^clp: I could have uploaded the .cpp too
[16:23] shash^clp: I didn't think of that
[16:24] Kohlrak: i could always re-enable my upload link. No crash issues
[16:24] shash^clp: nah, it's there, in the url I gave
[16:24] shash^clp: 577b hello world example with C
[16:26] shash^clp: it could go down to 558b, if you want to, I can upload that too
[16:27] shash^clp: but I guess my point is clear enough
[16:27] Kohlrak: ... nothing's commin' up. Task manager says that it's jumped up to 91,000+ K space in physical memory, but still nothign is apeparing
[16:27] Kohlrak: ah there it is
[16:27] shash^clp: Razz
[16:27] Kohlrak: after waiting about 20 seconds it decides to do something
[16:28] shash^clp: it takes a while to load
[16:28] Kohlrak: i've noticed
[16:28] Kohlrak: which is a downside
[16:28] shash^clp: depends on how much free you've
[16:28] Kohlrak: mine loads pretty quick
[16:28] shash^clp: I don't fucking care
[16:28] shash^clp: I already beat you on every single point you made
[16:28] Kohlrak: dude, your example uses over 91,000 K
[16:28] Kohlrak: who the hell are you kiddingd?
[16:29] shash^clp: I already beat you on every single point you made
[16:29] Kohlrak: ... no you havn't
[16:30] Kohlrak: the file uses over 91,000 k
[16:30] Kohlrak: takes forever to load
[16:30] Kohlrak: hwo is that beating me?
[16:30] Kohlrak: not in the RAM
[16:30] shash^clp: any other stupid stuff you want
[16:30] *** PsyMan has signed off IRC (Read error: 110 (Connection timed out)).
[16:30] shash^clp: like that it makes cofee?
[16:30] Kohlrak: yes, i was just thinking that
[16:30] Kohlrak: i don't like decaff
[16:31] Kohlrak: 2 sugars, 2 creamers plx
[16:31] shash^clp: http://files-upload.com/268805/tiny_2.zip.html
[16:31] shash^clp: 558b, 10mb ram used
[16:31] shash^clp: the ram is needed, due to other stuff you wouldn't understand
[16:31] Kohlrak: oh riiiiiiiiiiiight
[16:32] Kohlrak: it's called exe decompression
[16:32] snkmad: links dont work here
[16:32] shash^clp: seems you have at least some clues about you do
[16:32] shash^clp: surprising, to say the least
[16:33] shash^clp: snkmad: the programs, or the download link ?
[16:34] Kohlrak: odd, now it's not shutting down immediately
[16:34] Kohlrak: oops
[16:34] Kohlrak: wrong thing
[16:34] Kohlrak: looking at the wrong thing h/o XD
[16:34] Kohlrak: 17 - 18k usage
[16:34] Kohlrak: lemme check mine
[16:35] shash^clp: I don't care
[16:35] shash^clp: I already told you
[16:35] shash^clp: your file is bigger
[16:35] shash^clp: we talked about exe size
[16:35] Kohlrak: 6k usage
[16:35] shash^clp: and mine is smaller
[16:35] shash^clp: you lose, accept it
[16:35] Kohlrak: still bigger in RAM
[16:35] shash^clp: we never talked about ram usage
[16:35] Kohlrak: we have now
[16:36] shash^clp: it's slighty more ram consuming for minor samples
[16:36] snkmad: dl link
[16:36] shash^clp: due to compressor design
[16:36] shash^clp: but
[16:36] shash^clp: my sample is smaller
[16:36] shash^clp: took less to write
[16:36] shash^clp: is easier to read
[16:36] shash^clp: and to mantain
[16:36] Kohlrak: mine dosn't use compression, yours would be bigger without compression
[16:37] shash^clp: let me check
[16:38] shash^clp: yep, 2kb
[16:38] shash^clp: but size coding without compressors is stupid
[16:38] shash^clp: and we didn't say compressors weren't allowed
[16:38] Kohlrak: if i used a compressor (if i had one) my file would have been smaller than it was
[16:38] shash^clp: yep
[16:38] shash^clp: probably, same size as mine
[16:39] shash^clp: but as you lost time writing assembler
[16:39] shash^clp: you didn't have enough to find a compressor
[16:39] shash^clp: Razz
[16:39] Kohlrak: what's funny is your code was .5kb bigger than mine, so my exe would have been smaller with a compressor
[16:39] snkmad: lol
[16:40] snkmad: pwned
[16:40] shash^clp: :S
[16:40] snkmad: shash^clp not u
[16:40] shash^clp: nope
[16:40] shash^clp: compression doesn't work like that
[16:41] Kohlrak: compression (depending on method) looks for common stuff, then replaces it withe either a macro or some other code to represent what was originally there, then the de-compressor replaces it with the original stuff when run
[16:42] shash^clp: and ?
[16:42] shash^clp: how many patters can you find in a 5 nmemonics program ?
[16:42] shash^clp: Razz
[16:43] Kohlrak: so, the point is, with your compressor you beat me, but without i beat you. So with your bag of tricks you beat me, but with an assembly programmer with over a year's worht of experience you would have lost.
[16:43] shash^clp: XDDDDDD
[16:43] shash^clp: I know assembler
[16:43] shash^clp: I've been coding in assembler for several different systems and instructions sets
[16:43] Kohlrak: well i have under a year's worth of experience, therefor i've never had a need for sompressors and junk like that.
[16:43] shash^clp: XD
[16:43] Kohlrak: yo ubeat me, but C still hasn't beat ASM
[16:44] shash^clp: I've been coding in asm for over 8 years now
[16:44] Kohlrak: so? dosn't mean you beat ASM with C
[16:44] shash^clp: I did
[16:44] Kohlrak: on even ground you lost
[16:44] shash^clp: I generated a 5 mnemonics program
[16:44] shash^clp: which was smaller in the end
[16:44] shash^clp: because I could invest more time on other stuff
[16:45] Kohlrak: i don't have the time (without asm) to invest on other things, because i have school work yet and i study other things as well
[16:45] shash^clp: and I didn't change the section alignment
[16:45] shash^clp: neither tweaked compiler settings
[16:45] shash^clp: so I can still generate it smaller
[16:45] shash^clp: but it's losing time
[16:46] shash^clp: I've more experience, know both languages better than you
[16:46] shash^clp: and have proved my point
[16:46] shash^clp: it's enough
[16:46] Kohlrak: What was your point, again? I thought it was a debate over C vs ASM
[16:46] Kohlrak: not me vs you
[16:46] shash^clp: my point being
[16:46] shash^clp: my C program was smaller in the end
[16:46] shash^clp: wasn't it ?
[16:46] shash^clp: 558 is smaller than 15XX
[16:46] Kohlrak: that depends on perspective
[16:46] shash^clp: isn't it ?
[16:47] shash^clp: 558 is smaller than 15XX, no ?
[16:47] Kohlrak: yes, but 1.5 is smaller than 2
[16:47] shash^clp: I don't care
[16:47] shash^clp: my exe is 558 bytes
[16:47] shash^clp: yours is bigger
[16:47] shash^clp: that was what you asked for
[16:47] shash^clp: and that's what you got
[16:48] Kohlrak: Mine is both smaller in RAM and without compression tweeks it's smaller
[16:48] shash^clp: if you wanted different rules
[16:48] shash^clp: you should have thought of it
[16:48] shash^clp: but that's not what you asked for
[16:48] shash^clp: you asked about file size
[16:48] shash^clp: and my C program is smaller
[16:48] shash^clp: so get your facts
[16:48] shash^clp: you were wrong
[16:48] Kohlrak: are there rules when comparing two lagnuages? this was a competition of C vs ASM, not me vs you. Things need to be on an even ground to compaer.


After that he ignored me. I found that funny. After that, i deleted the connection information. I won't waste my precious time on fools like him who have no honor enough to fight on even ground. Under what grounds can anyone say that you can set rules to compare C to ASM, aside from if it can run or not. In all respects, he beat me in coding, but as he ignored to take the argument further and fight on even ground, he lost the argument between C and ASM. Which, needless to say, is a pointless argument anyway, since a chain is as only strong as it's weakest link. What i don't understand is how some one that appaers to have that much experience will stick up for HLLs saying they're better in all respects. I still beat him in size in RAM, but he wouldn't listen to that. Oh well... I guess this goes into the archive of HLL obcession. HLL obcessors fail to realize that ASM does have some advantages, yes it *can* take longer to code certain things, but the question then comes to become which is better between longer coding or longer running and/or downloading. Just some food for thought. What i found interesting was he actually took longer to code (as my code took about 15 seconds to type and hit compile while his took a few minutes). Out of curiosity, what are the thoughts of you all on this matter?
Post 03 Jun 2007, 21:02
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8512
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
i code for fun, and i think asm is cool/easy because it is typeless and we deal in term of variable size only.

regarding the chat, i think one is freely to choose what he/she likes.
Post 03 Jun 2007, 22:12
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
size is not important.

and even if, kohlrak could have used same packer/whatever on his exe and it would be even smaller.

and kohlrak was right about size alignment, it wasn't valid PE (even though loadder accepted it)
Post 03 Jun 2007, 22:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
If you're willing to mangle the PE headers as much as slash^clp's compressor undoubtedly does, 558 bytes is actually pretty large. This guy made a Win32 program only 97 bytes long.
Post 04 Jun 2007, 01:49
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Indeed. Such a file is some what alarming considering that it's supposedly capable of downloading a DLL as well. The most alarming part is that nothing caught it as suspicious, which makes me wonder how AVs figure out weather or not something is a virus, because i've seen non-virus programs marked as viruses already.

Though this "webdav" thing seems interesting. I thought you'd have to use winsocks to accomplish something like this in windows.

Edit: More alarming than that is the fact that the program got passed my firewall. Firewall didn't even ask if it should have gotten internet permissions...

Edit2: I just realized something else. When loading it had an unusual behavior co-existant with that other guy's program. It loads with a little amount of space needed, then it jumps up to a huge amount of space then does it's task. I wonder if that comes from the webdav thing or if it comes from the pe loader trying to realign it. If it's the webdav thing then i doubt he was using C, and in which case i would have beat his assembly code. I'm going ot hex edit this exe of his.

EDIT3: "lz32.dll"... Welp, so much for that unless some one here knows the lz compression. I've noticed "HASH" was used alot...
Post 04 Jun 2007, 03:16
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
Code:

        Asm Vs HLL
1) Asm is Smaller Size.
        "Hello World" type programs are smaller for sure.
        But try writing the MS-Word eg. and the difference
        in size will seem insignificant at best.

        Also, without any tweaking etc. a bare bone window
        generated by a C program and another by a Asm program
        use almost equal amounts of RAM each.

2) Asm is Faster.
        Why tweak to the microcode level when optimizing the
        Algorithm itself is far more resoundsing option.

3) Asm Gives Control.
        With modern OSs everytime you try to do something
        stupid with Asm you get a "Seg Violation" at best.

4) Asm is Art.
        Sure !

5) Asm is addictive.
        Yeah !

6) Asm is very well designed programming tool.
        Agree !

7) Asm is never Obsolete.
        That's Right !

8) You become well aware of your PC with Asm.
        Absolutely !

9) Asm is best done with fasm.
        At present, yes !
        And it will remain so, as long as Tomasz Grysztar lives.

A) There's nothing that Asm can't do.
        Tautology.

B) We Asm lovers just love it, for no reasons,
        OR for whatever reasons.

C) Asm is, what it is, there's no need to compare it against every
        new programming tool.

        After all no one does Asm because because eg. C is bad.
        We do it because we like it, and not that we do it because
        we dislike something else.
    
Post 04 Jun 2007, 06:02
View user's profile Send private message Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
m wrote:
Code:

        Asm Vs HLL
1) Asm is Smaller Size.
        "Hello World" type programs are smaller for sure.
        But try writing the MS-Word eg. and the difference
        in size will seem insignificant at best.

        Also, without any tweaking etc. a bare bone window
        generated by a C program and another by a Asm program
        use almost equal amounts of RAM each.

2) Asm is Faster.
        Why tweak to the microcode level when optimizing the
        Algorithm itself is far more resoundsing option.

3) Asm Gives Control.
        With modern OSs everytime you try to do something
        stupid with Asm you get a "Seg Violation" at best.

4) Asm is Art.
        Sure !

5) Asm is addictive.
        Yeah !

6) Asm is very well designed programming tool.
        Agree !

7) Asm is never Obsolete.
        That's Right !

8) You become well aware of your PC with Asm.
        Absolutely !

9) Asm is best done with fasm.
        At present, yes !
        And it will remain so, as long as Tomasz Grysztar lives.

A) There's nothing that Asm can't do.
        Tautology.

B) We Asm lovers just love it, for no reasons,
        OR for whatever reasons.

C) Asm is, what it is, there's no need to compare it against every
        new programming tool.

        After all no one does Asm because because eg. C is bad.
        We do it because we like it, and not that we do it because
        we dislike something else.
    


1) Have you tried? Per my experience, the statement is just trying to proove a point using a myth.

2) That's the whole point of ASM. You don't use it because you optimize in it, you use it because you can write the code directly, without having to avoid the limitations the language is imposing on you.

3) Try debugging in C and in ASM and tell me if not being able to read your own code in a debugger direcly is a great plus and if errors in C code are any more obvious than the ones in ASM (not to mention most of the errors one can easily make in C, would only appear in ASM code after 3 days of no sleep and no coffee).
Post 04 Jun 2007, 10:44
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
Taking into account the point that any experienced programmer would have to know what the code he writes is doing, which is only possible by translating it into ASM in your mind as you write it. Thus not programming in a HLL does not make the process of programing more complex, but actually simplifies it.

The most commonly used point is that commercial applications cannot afford the devolopment time needed for writing software in Assembly. I had a real life commercial task in front of me... Being a great fan of certain HLLs I of course tried to make it work in one of those. After 3 months of unsucessfully trying to track down and eliminate all the misterious bugs (I tracked the last one down to a windows component I had no control over), I took a simple week of programming and rewrote it's entire functionality into a DLL written in FASM, debugging and optimization included; it's worst bug being a windows resource leak in an optimized if clause (which was summarily done away with with some overhead resource freeing). The integration of the DLL into the remaining HLL code was a fair amount easier than the OCX I previously opted for and a number of resources-related troubles the code had beforehand (high in mathematical calculation, thus resource intensive) were also eliminated due to the high efficiency of the code.

Explaining why I opted to redo the thing in Assembly to my boss took some tactful diplomacy, but after he seen it work the way it does he didn't mind the choice of language anymore.

There are so many myths floating around these topics, it makes me wonder how many of those great program devoloping minds actually have a clue about what they're usually talking about. I've seen people take textbook examples of optimizations that were supposed to be done by compilers and according to their findings, the compilers don't actually do them, that's one myth there. I've seen some wonderfully compiled Delphi code (3 times "SHL eax,1" in a row). I've had first hand experience on what can happen if you rely on the claims of compiler-makers that their usage simplifies programming and debugging (it's a what-the-label-says kinda thing... if you do it exactly how they wanted it, it works, if you want to make something new or useful, it fails catastophically).

I know HLLs can be used to make some simple straightforward things. Making something in ASM that could be done in a shellscript is pointless. But making things on which you are responsible for ensuring their functionality, there is hardly any other responsible choice but ASM, unless the solution is already offered from another reliable source. Please note that most software companies do not hold themselves responsible for the functionality of their code.
Post 04 Jun 2007, 11:08
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
Well, i cannot agree with you guys.

In most cases, using HLL is more practical for few reasons:
- It provides portability over processor architectures
- It is more readable for others, only few programmers can read assembly "fluently"
- It provides developing "framework" you must build yourself in assembly (not really true for C language)
- HLL constructs are sometimes better than goto-only in pure assembly (not as often as many think, but still)

I have done two bigger assembly projects: (Becher Shock game and FASMLIB), and I also did bigger C project in work, so i think i have enough experiences to judge from both sides.

Problem with HLL is that you should only use it if you understand how it works (not only WHAT it does, but also HOW). When you understand this, then HLL construct may be a nice helper, which allows to do most common constructs simpler. Just like FASM's "import" or "proc" macros, do you use them?

But when HLL is used by people without good ASM backing, it gets raped to terrible measures. They want to use HLL constructs without understanding them, and result is same as using FASM macros without understanding them: mess. Even worse is that programming is being pushed in direction to make using HLL without understanding it even easier, and that results in beasts like .net framework, or some smart code wizards.

I can't say this is entirely bad, if some company needs to build boring huge system and doesn't care about performace, it's better for them to hire .net programmers whose training is cheaper. Nothing against. But quality suffers...
Post 04 Jun 2007, 11:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
Don't mean to pick and troll but I got a question here, vid.

vid wrote:
- It is more readable for others, only few programmers can read assembly "fluently"


Are you sure this is a problem? I have found commented HLL code to be much harder to make out typically than commented ASM code. You don't read the code, you read the comments and make out the parts you need to link or modify.

I've been mostly interfacting different programming languages (of different levels of high-levelness) and found a lot of problems with figuring out how to properly interface some C code and such because you never really know if something is data, pointer or symbol-terminated string and what innitialization you need to do before calling a function.
Post 04 Jun 2007, 17:09
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
Quote:
Are you sure this is a problem? I have found commented HLL code to be much harder to make out typically than commented ASM code. You don't read the code, you read the comments and make out the parts you need to link or modify.

how much experience with larger C projects do you have? I had same problem, but now i found out that i can read C code quite well.

anyway, many programmers don't know assembly at all, and many know it only very sparsely and couldn't understand asm code, that was what i meant with this sentence. For me reading C or Asm code is equally hard - Asm code needs more time to understand actual code, and C code needs more time to learn all abstraction created by coder Smile

Quote:
I've been mostly interfacting different programming languages (of different levels of high-levelness) and found a lot of problems with figuring out how to properly interface some C code and such because you never really know if something is data, pointer or symbol-terminated string and what innitialization you need to do before calling a function.
i don't understand what you mean by "interfacing" here
Post 04 Jun 2007, 17:18
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Face it, when the whole HLL vs. asm wars start up (as they frequently do), it's usually C vs. asm. Now, we know that C is very popular, portable, widely accessible via libs and APIs, and is quite fast (one of the fastest) with decent optimizations due to a relatively long lifetime for a programming language. However, lots of so-called "improvements" have been invented since, and it's debatable whether any of them have any significant merit in some common cases.

As Dustwolf said, using a shell script is often much better than reinventing the wheel on everything. But, C itself is not all powerful like assembly. And I certainly think that C is nowhere near as "easy" as some people claim. It is widely used in various dialects (same with assembly), so both have the same steep learning curve.

This guy (in the above chat transcript) is not worth arguing with. If it's easier for him to do C, let him. Different people have different skills and needs. But assembly is not bad unless your OS is a pain to program with it.

You're basically limited by your own knowledge, OS, and development tools and program needs, not by any specific language itself.
Post 04 Jun 2007, 23:37
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Quote:
3) Try debugging in C and in ASM and tell me if not being able to read your own code in a debugger direcly is a great plus and if errors in C code are any more obvious than the ones in ASM (not to mention most of the errors one can easily make in C, would only appear in ASM code after 3 days of no sleep and no coffee).


But here's the problem. I've run into so many errors in my C++ code that were only fixable with "patches." For example, i called cin >> (), got my junk, but then i wanted to call cin.getline(), which i had to do twice, because i had to patch it for the first one. I find this irresponsible way of getting your code to work, and things like this were my main reson for going to assembly.

Quote:
Explaining why I opted to redo the thing in Assembly to my boss took some tactful diplomacy, but after he seen it work the way it does he didn't mind the choice of language anymore.

There are so many myths floating around these topics, it makes me wonder how many of those great program devoloping minds actually have a clue about what they're usually talking about. I've seen people take textbook examples of optimizations that were supposed to be done by compilers and according to their findings, the compilers don't actually do them, that's one myth there. I've seen some wonderfully compiled Delphi code (3 times "SHL eax,1" in a row). I've had first hand experience on what can happen if you rely on the claims of compiler-makers that their usage simplifies programming and debugging (it's a what-the-label-says kinda thing... if you do it exactly how they wanted it, it works, if you want to make something new or useful, it fails catastophically).


Exactly, and that underlined line is amount the truest things i've heard all day. Anyone can make the same kind of apps with the same kind of buttons and everything, but if you wanted to use a new algroitham, you're in deep doodoo.

Quote:
I know HLLs can be used to make some simple straightforward things. Making something in ASM that could be done in a shellscript is pointless. But making things on which you are responsible for ensuring their functionality, there is hardly any other responsible choice but ASM, unless the solution is already offered from another reliable source. Please note that most software companies do not hold themselves responsible for the functionality of their code.


And for good reson.

Quote:
It provides portability over processor architectures


Processor, but not platform. Exit the standard library, which you pretty much need to do to get away from console, and you're risking cross platform-ability.

Quote:
It is more readable for others, only few programmers can read assembly "fluently"


I prefer CMPs and Jxxs over { }. I can't count how many times i have messed up on brackets.

Quote:
Problem with HLL is that you should only use it if you understand how it works (not only WHAT it does, but also HOW). When you understand this, then HLL construct may be a nice helper, which allows to do most common constructs simpler. Just like FASM's "import" or "proc" macros, do you use them?


Usually, we can understand the language itself, but how the functions affect the things in the code is anyone's guess.

Quote:
But when HLL is used by people without good ASM backing, it gets raped to terrible measures. They want to use HLL constructs without understanding them, and result is same as using FASM macros without understanding them: mess. Even worse is that programming is being pushed in direction to make using HLL without understanding it even easier, and that results in beasts like .net framework, or some smart code wizards.


Leads to inability to pass the code onto others unless you use the exact same version of the exact same program. The further you go with wizards, the less your projects will port. I've noticed some of this happening in visual studio and sometimes even in fasm without the assistance of wizards. It's common, and then you have the issue of tutorials in C/C++ and other HLLs that don't use examples that require wizards, and well the results sometimes work and sometimes dosn't. DirectX comes to mind in this.

Quote:
I can't say this is entirely bad, if some company needs to build boring huge system and doesn't care about performace, it's better for them to hire .net programmers whose training is cheaper. Nothing against. But quality suffers...


Sounds like microsoft. They own the computer platforms these day, pretty much, so they have no worries. No one challenges them, so you have the BS with vista and stuff.

Quote:
Asm code needs more time to understand actual code, and C code needs more time to learn all abstraction created by coder


Then when i code, you'll deffinately want to read my ASM code, because my C++ code is... Cryptic to say the least. Got some really bad grades for it.
Post 05 Jun 2007, 00:32
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
kohlrak wrote:
For example, i called cin >> (), got my junk, but then i wanted to call cin.getline(), which i had to do twice, because i had to patch it for the first one. I find this irresponsible way of getting your code to work, and things like this were my main reson for going to assembly.

could you explain what exactly overloaded operator >> does with cin? This is exactly what i was saying, about using things you understand.

Quote:
Processor, but not platform. Exit the standard library, which you pretty much need to do to get away from console, and you're risking cross platform-ability.

actually, even the cross platform portability is little bit better, because there are numerous portability libraries, most without interface for ASM.

Quote:
Quote:
It is more readable for others, only few programmers can read assembly "fluently"

I prefer CMPs and Jxxs over { }. I can't count how many times i have messed up on brackets.

yeah, but C for example "jcc" too: "if (cc) goto somewhere". You don't have to use brackets (but you have to have procedures, yeah, sometimes it's annoying)

Quote:
Quote:
I can't say this is entirely bad, if some company needs to build boring huge system and doesn't care about performace, it's better for them to hire .net programmers whose training is cheaper. Nothing against. But quality suffers...


Sounds like microsoft. They own the computer platforms these day, pretty much, so they have no worries. No one challenges them, so you have the BS with vista and stuff.

not them, i meant "bussiness" companies with lot managers, buzzwords, solutions, boxes&arrows, graphs, etc...
Post 05 Jun 2007, 05:57
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
vid wrote:
Quote:
I've been mostly interfacting different programming languages (of different levels of high-levelness) and found a lot of problems with figuring out how to properly interface some C code and such because you never really know if something is data, pointer or symbol-terminated string and what innitialization you need to do before calling a function.
i don't understand what you mean by "interfacing" here


Since I work with very HLL languages, I often have to turn to other languages to create the components I need to do stuff (not that what I do is such a biggie, but there is a performance problem as the programs need all the CPU a box can spare). By interfacing I thus mean linking modules written in other languages to the trunk of the code written in a HLL.

Needless to say, nearly all HLL languages including C present problems with interfacing with a different programming language, primarily because they are only made for interfacing with themselves (the point of which evades me; see above what I said about compilers and labels).
Post 05 Jun 2007, 09:33
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
DustWolf: yes, this is quite big problem. Microsoft was fighting it with it's COM technologies, but finally gave it up and created .net Smile
Post 05 Jun 2007, 12:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DustWolf



Joined: 26 Jan 2006
Posts: 373
Location: Ljubljana, Slovenia
DustWolf
vid wrote:
DustWolf: yes, this is quite big problem. Microsoft was fighting it with it's COM technologies, but finally gave it up and created .net Smile


The point being that documented FASM DLLs work just fine! It wouldn't be a problem if they didn't make it a problem.
Post 05 Jun 2007, 13:06
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Quote:
could you explain what exactly overloaded operator >> does with cin? This is exactly what i was saying, about using things you understand.


Yea, but what they didn't tell me was that it left a "trailing newline" when i used it.

Quote:
actually, even the cross platform portability is little bit better, because there are numerous portability libraries, most without interface for ASM.


But from what i've seen, alot of programs still use the kernel.

Quote:
yeah, but C for example "jcc" too: "if (cc) goto somewhere". You don't have to use brackets (but you have to have procedures, yeah, sometimes it's annoying)


Goto's are no longer taught from what i've seen. In the few situations that they are, they are shuned upon. The biggest problem that i've seen is the lack of understanding, which i'm sure you've seen. The thing is that now adays, HLLs are considered the best way, and theachers often encourage the lack of understanding, because there's "no need, for it does everything for you." But irregardless, gotos don't neccesarily improve readability over CMPs much...

Quote:
not them, i meant "bussiness" companies with lot managers, buzzwords, solutions, boxes&arrows, graphs, etc...


Most of the time you can find free software out there to do that for you.

Quote:
Needless to say, nearly all HLL languages including C present problems with interfacing with a different programming language, primarily because they are only made for interfacing with themselves (the point of which evades me; see above what I said about compilers and labels).


Monopoly. If they aren't compatable, everyone has to switch to that, which could provide new jobs (on the upside), but on the downside is that companies can take advantage of this to take over a particular programming language (we can see this now with microsoft's new call to flash) forcing people, in the end, to use only their products.

Quote:
DustWolf: yes, this is quite big problem. Microsoft was fighting it with it's COM technologies, but finally gave it up and created .net


As i said above, it's more than just .net.

Quote:
The point being that documented FASM DLLs work just fine! It wouldn't be a problem if they didn't make it a problem.


Not for us, but it would be for them.
Post 05 Jun 2007, 23:34
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
vid
kohlrak wrote:
Quote:
could you explain what exactly overloaded operator >> does with cin? This is exactly what i was saying, about using things you understand.

Yea, but what they didn't tell me was that it left a "trailing newline" when i used it.

acutally, i would name it that it "doesn't skip following blank characters". I faced similar design problem with FASMLIB, and their solution is really the best one, we can discuss it in separate topic if you like.

Quote:
Quote:
actually, even the cross platform portability is little bit better, because there are numerous portability libraries, most without interface for ASM.

But from what i've seen, alot of programs still use the kernel.

like? (besides assembly demos, yeah, these do it)
Problem with using linux kernel API is that it is not quaranteed by any means. It is just something over what can be standard C library built. Idea is something like this: if the kernel API needs to change, libc is only app that needs to change too, and all other programs using libc are fine, nothing is broken.

Quote:
Goto's are no longer taught from what i've seen. In the few situations that they are, they are shuned upon. The biggest problem that i've seen is the lack of understanding, which i'm sure you've seen. The thing is that now adays, HLLs are considered the best way, and theachers often encourage the lack of understanding, because there's "no need, for it does everything for you." But irregardless, gotos don't neccesarily improve readability over CMPs much...

agree

Quote:
Most of the time you can find free software out there to do that for you.
no, not for things like this. If some hospital needs ready-made system for managing anything releated to employees, patients, drugs, stocks, workhours, lunches, web interface etc... etc.., they have no choice but to pay some company to put it together for them.
Post 06 Jun 2007, 00:08
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Anybody who thinks goto is frowned upon in "real life" needs to read this thread (mainly to see my examples).

Also, HLLs do not do everything, they usually rely on libraries which themselves cannot be written entirely in such language. Am I the only one who balks every time C is called "low level"?? It's nowhere near as low level as assembly. There are things you just can't do in C (standard, especially).
Post 07 Jun 2007, 04:38
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.