Author Topic: Small Hello World  (Read 1652 times)

TWell

  • Member
  • ****
  • Posts: 748
Small Hello World
« on: December 14, 2016, 10:42:32 PM »
I just couldn't resist after seeing QT5 example:
Code: [Select]
using System;
// c:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe HelloC#.cs
class HelloCS
{
static void Main()
{
Console.WriteLine("Hello World");
}
}
3 Kb

jj2007

  • Member
  • *****
  • Posts: 7551
  • Assembler is fun ;-)
    • MasmBasic
Re: Small Hello World
« Reply #1 on: December 14, 2016, 11:18:15 PM »
Why don't you post the exe here, so that we can test it?

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Small Hello World
« Reply #2 on: December 14, 2016, 11:35:10 PM »
JWASM sample Linux5 =  122 bytes ( NB: it's size of executable)

TWell

  • Member
  • ****
  • Posts: 748
Re: Small Hello World
« Reply #3 on: December 15, 2016, 12:36:27 AM »
Why don't you post the exe here, so that we can test it?
There was commandline example for creating it
Code: [Select]
c:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe HelloC#.cs

jj2007

  • Member
  • *****
  • Posts: 7551
  • Assembler is fun ;-)
    • MasmBasic
Re: Small Hello World
« Reply #4 on: December 15, 2016, 01:29:49 AM »
Code: [Select]
Microsoft Windows [Versione 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tutti i diritti riservati.

C:\Masm32\MasmBasic\Members\TWell>HelloC#.exe
Hello CSharp - built on Jochen's computer

It works :t

Now the same with QT, please - any volunteers?

Mikl__

  • Member
  • ****
  • Posts: 537
Re: Small Hello World
« Reply #5 on: December 16, 2016, 09:42:55 AM »
Tiny MessageBox x64 in FASM
Size of exe-file is 298 bytes
Win32 API. Lesson 2c. Further reduce the MessageBox
How create MessageBox for Windows XP 32-bits with size of exe-file is 97 bytes
« Last Edit: December 16, 2016, 11:51:53 AM by Mikl__ »

sinsi

  • Member
  • ****
  • Posts: 996
Re: Small Hello World
« Reply #6 on: December 16, 2016, 02:57:23 PM »
Behind every small exe is a big framework  :biggrin:
I can walk on water but stagger on beer.

jj2007

  • Member
  • *****
  • Posts: 7551
  • Assembler is fun ;-)
    • MasmBasic
Re: Small Hello World
« Reply #7 on: December 16, 2016, 08:22:10 PM »
Yep, I was indeed surprised that it ran on my Win7-64 installation - I've always tried to avoid .not :(

My Win10 machine installs whatever it wants, or thinks it wants. Even if I put it in suspend or hibernate mode, it wakes up in the middle of the night and lets M$ take control. If these guys from Redmond would at least switch off the light when they go home, I might tolerate their bad manners. But they don't - the machine stays awake. I've always hated Bill Gates for all the extra work that he caused me in terms of Windows bugs (and yes, a rich edit control is definitely part of the OS); but maybe he is the only one who could save Microsoft, once a proud and arrogant company, now just a joke 8)

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Small Hello World
« Reply #8 on: December 16, 2016, 08:26:40 PM »
...
Win32 API. Lesson 2c. Further reduce the MessageBox
How create MessageBox for Windows XP 32-bits with size of exe-file is 97 bytes

It doesn't say "Hello , World!"

hello.asm = 62 bytes

Mikl__

  • Member
  • ****
  • Posts: 537
Re: Small Hello World
« Reply #9 on: December 16, 2016, 09:30:01 PM »
GoneFishing
hello.asm = 62 bytes is ELF-file
 exe-file with size has 97 bytes is PE-file
97 bytes are the theoretical minimum for the length of PE-file. At offset + 5Ch on the signature «PE» is Subsystem field. Accommodation in this field is zero, or the absence of this field in the file system loader perceived as IMAGE_SUBSYSTEM_UNKNOWN value (= 0) and the system will not upload the file. Therefore, a shift of + 5Ch «PE» must be within a non-zero value. Since we put in this field the value IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, then under the Subsystem field sufficiently take 1 byte. Total: 4 bytes (MZ-header) + 5Ch (the size of PE-header field to «Subsystem») + 1 byte (by itself «Subsystem» field) = 61h = 97 bytes

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Small Hello World
« Reply #10 on: December 16, 2016, 09:37:17 PM »
Mikl__
I understand it.  I just wanted to say that if you include required string "Hello  World" your exe will slightly grow in size . Currently you're using "user32" string both for title and text .

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4813
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Small Hello World
« Reply #11 on: December 16, 2016, 09:48:12 PM »
You guys must be suffering from boredom.  :P
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Small Hello World
« Reply #12 on: December 16, 2016, 09:51:47 PM »
You guys must be suffering from boredom.  :P

So True ! 

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: Small Hello World
« Reply #13 on: December 16, 2016, 09:54:14 PM »
My Win10 machine installs whatever it wants, or thinks it wants. Even if I put it in suspend or hibernate mode, it wakes up in the middle of the night and lets M$ take control.
:biggrin:

It's time for Linux, now or never. Nevertheless most of us are accustomed to Windows. What I do not understand is that most computers come with Windows preinstalled. I removed it from my son's computer and installed Linux Mint, with which it works without problems, where is my money? :icon_rolleyes:
En un lugar de la Mancha de cuyo nombre no quiero acordarme

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: Small Hello World
« Reply #14 on: December 16, 2016, 09:59:28 PM »
268 bytes with nasm compiler. reference
En un lugar de la Mancha de cuyo nombre no quiero acordarme