Re: C# programmer wants to learn assembly?? plz help



Herbert Kleebauer wrote:
Frank Kotler wrote:

Herbert Kleebauer wrote:


Your refusal to use a linker puts you uncomfortably close to the RasAsm
camp. At least, *I* wouldn't be comfortable there!


I don't refuse to use a linker. In your code you used:


extern WriteFile
import WriteFile kernel32.dll
call [WriteFile]


Did you never want to know what this exactly means? The assembler/linker somehow transfers this information from
the assembler source file into the executable output file. For example, how does the assembler/linker determine
the memory address which is used in the "call [WriteFile]"
instruction? Or how is the information "import WriteFile kernel32.dll"
stored in the exe file.

An interesting topic. What does it have to do with learning assembly language? Gideon asked for a simple console example. I only wish I could have provided something in a syntax for the tools he's using - not that I think they're particularly virtuous, but he shouldn't have to change tools to do what he wants. If he'd wanted a byte-by-byte rundown of the PE header, I suppose he would have asked for it...

To understand this, you can either write
your own assembler and linker or generate the binary manually byte
by byte.

If this is what you want to understand, yes. Or you could just read the spec... To *really* understand, you'd want to write your own loader, too, I suppose...

I used the second way, because it's much easier.

Agreed.

But
this is only for understanding and not producing an application.
For an application I most certainly would use a linker but also most
certainly would not use an assembler but a HLL compiler.

Has to be "all or nothing", eh?

That's the same with the graphics output in Linux using the X server. I want to
understand how it works. But if I had to write a graphics application
for Linux I most certainly would use one of the HL tool kits and
not open a unix domain socket to connect to the X server.

When you get down to it, it's an insane way to put pixels on the screen, whether you're doing it or the HL toolkit! But that's the way it works...

But even
if you use such a tool kit, I think it is useful to know, that an
image has to be transferred in 16 kbyte pieces with socket send
commands to the video ram.

Agreed. Almost reminds me of bank-switching. (and like bank-switching. you can probably arrange your screen updates to execute more efficiently if you know how it works)

In contrast, the PE header is just a block of data the loader uses. Not much we can do with it. I'll let the linker worry about that, and save my dwindling brain-cells for what comes *after* "_start"!

Best,
Frank
.



Relevant Pages

  • Re: C# programmer wants to learn assembly?? plz help
    ... I don't refuse to use a linker. ... import WriteFile kernel32.dll ... the assembler source file into the executable output file. ... not open a unix domain socket to connect to the X server. ...
    (alt.lang.asm)
  • Re: PIC Assembler.
    ... Imagine the simplest linker case. ... The assembler is ... these notes and modify this initially blank sheet. ... bytes and writes these as type strings into the OBJ file. ...
    (sci.electronics.basics)
  • Re: PIC Assembler.
    ... Imagine the simplest linker case. ... The assembler is ... these notes and modify this initially blank sheet. ... bytes and writes these as type strings into the OBJ file. ...
    (sci.electronics.basics)
  • Re: C- Syntax to allocate Global variables to consecutive memory locations
    ... define link-time constants. ... it depends upon the linker to provide ... c is where the compiler generates a definition of ... In the assembly language case I mentioned, the assembler is perfectly ...
    (comp.arch.embedded)
  • Re: 2500AD Z80 Tools Rev 3.00d for CP/M available
    ... Linker tools for CP/M to CP/M-centric websites. ... CP/M 2.2 system and common emulators (requires a Z80 cpu). ... it will be nearly impossible to use the assembler! ...
    (comp.os.cpm)