Work, work, work, work…
— Gov. Wm. J. Lapetemane
  View background image
IP = 54.162.211.170:55190
Hits = 8,554
This page will likely be of interest only to real assembly language programmers. High-level OOP aficionados will have no choice but to disagree with the information presented here, as it is entirely to basic and nonabstract for them to comprehend.

It is possible to write assembly language programs for Windoze that do not look and act like C, Delphi or Visual Basic. It is possible to do it quickly and simply, without an IDE, a stack of make files, a drive full of include and library files, a giant encyclopedia of documentation or even Windoze itself. All the examples on this page (as well as this page itself) were created with the MICOSYEN program editor under Windoze 98. All can be assembled and linked with DOS tools on a DOS computer or in a DOS box under Windoze.

It is also possible to create a pair of applications from a single source file--one for Windoze and one for extended DOS. Download the Simple Windoze/extended DOS application template and read the comments for more information. The MICOSYEN "dinosaur WordStar syntax" program source editors were created using this methodology. All three versions share common source code and are made in a single step.

Below, are links to everything needed to build a simple Windoze GUI or console application in 100 ms or less. These example programs were ported from DOS, using methodologies and procedures from the world of embedded controllers. They were written from scratch, not "optimized" from the output of some compiler. Hence they look and act like real assembly, unlike that incomprehesible MASM stuff we find all over the Internet.

Tools
MICOSYEN source editor for DOS 2016-07-26 31.99k
MICOSYEN source editor for Windoze (132 x 50 box) 2017-01-04 42.50k
MICOSYEN source editor for Windoze ( 80 x 60 box) 2017-01-04 44.50k
MICOSYEN source editor for Windoze ( 80 x 25 box) 2017-01-04 42.50k
Spell dictionary for editors 2017-06-03 152.74k
TASM5/TLINK32 for DOS 2002-05-13 267.08k
TASM32 for Windoze 2004-02-13 101.41k
TLINK32 for Windoze 2004-02-13 104.87k
TD32 for Windoze 2004-02-13 292.47k
Borland Windoze import library 2004-02-25 83.48k

Example Source Files
Bare simplest Windoze console application template 2004-11-19 7.06k
Simple Windoze console application template 2004-11-19 16.51k
Simple Windoze/extended DOS application template 2004-11-19 21.05k
Windoze console application common subroutines 2010-02-23 31.65k
Windoze console application template 2005-03-01 2.48k
Simple Windoze GUI application template 2004-11-19 8.59k
CpuSpeed.asm (Console example) 2004-11-17 7.90k
Kscope.asm (GUI example) 2004-11-17 15.70k
Straw.asm (GUI example) 2004-11-19 10.97k
Dots.asm (GUI example) 2004-11-17 10.10k
Matrix.asm (GUI example) 2004-11-17 32.40k

The easiest way to make a Windoze assembly application is with a small batch file. Here is a template:
  tasm32 /ml/m4/t/z %1
  tlink32 -Tpe -aa -x -Lc:\apps\tasm5\lib %1,,,import32
  del %1.obj
You will need to change the path to the import library after "-L" ("c:\apps\tasm5\lib" in this example).

Also please note that the "-aa" option should be changed to "-ap" to build a console application.

There is no good single source of documentation for Windoze function calls, structures and variables. The best information always comes from an existing source file, but those are rare. There are two comprehensive free resources for learning the mysteries of Windoze programming. The first is the Platform SDK, which can be downloaded from Microsoft. It contains everything that is known about Windoze, but be forewarned. It is huge, cumbersome, ill-conceived and poorly coded. It installs, writes stuff all over your hard drive and comes with everything in the world you don't need or want. Every time the documentation is accessed, the Microsoft Debug Manager is loaded, thereby causing permanent temporary files to be written to the Windoze directory. In every way, it is the perfect example of why this page exists.

The other resource is the win32.hlp file that ships with Borland Delphi. It can be found many places on the Internet. A Google search for "win32.hlp" should turn up good number of links. The initial file is about 13 MB and expands to twice that size. The viability of this tool is severely compromised, however, by the usage of the old 16-bit Windoze help engine, with its non-realtime scrolling.

Another useful resource is windows.inc. This file contains the most popular structure and constant definitions, collected from the millions of MVC header files. It cannot be included in a TASM source file, because it is filled with nonsensical MASM constructs, but relevant sections can be extracted and placed in your source code. It should be available from the following sites:

http://win32asm.cjb.net
http://www.movsd.com
http://www.masm32.com

Since the vast majority of Windoze code examples are in C++, here are some rules for porting from C to assembly.

  • Symbol names with all upper-case names are constants. Most of them can be found in windows.inc.
  • Symbol names with mixed case are Windoze function calls.
  • Symbol names with all lower case are standard C calls, which have declining support under windoze. They also leave the calling parameters on the stack when they return.
  • Parameters are pushed on the stack in reverse order to the way they appear in the high-level function call. The following C function call
    Event = WaitForMultipleObjects(3,             // Object handle count
                                   WaitEventHans, // Object array pointer
                                   FALSE,         // Activate on any event
                                   INFINITE);     // No timeout
    
    converts to
             push   INFINITE                ;No timeout
             push   FALSE                   ;Activate on any event
             push   offset WaitEventHans    ;Object handle array pointer
             push   3                       ;Object handle count
            call    WaitForMultipleObjects
            mov     [Event],EAX             ;Store return value
    
  • Windoze function calls return status or a value in EAX. Additional values or values larger than 32 bits are returned to the place pointed to by an input parameter.
  • Windoze function calls save EBX, ESI, EDI and EBP. EAX, ECX and EDX are always destroyed.
  • Virtually all Windoze function input parameters are 32 bits. There are a few exceptions, but it should be safe to assume any unknown variable types are that width.
Home Projects Fundamental Design Philosophy Patents More Contact
Page dynamically generated: June 23, 2017, 0:59:43 EDT.
Small print © Copyright 1998-2017 MICOSYEN. All Rights Reserved.
(as if this might prevent you from stealing whatever you want)