So I wrote my first assembler programs today and there's one thing I wasn't prepared for ... just to output anything to the console you have to convert numbers to strings, and that's frankly to much effort for me right now.

What would I have to do to write binary representations of numbers into a file? I thought this might be straight forward, but the file always ends up empty

So I wrote my first assembler programs today and there's one thing I wasn't prepared for ... just to output anything to the console you have to convert numbers to strings, and that's frankly to much effort for me right now.

What would I have to do to write binary representations of numbers into a file? I thought this might be straight forward, but the file always ends up empty

What about calling some libc functions from your assembler?_________________True ignorance is not the absence of knowledge, but the refusal to acquire it.
A posse ad esse non valet consequentia
Πάντα ῥεῖ

Well, you know, the kernel is also written in C ........... so to avoid calling C code you should avoid the kernel as well _________________True ignorance is not the absence of knowledge, but the refusal to acquire it.
A posse ad esse non valet consequentia
Πάντα ῥεῖ

I haven't tested it, but I believe you are mixing things up with the file write. The second argument to write() (in ECX) should be a pointer to the memory area, while you seem to be storing the value you want to write. Try with LEA or MOV DWORD PTR or whichever syntax your assembler uses.

(My assembly is rusty, so take with a grain of salt)_________________"Freedom incurs responsibility; that is why so many men fear it." - George Bernard Shaw

As Amarantha said: ECX should be loaded with a memory pointer address, not with the value itself (mov cx, offset ergebnis or lea cx,[ergebnis]).
In addition:
- "summand" and "ergebnis" are defined by "db" (which means "one byte"). You actually access them with 32 bits, so they should be defined as 32 bit variables ("dd" whatever your assembler offers)
- if 32 bits should be written, EDX should be loaded with "4", because it defines the number of bytes to be written instead of the number of dwords.

I am somewhat reminded to my first MS-DOS asm programs ... long time ago

Yes, content of ecx should be a reference, this is true. About the length/size I wondered myself ... it has to be 4 bytes? Well at least the registers are 4 bytes large.
But there is some other problem still, somewhere during file opening. I tried to write a predefined string to file and it doesn't work either. To console it works fine, but not to a file.

edit, damn I am an idiot Creating and opening the file both need the filename.
"db" (1 byte numbers) work just fine, btw.