hey everyone ! I am new to this forum and I need some help with asm. I am trying to do a simple program : I want to create a program able to send data ( with winsock I think ) to another computer which react to the data sent. However I do not know how to send/receive data from the net with asm..... most tutorial do not talk about that ( I didn't find one ).....
Posted on 2002-06-28 02:02:04 by Guillaume777
Posted on 2002-06-28 02:23:52 by bazik
Wow thx that was quick !
Posted on 2002-06-28 02:32:09 by Guillaume777
You would even have had a faster reply if you posted on the Networking section... :grin:
Posted on 2002-06-28 04:47:24 by JCP
Also for a good winsock tut, I go to http://tangentsoft.net/wskfaq/ this isn't in asm but a good tut none the less

It seems that you aren't wanting to do HTTP, FTP, etc....

But if you are interested in these then do a search for RFC's ( Request for comments )

FTP is RFC959
SMTP is RFC2821
HTTP is RFC2616

you get the idea

Later,
gorshing
Posted on 2002-06-28 09:19:45 by gorshing
bAZiK your websites are very useful but I do not want to code in a high language with pseudo-instructions ( .if .endif etc ), I want to code in (pure) asm.....
Posted on 2002-06-28 14:31:52 by Guillaume777
bAZiK your websites are very useful but I do not want to code in a high language asm-wannabe, I want to code in (pure) asm.....


Guillaume777, I don't know what you want exactly, but you can't do network programming in 'pure' assembly. Pure assembly would be just using opcodes and you can't do networking with just opcodes. Any windows program has to use the windows API, simply because it's a windows app. The networking API is called winsock and provides good functions to implement networking in a program. You simply have to use this because that's the way it is done in windows. Pure asm would be (although dependent on your definition of pure) talking to the hardware directly and that's not possible in windows.
Besides, pure asm has little use for networking code as the network will always be *much* slower than your code..

edit:
(edited version :) ) bAZiK your websites are very useful but I do not want to code in a high language with pseudo-instructions ( .if .endif etc ), I want to code in (pure) asm.....


The 'HLL' stuff of MASM like .IF and .ENDIF can of course often be replaced by faster handwritten jump sequences but as I said, for networking code it doesn't really matter. Your code will spend most of it's time waiting for data to be sent or received.

Thomas
Posted on 2002-06-28 14:41:44 by Thomas

Guillaume777, I don't know what you want exactly, but you can't do network programming in 'pure' assembly. Pure assembly would be just using opcodes and you can't do networking with just opcodes.


But I thought that everything was possible in assembly, as assembly is the only language PC understand ( every language is converted to asm )....
Posted on 2002-06-28 15:08:31 by Guillaume777
Moderators please delete me
Posted on 2002-06-28 16:44:46 by grv575
But I thought that everything was possible in assembly, as assembly is the only language PC understand ( every language is converted to asm )....


Well in the end, the processor only understands opcodes so everything will be translated into opcodes. However, you don't have full control over the CPU. If you would write your own OS you could have *full* control over the CPU..
But you are writing for an existing OS, in this case Windows. Programs that run under some OS need to conform to the rules made for programs for that OS. The reason for this is simple. Your program is not the only thing that uses the CPU. The OS itself, other processes, and many other things need to work together. This can't be done without rules.

Imagine your program would have full control over the network card. You wouldn't be able to browse the web anymore with an other program running at the same time.

Back in the DOS days, you had more control over the CPU and other hardware because it wasn't a multi-tasking OS and was far less complicated than something like windows.

In windows, programs need to be able to run simultaneously without problems, so hardware can't be accessed directly (without dirty tricks/security flaws). When you program for whatever OS, there's always an extra layer between the hardware and your program, namely the OS itself (the kernel). Any interaction with the hardware (graphics, keyboard, mouse, file I/O, anything) is done via the OS. This ensures your program will run correctly on the OS, even with other programs running at the same time. It will also prevent you from doing certain things, like interrupts and port I/O, for obvious reasons.

*Anything is possible in assembly*, as long as you don't put any restrictions on it yourself. Just the fact that you are programming for a certain OS already puts restrictions on it.

I don't think you should see this as a bad thing. The OS provides an abstraction layer which saves you from the trouble of dealing with different types of hardware (you wouldn't want to write your networking code for every network card available).

Thomas
Posted on 2002-06-28 17:47:28 by Thomas
Every language is (eventually) converted to machine code, but this
doesn't necessarily mean a detout through assembly. Assembly is just
a mnemonic representation of opcodes - like "mov eax, 10" instead of
the bytes B8 0A 00 00 00. Assembly is a lot of things, though. Some
assemblers support only very simple stuff (ie no labels, everything
must be given as immediates). Other assembler take it a step further,
and offers labels and variables. Some offer structures. Some (like
masm) offer certain high-level constructs. But still they're assemblers.
As long as a feature of an assembler doesn't limit you, why not take
advantage of the feature? There isn't really any reason to use multiple
lines to do push/push/push/.../call, when you can do it on a single
line with invoke - the code generated will be the same. Same goes for
the places people usually use IF/ELSE/ENDIF (messageloops), you can't
"optimize" this, in the sense that any optimizations cannot be felt
by the end-user at all... thus, "optimizations" here will be useless
and waste of time - might as well do it the fast way and get your app done.
People who don't want to take advantege of their language are usually
either newbies or elitists.
Posted on 2002-06-28 21:22:50 by f0dder
f0dder, I understand this but I need to use a debugger for my work, and debuggers "translate" all data to "pure(?)" asm. Thats why I want to be able to identify asm code used to send/receive data over the internet. Since there is no if,endif etc in "pure" asm, I need to learn the "real" instructions .....
Posted on 2002-06-28 23:34:31 by Guillaume777
wanna learn the real instructions. Do a search on the board about Intel Manuals. There should be links on those threads.
Posted on 2002-06-29 01:51:25 by stryker

f0dder, I understand this but I need to use a debugger for my work, and debuggers "translate" all data to "pure(?)" asm. Thats why I want to be able to identify asm code used to send/receive data over the internet. Since there is no if,endif etc in "pure" asm, I need to learn the "real" instructions .....


Actually, the .if .else type statements are converted in a very basic level to ASM, so its quite close to the "debug" style format (slight difference). Yup I understand that you want to keep everything in ASM format, but writting your own procedure for "Connect()" for example, (I dont even know if its possible) but I would imagine your procedure would be no less than a thousand lines long.

As for me, if I wanted to check whats wrong with my program I try to use PEBrowse to break it down. But then again, I am not very good at MASM or ASM to begin with (unlike these guru's here) so just thought I'd drop a few words...
Posted on 2002-07-07 22:47:03 by prana
Good work guys you successfully scared him away, there is one less Assembly programmer ='( We are already scare!! :D
Posted on 2002-07-08 14:35:30 by x86asm
well you can use the phone to send datas... (the line must not be busy)
Posted on 2002-07-08 16:04:31 by Vom-bonjour:-()

Good work guys you successfully scared him away, there is one less Assembly programmer ='( We are already scare!! :D


Posted on 2002-07-09 08:47:06 by cTT