Discussion:
beginner assembler for windows?
(too old to reply)
paul
2021-01-16 19:03:06 UTC
Permalink
advise for a good beginner windoze assembler?
Sjouke Burry
2021-01-17 04:39:33 UTC
Permalink
Post by paul
advise for a good beginner windoze assembler?
Go to a carpenter?
Frank Kotler
2021-01-17 06:14:30 UTC
Permalink
Post by paul
advise for a good beginner windoze assembler?
Masm, Nasm, Fasm... all are good. I prefer Nasm.

Best,
Frank
paul
2021-01-17 22:38:10 UTC
Permalink
Post by Frank Kotler
Masm, Nasm, Fasm... all are good. I prefer Nasm.
Name is easy.
Binary installer is harder.
Choosing a beginner assembler even harder still.

In order of suggested above
Masm
Requires visual c
https://www.microsoft.com/en-us/download/details.aspx?id=12654

Maybe not
MASM https://sourceforge.net/projects/masm611/

Nasm
https://nasm.us/
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/

Fasm
Maybe here? https://sourceforge.net/projects/fasm/
Or here?
https://flatassembler.net/download.php

Which is the right downloads for Windows 10 (64-bit)?
paul
2021-01-18 03:35:02 UTC
Permalink
Post by paul
In order of suggested above
Masm
Requires visual c
https://www.microsoft.com/en-us/download/details.aspx?id=12654
My advice after trying to install MASM for an hour?
Never recommend MASM to a beginner.

Reason?
The MASM installer is easily found at Microsoft.
https://www.microsoft.com/en-us/download/details.aspx?id=12654
But it fails to install because it's hungry for Microsoft tools.
Microsoft Macro Assembler (MASM)
Microsoft Visual C++ Express Edition 2005 required.

Don't even think of installing the latest Visual C++ as I did.
https://visualstudio.microsoft.com/downloads/
Because it wants an older version.

And don't think just any old older version will work.
https://visualstudio.microsoft.com/vs/older-downloads/

It wants that specific older version.
Which doesn't exist in any Microsoft site that I could find.

Oh sure, you can find plenty of service pack patches for that older version
https://www.microsoft.com/en-eg/download/details.aspx?id=804
VS80sp1-KB926749-X86-INTL.exe 24.3 MB
VS80sp1-KB926747-X86-INTL.exe 32.3 MB
VS80sp1-KB926748-X86-INTL.exe 43.5 MB
VS80sp1-KB926750-X86-ENU.exe 19.0 MB
VS80sp1-KB926751-X86-INTL.exe 29.9 MB

But none of them work without the actual older version.
Windows Installer:
The upgrade patch cannot be installed by the Windows Installer
service because the program to be upgraded may be missing,
or the upgrade patch may update a different version of the program.
Verify that the program to be upgraded exists on your computer
and that you have the correct upgrade patch.

It's a conspiracy, I swear.
If you happen to know where Microsoft hides the "real" 2005 Visual C++,
this noob would love to know where they hid it.

Otherwise, MASM is out of the game in the opening move.
paul
2021-01-18 04:50:38 UTC
Permalink
Post by paul
Otherwise, MASM is out of the game in the opening move.
Reluctantly I gave up on Microsoft MASM in favor of http://www.masm32.com/
which I'll call for lack of the right words, the "masm sdk".

I found out about the "masm sdk" from this tutorial PDF
https://doc.lagout.org/operating%20system%20/Windows/winasmtut.pdf

When I installed that "masm sdk", it created c:\masm32 which
I promptly moved to my working directory c:\mypath\masm32

Then I followed the hello world instructions in that tutorial PDF
creating this "hello.asm" text file, only with mypath substituted
.386
.model flat, stdcall
option casemap :none

include \mypath\masm32\include\windows.inc
include \mypath\masm32\include\kernel32.inc
include \mypath\masm32\include\masm32.inc

includelib \mypath\masm32\lib\kernel32.lib
includelib \mypath\masm32\lib\masm32.lib

.data
HelloWorld db "Hello World!", 0

.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
end start

As per the instructions in the PDF, an object module was created
C:\mypath\masm32\bin\ml.exe /c /Zd /coff hello.asm

And an executable was then created & executed successfully
C:\mypath\masm32\bin\Link /SUBSYSTEM:CONSOLE hello.obj

hello.exe
Hello World!

The second tutorial example also worked in this first pass test
edit hellow.asm

.386
.model flat, stdcall
option casemap :none

include \mypath\masm32\include\windows.inc
include \mypath\masm32\include\kernel32.inc
include \mypath\masm32\include\user32.inc

includelib \mypath\masm32\lib\kernel32.lib
includelib \mypath\masm32\lib\user32.lib

.data
HelloWorld db "Hello World!", 0
.code
start:
invoke MessageBox, NULL, addr HelloWorld, addr HelloWorld, MB_OK
invoke ExitProcess, 0
end start

C:\mypath\masm32\bin\ml.exe /c /Zd /coff hellow.asm
C:\mypath\masm32\bin\Link /SUBSYSTEM:WINDOWS hellow.obj
hellow.exe

This popped up a "Hello World" window with an OK button.

Given the official Microsoft MASM installation failed because it needs
ancient visual c++ software that I couldn't find on the Microsoft site, can
one of you just let me know if this substitute MASM SDK is what you'd
suggest for a beginner like me.
George Neuner
2021-01-18 14:21:31 UTC
Permalink
On Mon, 18 Jan 2021 04:35:02 +0100, paul
Post by paul
Post by paul
In order of suggested above
Masm
Requires visual c
https://www.microsoft.com/en-us/download/details.aspx?id=12654
Actually it only requires a linker. Do you think Microsoft would
recommend any but their own?
Post by paul
My advice after trying to install MASM for an hour?
Never recommend MASM to a beginner.
Reason?
The MASM installer is easily found at Microsoft.
https://www.microsoft.com/en-us/download/details.aspx?id=12654
But it fails to install because it's hungry for Microsoft tools.
Microsoft Macro Assembler (MASM)
Microsoft Visual C++ Express Edition 2005 required.
MASM v8 is ancient.
Post by paul
Don't even think of installing the latest Visual C++ as I did.
https://visualstudio.microsoft.com/downloads/
Because it wants an older version.
And don't think just any old older version will work.
https://visualstudio.microsoft.com/vs/older-downloads/
It wants that specific older version.
Which doesn't exist in any Microsoft site that I could find.
Oh sure, you can find plenty of service pack patches for that older version
https://www.microsoft.com/en-eg/download/details.aspx?id=804
VS80sp1-KB926749-X86-INTL.exe 24.3 MB
VS80sp1-KB926747-X86-INTL.exe 32.3 MB
VS80sp1-KB926748-X86-INTL.exe 43.5 MB
VS80sp1-KB926750-X86-ENU.exe 19.0 MB
VS80sp1-KB926751-X86-INTL.exe 29.9 MB
But none of them work without the actual older version.
The upgrade patch cannot be installed by the Windows Installer
service because the program to be upgraded may be missing,
or the upgrade patch may update a different version of the program.
Verify that the program to be upgraded exists on your computer
and that you have the correct upgrade patch.
It's a conspiracy, I swear.
If you happen to know where Microsoft hides the "real" 2005 Visual C++,
this noob would love to know where they hid it.
Otherwise, MASM is out of the game in the opening move.
You absolutely CAN install the current Visual Studio (vs2019) and use
MASM with it. See
https://docs.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference


MASM has been included with "Express" versions of Visual Studio at
least since 2012 (don't know about earlier). The assemblers are
installed by default with the C or C++ developer packages, or they can
be installed manually.

The executables are "ml.exe" (32-bit) and "ml64.exe" (64-bit).


George
paul
2021-01-19 01:58:36 UTC
Permalink
Post by George Neuner
Actually it only requires a linker. Do you think Microsoft would
recommend any but their own?
If I can't find the MS URLs, it's cruel to suggest MASM for a beginner.

I am confused by that statement because the 311KB Microsoft MASMsetup.EXE
https://www.microsoft.com/en-us/download/details.aspx?id=12654
won't install without 62MB Visual C++ 2005 Express Edition installed.

The 311KB MASMsetup.exe errors out and does not install anything.
How did you get around that requirement?

Worse, Visual C++ 2005 Express Edition doesn't exist anywhere on the Microsoft web site (that I can find) and the MASMsetup.EXE won't take the newer Visual C++ installation.
https://en.wikipedia.org/wiki/Microsoft_Visual_Studio_Express

Are you sure of what you said which is it only needs a linker?
How do you install MASMsetup.exe when it's looking for a specific C++?
Post by George Neuner
MASM v8 is ancient.
I only installed MASM because it was the first assembler on the
suggested list when I had originally asked for experienced advice.

If I can't find the MS URLs, it's cruel to suggest MASM for a beginner.
Post by George Neuner
You absolutely CAN install the current Visual Studio (vs2019) and use
MASM with it. See
https://docs.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference
MASM has been included with "Express" versions of Visual Studio at
least since 2012 (don't know about earlier). The assemblers are
installed by default with the C or C++ developer packages, or they can
be installed manually.
The executables are "ml.exe" (32-bit) and "ml64.exe" (64-bit).
Nobody told me that when I asked.
If I can't find the MS URLs, it's cruel to suggest MASM for a beginner.

I would love to know the link that works because every link I had tried failed.
Looking up your suggestion, it appears "Visual Studio Express" is now apparently
renamed "Visual Studio Community" https://visualstudio.microsoft.com/vs/express/

The 2019 1.4KB Visual Studio Community web stub (vs_Community.exe) is
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

It downloads a much larger installer into
C:\ProgramData\Microsoft\VisualStudio\Packages
which then puts the Visual Studio IDE into
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
And it puts shared components in
C:\Program Files (x86)\Microsoft Visual Studio\Shared

It allows the user to choose either
Visual Studio Community 2019
Visual Studio Enterprise 2019
Visual Studio Professional 2019

The list of individual components is humongous in its entirety
.NET
.NET 5.0 Runtime
.NET Core 2.1 Runtime (LTS)
.NET Core 2.2 Runtime (out of support)
.NET Core 3.0 Runtime (out of support)
.NET Core 3.1 Runtime (LTS)
.NET Framework 3.5 development tools
.NET Framework 4 targeting pack
.NET Framework 4.5 targeting pack
.NET Framework 4.5.1 targeting pack
.NET Framework 4.5.2 targeting pack
.NET Framework 4.6 targeting pack
.NET Framework 4.6.1 SDK
.NET Framework 4.6.1 targeting pack
.NET Framework 4.6.2 SDK
.NET Framework 4.6.2 targeting pack
.NET Framework 4.7 SDK
.NET Framework 4.7 targeting pack
.NET Framework 4.7.1 SDK
.NET Framework 4.7.1 targeting pack
.NET Framework 4.7.2 SDK
.NET Framework 4.7.2 targeting pack
.NET Framework 4.8 SDK
.NET Framework 4.8 targeting pack
.NET Native
.NET Portable Library targeting pack
.NET SDK
Advanced ASP.NET features
Development Tools plus .NET Core 2.1
ML.NET Model Builder (Preview)
Web Development Tools plus .NET Core 2.1

Cloud, database, and server
Azure Authoring Tools
Azure Cloud Services build tools
Azure Cloud Services core tools
Azure Compute Emulator
Azure Data Lake and Stream Analytics Tools
Azure development prerequisites
Azure libraries for .NET
Azure Powershell
Azure Resource Manager core tools
Azure Storage AzCopy
Azure Storage Emulator
Azure WebJobs Tools
Cloud Explorer
CLR data types for SQL Server
Connectivity and publishing tools
Container development tools
Data sources and service references
Data sources for SQL Server support
IIS Express
Service Fabric Tools
SQL ADAL runtime
SQL Server Command Line Utilities
SQL Server Data Tools
SQL Server Express 2016 LocalDB
SQL Server ODBC Driver
Visual Studio Tools for Kubernetes
Web Deploy

Code tools
Azure DevOps Office Integration
Class Designer
ClickOnce Publishing
Dependency Validation
Developer Analytics tools
DGML editor
Git for Windows
GitHub extension for Visual Studio
Help Viewer
LINQ to SQL tools
NuGet package manager
NuGet targets and build tasks
PreEmptive Protection - Dotfuscator
Text Template Transformation

Compilers, build tools, and runtimes
.NET Compiler Platform SDK
C# and Visual Basic Roslyn compilers
C++ 2019 Redistributable MSMs
C++ 2019 Redistributable Update
C++ Clang Compiler for Windows (10.0.0)
C++ Clang-cl for v142 build tools (x64/x86)
C++ CMake tools for Windows
C++ Modules for v142 build tools (x64/x86 �V experimental)
C++ Universal Windows Platform support for v142 build tools (ARM64)
C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]
C++/CLI support for v141 build tools (14.16)
C++/CLI support for v142 build tools (14.20)
C++/CLI support for v142 build tools (14.21)
C++/CLI support for v142 build tools (14.22)
C++/CLI support for v142 build tools (14.23)
C++/CLI support for v142 build tools (14.24)
C++/CLI support for v142 build tools (14.25)
C++/CLI support for v142 build tools (14.26)
C++/CLI support for v142 build tools (14.27)
C++/CLI support for v142 build tools (14.28)
IncrediBuild - Build Acceleration
MSBuild
MSVC v140 - VS 2015 C++ build tools (v14.00)
MSVC v141 - VS 2017 C++ ARM build tools (v14.16)
MSVC v141 - VS 2017 C++ ARM Spectre-mitigated libs (v14.16)
MSVC v141 - VS 2017 C++ ARM64 build tools (v14.16)
MSVC v141 - VS 2017 C++ ARM64 Spectre-mitigated libs (v14.16)
MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)
MSVC v141 - VS 2017 C++ x64/x86 Spectre-mitigated libs (v14.16)
MSVC v142 - VS 2019 C++ ARM build tools (v14.20)
MSVC v142 - VS 2019 C++ ARM build tools (v14.21)
MSVC v142 - VS 2019 C++ ARM build tools (v14.22)
MSVC v142 - VS 2019 C++ ARM build tools (v14.23)
MSVC v142 - VS 2019 C++ ARM build tools (v14.24)
MSVC v142 - VS 2019 C++ ARM build tools (v14.25)
MSVC v142 - VS 2019 C++ ARM build tools (v14.26)
MSVC v142 - VS 2019 C++ ARM build tools (v14.27)
MSVC v142 - VS 2019 C++ ARM build tools (v14.28)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.20)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.21)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.22)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.23)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.24)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.25)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.26)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.27)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.28)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.20)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.21)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.22)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.23)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.24)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.25)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.26)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.27)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.28)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.20)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.21)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.22)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.23)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.24)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.25)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.26)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.27)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.28)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.20)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.21)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.22)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.23)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.24)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.25)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.26)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.20)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.21)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.22)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.23)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.24)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.25)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.26)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.27)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.28)
Python 2 32-bit (2.7.18)
Python 2 64-bit (2.7.18)
Python 3 32-bit (3.7.8)
Python 3 64-bit (3.7.8)
Windows Universal CRT SDK

Debugging and testing
.NET profiling tools
C++ AddressSanitizer (Experimental)
C++ profiling tools
JavaScript diagnostics
Just-In-Time debugger
Test Adapter for Boost.Test
Test Adapter for Google Test

Development activities
ASP.NET and web development tools
ASP.NET MVC 4
C# and Visual Basic
C++ Android development tools
C++ CMake tools for Linux
C++ core features
C++ for Linux Development
C++ iOS development tools
Embedded and IoT development tools
F# desktop language support
F# language support
F# language support for web projects
IntelliCode
JavaScript and TypeScript language support
Live Share
Node.js development tools
Office Developer Tools for Visual Studio
Python language support
Python miniconda
Python web support
Razor Language Services
Visual Studio Tools for Office (VSTO)
Windows Communication Foundation
Windows Workflow Foundation
Xamarin
Xamarin Remoted Simulator

Emulators
Google Android Emulator (API Level 25) (local install)
Intel Hardware Accelerated Execution Manager (HAXM) (local install)

Games and Graphics
Android IDE support for Unreal engine
Cocos
Graphics debugger and GPU profiler for DirectX
Image and 3D model editors
Unity Hub
Unreal Engine installer
Visual Studio Tools for Unity

SDKs, libraries, and frameworks
Android SDK setup (API level 25) (local install for Mobile development with C++)
Android SDK setup (API level 28)
Apache Ant (1.9.3)
C++ ATL for latest v142 build tools (ARM)
C++ ATL for latest v142 build tools (ARM64)
C++ ATL for latest v142 build tools (x86 & x64)
C++ ATL for latest v142 build tools with Spectre Mitigations (ARM)
C++ ATL for latest v142 build tools with Spectre Mitigations (ARM64)
C++ ATL for latest v142 build tools with Spectre Mitigations (x86 & x64)
C++ ATL for v141 build tools (ARM)
C++ ATL for v141 build tools (ARM64)
C++ ATL for v141 build tools (x86 & x64)
C++ ATL for v141 build tools with Spectre Mitigations (ARM)
C++ ATL for v141 build tools with Spectre Mitigations (ARM64)
C++ ATL for v141 build tools with Spectre Mitigations (x86 & x64)
C++ MFC for latest v142 build tools (ARM)
C++ MFC for latest v142 build tools (ARM64)
C++ MFC for latest v142 build tools (x86 & x64)
C++ MFC for latest v142 build tools with Spectre Mitigations (ARM)
C++ MFC for latest v142 build tools with Spectre Mitigations (ARM64)
C++ MFC for latest v142 build tools with Spectre Mitigations (x86 & x64)
C++ MFC for v141 build tools (ARM)
C++ MFC for v141 build tools (ARM64)
C++ MFC for v141 build tools (x86 & x64)
C++ MFC for v141 build tools with Spectre Mitigations (ARM)
C++ MFC for v141 build tools with Spectre Mitigations (ARM64)
C++ MFC for v141 build tools with Spectre Mitigations (x86 & x64)
C++ v14.20 ATL for v142 build tools (ARM)
C++ v14.20 ATL for v142 build tools (ARM64)
C++ v14.20 ATL for v142 build tools (x86 & x64)
C++ v14.20 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.20 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.20 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.20 MFC for v142 build tools (ARM)
C++ v14.20 MFC for v142 build tools (ARM64)
C++ v14.20 MFC for v142 build tools (x86 & x64)
C++ v14.20 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.20 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.20 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.21 ATL for v142 build tools (ARM)
C++ v14.21 ATL for v142 build tools (ARM64)
C++ v14.21 ATL for v142 build tools (x86 & x64)
C++ v14.21 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.21 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.21 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.21 MFC for v142 build tools (ARM)
C++ v14.21 MFC for v142 build tools (ARM64)
C++ v14.21 MFC for v142 build tools (x86 & x64)
C++ v14.21 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.21 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.21 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.22 ATL for v142 build tools (ARM)
C++ v14.22 ATL for v142 build tools (ARM64)
C++ v14.22 ATL for v142 build tools (x86 & x64)
C++ v14.22 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.22 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.22 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.22 MFC for v142 build tools (ARM)
C++ v14.22 MFC for v142 build tools (ARM64)
C++ v14.22 MFC for v142 build tools (x86 & x64)
C++ v14.22 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.22 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.22 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.23 ATL for v142 build tools (ARM)
C++ v14.23 ATL for v142 build tools (ARM64)
C++ v14.23 ATL for v142 build tools (x86 & x64)
C++ v14.23 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.23 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.23 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.23 MFC for v142 build tools (ARM)
C++ v14.23 MFC for v142 build tools (ARM64)
C++ v14.23 MFC for v142 build tools (x86 & x64)
C++ v14.23 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.23 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.23 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.24 ATL for v142 build tools (ARM)
C++ v14.24 ATL for v142 build tools (ARM64)
C++ v14.24 ATL for v142 build tools (x86 & x64)
C++ v14.24 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.24 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.24 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.24 MFC for v142 build tools (ARM)
C++ v14.24 MFC for v142 build tools (ARM64)
C++ v14.24 MFC for v142 build tools (x86 & x64)
C++ v14.24 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.24 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.24 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.25 ATL for v142 build tools (ARM)
C++ v14.25 ATL for v142 build tools (ARM64)
C++ v14.25 ATL for v142 build tools (x86 & x64)
C++ v14.25 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.25 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.25 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.25 MFC for v142 build tools (ARM)
C++ v14.25 MFC for v142 build tools (ARM64)
C++ v14.25 MFC for v142 build tools (x86 & x64)
C++ v14.25 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.25 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.25 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.26 ATL for v142 build tools (ARM)
C++ v14.26 ATL for v142 build tools (ARM64)
C++ v14.26 ATL for v142 build tools (x86 & x64)
C++ v14.26 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.26 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.26 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.26 MFC for v142 build tools (ARM)
C++ v14.26 MFC for v142 build tools (ARM64)
C++ v14.26 MFC for v142 build tools (x86 & x64)
C++ v14.26 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.26 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.26 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.27 ATL for v142 build tools (ARM)
C++ v14.27 ATL for v142 build tools (ARM64)
C++ v14.27 ATL for v142 build tools (x86 & x64)
C++ v14.27 ATL for v142 build tools with Spectre Mitigations (ARM)
C++ v14.27 ATL for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.27 ATL for v142 build tools with Spectre Mitigations (x86 & x64)
C++ v14.27 MFC for v142 build tools (ARM)
C++ v14.27 MFC for v142 build tools (ARM64)
C++ v14.27 MFC for v142 build tools (x86 & x64)
C++ v14.27 MFC for v142 build tools with Spectre Mitigations (ARM)
C++ v14.27 MFC for v142 build tools with Spectre Mitigations (ARM64)
C++ v14.27 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
Entity Framework 6 tools
Modeling SDK
OpenJDK (Microsoft distribution)
TypeScript 4.0 SDK
USB Device Connectivity
Visual Studio SDK
Windows 10 SDK (10.0.16299.0)
Windows 10 SDK (10.0.17134.0)
Windows 10 SDK (10.0.17763.0)
Windows 10 SDK (10.0.18362.0)
Windows 10 SDK (10.0.19041.0)
Windows Universal C Runtime

That's it.
If MASM is in that list, I don't see where.

If anyone knows how to install MASM without Visual Studio, I'm happy to try.
Even with Visual Studio, I haven't yet seen any way that it can work yet.

If I can't find the MS URLs, it's cruel to suggest MASM for a beginner.
Tavis Ormandy
2021-01-19 04:14:44 UTC
Permalink
Post by paul
Post by George Neuner
Actually it only requires a linker. Do you think Microsoft would
recommend any but their own?
If I can't find the MS URLs, it's cruel to suggest MASM for a beginner.
I think people were trying to steer you towards nasm, which has the easy
to find binaries you've been dreaming of.

Visual Studio is a huge, complicated commercial product. It's also
really popular with Windows Developers, so there's a good chance you
already knew how to navigate the installer and the components.
Post by paul
That's it.
If MASM is in that list, I don't see where.
If you're deadset on masm, it's the "MSVC xxx build tools" component,
but most developers choose "Workloads", and you'll get it with the C++
one.

Just use nasm, it's great. The skills you learn will transfer to any
other assmbler easily.

Tavis.
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
Kerr-Mudd,John
2021-01-19 09:44:25 UTC
Permalink
Post by Tavis Ormandy
Post by paul
Post by George Neuner
Actually it only requires a linker. Do you think Microsoft would
recommend any but their own?
If I can't find the MS URLs, it's cruel to suggest MASM for a
beginner.
Post by Tavis Ormandy
I think people were trying to steer you towards nasm, which has the easy
to find binaries you've been dreaming of.
Visual Studio is a huge, complicated commercial product. It's also
really popular with Windows Developers, so there's a good chance you
already knew how to navigate the installer and the components.
Post by paul
That's it.
If MASM is in that list, I don't see where.
If you're deadset on masm, it's the "MSVC xxx build tools" component,
but most developers choose "Workloads", and you'll get it with the C++
one.
Just use nasm, it's great. The skills you learn will transfer to any
other assmbler easily.
Just be aware that Nasm code isn't directly assemblable (word?) under
Masm;

notably masm's 'dup' isn't supported and segment overides must be
internal, i.e.
[Nasm] mov [es:bx], dl
[Masm] mov es:[bx], dl

there's a few other diffrences, especially if you get into macro
programming.
Heck; download nasm and read the nasm.doc!
--
Bah, and indeed, Humbug.
paul
2021-01-19 13:47:17 UTC
Permalink
Post by Tavis Ormandy
I think people were trying to steer you towards nasm, which has the easy
to find binaries you've been dreaming of.
I tried Nasm right after the first MASM attempt failed, as I went through
each of the suggestions faithfully, in the order they were presented to me.

I didn't mention that failed effort because I haven't found a good tutorial
that works the first time (which all good tutorials should).

Strangely, there is no "hello world" in Jeff Duntemann "Assembly Language
Step-by-Step" paperback where his philosophy is different from mine.

Mine is that we learn empirically where we get things working before we
break them, and his is to break them before we get anything working.

As you advised, I found that Nasm installed far better than did Masm
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/

In my paperback Jeff Duntemann assembly language book, the first code is
an "eat.asm" example as the first program deep into the book at page 228

; Source name : EAT.ASM
; Executable name : EAT.COM
; Code model: : Real mode flat model
; Version : 1.0
; Created date : 6/4/1999
; Last update : 9/10/1999
; Author : Jeff Duntemann
; Description : A simple example of a DOS .COM file programmed using
; NASM-IDE 1.1 and NASM 0.98.
[BITS 16] ; Set 16 bit code generation
[ORG 0100H] ; Set code start address to 100h (COM file)
[SECTION .text] ; Section containing code
START:
mov dx, eatmsg ; Mem data ref without [] loads the ADDRESS!
mov ah,9 ; Function 9 displays text to standard output.
int 21H ; INT 21H makes the call into DOS.

mov ax, 04C00H ; This DOS function exits the program
int 21H ; and returns control to DOS.

[SECTION .data] ; Section containing initialized data

eatmsg db "Eat at Joe's!", 13, 10, "$" ; Here's our message

I then ran:
nasm -f BIN EAT.ASM -o EAT.COM

This created "eat.com" which, when executed, errored with
Unsupported 16-Bit-Application
The program or feature "??\C;\mypath\nasm\eat.com" cannot start or run due
to incompatibility with 64-bit versions of Windows.
Please contact the software vendor to ask if a 64-bit Windows compatible
version is available.

Changing this line in "eat.asm" didn't change the error message
; [BITS 16] ; Set 16 bit code generation
; [BITS 32] ; Set 32 bit code generation
[BITS 64] ; Set 64 bit code generation
Nor did commenting it out entirely.

I probably have to figure out how to specify a 64-bit address
or 64-bit registers, as something is wrong above.

I didn't bring this up because this problem is due to me being too much of
a noob to know why I even need to set the number of bits, nor why no matter
what setting I use, I get the same error.

What I really need is a decent Nasm tutorial which starts with a working
"hello world" example. Then I can worry about the intricacies of assembly
language coding on a 64-bit Windows 10 box.
Post by Tavis Ormandy
Visual Studio is a huge, complicated commercial product. It's also
really popular with Windows Developers, so there's a good chance you
already knew how to navigate the installer and the components.
Personally, I like simple but I do not disagree MS is popular with Windows
developers. I'm not a Windows developer. I'm just a person.
Post by Tavis Ormandy
Post by paul
If MASM is in that list, I don't see where.
If you're deadset on masm, it's the "MSVC xxx build tools" component,
but most developers choose "Workloads", and you'll get it with the C++
one.
I'm not dead set on anything. I just want to follow a decent tutorial on
assembly language programming for Windows that works from the start.
Post by Tavis Ormandy
Just use nasm, it's great. The skills you learn will transfer to any
other assmbler easily.
I'm OK with Nasm. As I said I was simply faithfully following advice given.

My Nasm problem isn't in the installer but in the tutorial since not only
didn't the Duntemann book have an "hello world", it seems to use gcc, where
if I had wanted to use a compiler, I would have started with a higher level
language to learn.

Any decent Nasm tutorial you know of?
Kerr-Mudd,John
2021-01-19 16:22:12 UTC
Permalink
On Tue, 19 Jan 2021 13:47:17 GMT, paul
Post by paul
Post by Tavis Ormandy
I think people were trying to steer you towards nasm, which has the
easy to find binaries you've been dreaming of.
I tried Nasm right after the first MASM attempt failed, as I went
through each of the suggestions faithfully, in the order they were
presented to me.
I didn't mention that failed effort because I haven't found a good
tutorial that works the first time (which all good tutorials should).
Strangely, there is no "hello world" in Jeff Duntemann "Assembly
Language Step-by-Step" paperback where his philosophy is different
from mine.
Mine is that we learn empirically where we get things working before
we break them, and his is to break them before we get anything
working.
As you advised, I found that Nasm installed far better than did Masm
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/
In my paperback Jeff Duntemann assembly language book, the first code
is an "eat.asm" example as the first program deep into the book at
page 228
; Source name : EAT.ASM
; Executable name : EAT.COM
; Code model: : Real mode flat model
; Version : 1.0
; Created date : 6/4/1999
; Last update : 9/10/1999
; Author : Jeff Duntemann
; Description : A simple example of a DOS .COM file programmed using
; NASM-IDE 1.1 and NASM 0.98.
[BITS 16] ; Set 16 bit code generation
[ORG 0100H] ; Set code start address to 100h (COM file)
[SECTION .text] ; Section containing code
mov dx, eatmsg ; Mem data ref without [] loads the ADDRESS!
mov ah,9 ; Function 9 displays text to standard output.
int 21H ; INT 21H makes the call into DOS.
mov ax, 04C00H ; This DOS function exits the program
int 21H ; and returns control to DOS.
[SECTION .data] ; Section containing initialized data
eatmsg db "Eat at Joe's!", 13, 10, "$" ; Here's our message
nasm -f BIN EAT.ASM -o EAT.COM
This created "eat.com" which, when executed, errored with
Unsupported 16-Bit-Application
The program or feature "??\C;\mypath\nasm\eat.com" cannot start or
run due to incompatibility with 64-bit versions of Windows.
Please contact the software vendor to ask if a 64-bit Windows
compatible version is available.
Changing this line in "eat.asm" didn't change the error message
; [BITS 16] ; Set 16 bit code generation
; [BITS 32] ; Set 32 bit code generation
[BITS 64] ; Set 64 bit code generation
Nor did commenting it out entirely.
I probably have to figure out how to specify a 64-bit address
or 64-bit registers, as something is wrong above.
I didn't bring this up because this problem is due to me being too
much of a noob to know why I even need to set the number of bits, nor
why no matter what setting I use, I get the same error.
No, it's because the created "application" will only work under DOS or an
emulated environment -nothing to do with the BITS setting; W10 doesn't
have a DOS compatible subsystem out of the box. (32bit Win XP is fine!)
Post by paul
What I really need is a decent Nasm tutorial which starts with a
working "hello world" example. Then I can worry about the intricacies
of assembly language coding on a 64-bit Windows 10 box.
you'll need DOSEMU or DOSBOX or somesuch.

[]
Post by paul
I'm OK with Nasm. As I said I was simply faithfully following advice given.
My Nasm problem isn't in the installer but in the tutorial since not
only didn't the Duntemann book have an "hello world", it seems to use
gcc, where if I had wanted to use a compiler, I would have started
with a higher level language to learn.
Any decent Nasm tutorial you know of?
--
Bah, and indeed, Humbug.
paul
2021-01-19 17:37:54 UTC
Permalink
Post by Kerr-Mudd,John
No, it's because the created "application" will only work under DOS or an
emulated environment -nothing to do with the BITS setting; W10 doesn't
have a DOS compatible subsystem out of the box. (32bit Win XP is fine!)
Thanks for that advice as I want to start with something working like a
"hello world", and then proceed from there with at least the first program
working. That's how tutorials are supposed to work anyways.

I guess that probably means I need to change the original question to ask
for an assembler that works with a modern operating system like Win10 x64.
Post by Kerr-Mudd,John
Post by paul
What I really need is a decent Nasm tutorial which starts with a
working "hello world" example. Then I can worry about the intricacies
of assembly language coding on a 64-bit Windows 10 box.
you'll need DOSEMU or DOSBOX or somesuch.
Does that mean there are no free assemblers (along with beginner tutorials)
that work native on a modern Win10 x64?
Tavis Ormandy
2021-01-19 18:26:49 UTC
Permalink
Post by paul
Thanks for that advice as I want to start with something working like a
"hello world", and then proceed from there with at least the first program
working. That's how tutorials are supposed to work anyways.
I guess that probably means I need to change the original question to ask
for an assembler that works with a modern operating system like Win10 x64.
The assembler isn't the issue, you're trying to assemble a program
written for DOS. You need to find a tutorial designed for the system
you're targetting. Which language do you usually write in? If you're a C
programmer, you wouldn't expect CreateWindowEx() to work on DOS, and
likewise int 21h doesn't work on Windows.

The assemblers suggested can assemble programs for Windows 10, you've
been given good advice.
Post by paul
Post by Kerr-Mudd,John
you'll need DOSEMU or DOSBOX or somesuch.
Does that mean there are no free assemblers (along with beginner tutorials)
that work native on a modern Win10 x64?
Do you mean "beginner" in the sense that you're an experienced Win32
developer, but not familiar with assembly?

Tavis.
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
paul
2021-01-20 05:00:12 UTC
Permalink
Post by Tavis Ormandy
The assembler isn't the issue, you're trying to assemble a program
written for DOS. You need to find a tutorial designed for the system
you're targetting.
I apologize if I didn't know enough to ask the right question.

I just want to assemble a few programs on the Windows 10 x64 command line.

I would have called that "DOS" but it seems it's not DOS at all based on
what others said, so I don't know what else to call that command interface.

I press the Windows key & the "r" key, and then I type "cmd"
and then I press the "enter" key. Whatever CLI that happens to
be called, is what I want the program I assemble to work inside of.
Post by Tavis Ormandy
Which language do you usually write in? If you're a C
programmer, you wouldn't expect CreateWindowEx() to work on DOS, and
likewise int 21h doesn't work on Windows.
I am not a developer. I'm just a person. I just want to follow a basic
tutorial that takes a noob through the first set of five or ten programs.

Have you seen the Android Studio tutorials (in Kotlin & in Java) for
example? In an hour or two, you have a handful of programs working on your
cellphone, where none of them fail in my experience.

The only time you get a failure is when you go off script, and then you can
back up and go back on script and they suddenly work again.

Surely such a tutorial must exist for an assembler tutorial on Windows 10.
Post by Tavis Ormandy
The assemblers suggested can assemble programs for Windows 10, you've
been given good advice.
Are you sure MASM is good advice for a noob if they also have to install
hundreds of megabytes of software just to get a 311 kilobyte assembler to
work?

And, is Nasm good advice for a noob if the tutorials they're using
(admittedly obviously lousy tutorials) result in failed programs from the
start?

All a noob beginner wants is a tutorial that results in code that works.

It's ok if that code is super simple (why do you think "hello world" is a
standard in almost all programming languages anyways?).
Post by Tavis Ormandy
Do you mean "beginner" in the sense that you're an experienced Win32
developer, but not familiar with assembly?
The last time I took an IBM assembly language class was way back in the
sixties, where my first language was Fortran in the seventies, and my second
was COBOL and PL/1 was my third, still in the seventies, and that was the
last programming class I ever took.

We're talking punched cards of IBM JCL (in the first few cards) and then,
much later, being able to type at terminals (before modems, which were "new
fangled" decades later, when the AT&T phone was put into the cushions but we
still sat at "terminals" and waited for our folded paper to be pulled off
the dot matrix printer and put in the bins by alphabetical login names.

All this, of course, predates the personal computer, linux, etc., but what
was then and is now, is that a good tutorial is an empirical thing, much as
a good physics lab is empirical more so than theoretical.

What I'm looking for is an empirical assembly language tutorial for use on a
modern Windows desktop, where that empirical tutorial is much like that of
Android Studio, which is about as perfect as a tutorial can be in my
humblest of noob opinions.

Did you ever take a lab class in school?
The lab tells you exactly what to do, does it not?
You learn by watching what happens, but the lab is designed to work.

All I want is an assembly language tutorial that works just like a lab works
in physics or chemistry or biology, where the lab is designed to work for
everyone.

If the lab doesn't work, either it's a terrible lab, or a terrible student,
but more often any lab that doesn't work is just a poorly designed lab.

The tutorial I want is like a chemistry experiment lab, where the guy
writing the lab knows what's supposed to happen. The noob doing the lab just
makes it happen as the lab was written.

So far I haven't found that tutorial yet as the lab includes the equipment
(the lab is worthless without the equipment).

The assembly language tutorial is worthless without the assembler in that
respect just as a chemistry lab without chemicals is worthless as a lab.
Tavis Ormandy
2021-01-20 08:17:32 UTC
Permalink
Post by paul
Post by Tavis Ormandy
The assembler isn't the issue, you're trying to assemble a program
written for DOS. You need to find a tutorial designed for the system
you're targetting.
I apologize if I didn't know enough to ask the right question.
I just want to assemble a few programs on the Windows 10 x64 command line.
I would have called that "DOS" but it seems it's not DOS at all based on
what others said, so I don't know what else to call that command interface.
Ah-ha, right, that was the source of the confusion. It's a reasonable
mustake, 32-bit Windows *could* run DOS programs using virtual 8086 mode
(a sort of emulation), so your program would have just worked!
Post by paul
Did you ever take a lab class in school?
The lab tells you exactly what to do, does it not?
You learn by watching what happens, but the lab is designed to work.
I feel your frustration, but you're trying to jump in at the deep end
with native win64 assembly language. This is just opinion, but I think
starting with C or C++ would be a better option. If you want to learn
assembly as you go, you can examine the code the compiler generates and
try to follow along with what it's doing.

One fun tool you can look at is compiler explorer, take a look:

https://godbolt.org/z/WW3383

You write some C on the left, and it shows you nicely formatted
assembly on the right. You can try changing something, and watch what
happens to the generated code.

Tavis.
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
paul
2021-01-20 12:47:47 UTC
Permalink
Post by Tavis Ormandy
I feel your frustration, but you're trying to jump in at the deep end
with native win64 assembly language.
When I asked the question originally, I had no idea it would be this hard.

I figured it would be like any freshman level physics lab.
1. You check out the equipment (e.g., a capacitance tester)
2. You grab a ziplock bag of pre-prepared capacitors of various types
3. You measure their capacitance, and write up a report

Notice that the lab is designed to work.
The student simply follows the steps.
The learning is in watching it work.

I don't want to design my own capacitor like Pieter van Musschenbroek did.
I'm not building a competitive capacitor like Ewald Jurgen von Kleist did.
I'm not breaking any new ground in capacitor design like William Watson did.

I just want to learn about capacitors by running a simple lab.
Like any freshman physics student would.

I just want to learn about assembly language by running a simple tutorial.
Post by Tavis Ormandy
This is just opinion, but I think
starting with C or C++ would be a better option. If you want to learn
assembly as you go, you can examine the code the compiler generates and
try to follow along with what it's doing.
The reason I dropped the comp sci curriculum was syntax, where every
language does the same damn thing using completely different syntax.

For example, Fortran's trenchant yet precise syntax resulted in a terse
"Error 50", which you had to look up in a book in the computer room locked
down to a table with half the pages missing. On the opposite side of the
spectrum, COBOL was downright loquacious, with bombastic divisions and gabby
data types. Somewhere in between was PL/1 but my point is they all do the
same damn thing, but with completely different syntax.

I swore I'd never learn another programming language in the early seventies,
and I stuck to my word, and even now, I don't want to learn assembly
language just like I don't want to learn how to design a microprocessor.

Suffice to know that CPUs boot from a specific memory location in ROM where
temporary storage is in RAM, and that registers are used to push, pull and
pop stuff off the stack, etc.

You can get all that knowledge WITHOUT designing your own CPU, as a "lab" of
sorts, where all you do is watch it happen on simple code:
Load Accumulator A with the data in memory location 1
Load Accumulator B with the data in memory location 2
Add Accumulator A and Accumulator B & call printf to display the result

I don't want to write my own assembly language programs.
I just want to watch it happen which is why I seek a tutorial.
But a tutorial that doesn't work is a worthless tutorial in my humble
opinion as I'm not on strange equipment (Windows 10 x64).

I'm on the most common home equipment there is.
So there MUST be a tutorial that walks me through a bunch of hello worlds.

Even PL/1 syntax drove me nuts, although Fortran took the cake in terseness
what with looking up the errors by number ("Error 42" was all you got) in a
book the size of the Gutenberg Bible.
Post by Tavis Ormandy
https://godbolt.org/z/WW3383
I looked at https://godbolt.org/z/WW3383 which does seem like a fun tool in
that you put your "hello world" c code at left, and it creates the assembly
language code at the right.

In my not too distant past, I had, like everyone did, all the SAMS books,
along with the blue & white teach yourself c in 21 days little handbook,
where I toyed with C just as I want to toy a bit with assembly code today.
I'm sure it's still on my shelves in my office. It's right next to my Carver
Mead/Lynn Conway book on designing what they called "VLSI" IC's from the
late 70's early 80's time frame (where we literally laid out designs in
graduate school using stick diagrams and colorful pencils, green for
diffusion, red for poly, and blue for metal (it was two layers of metal so
we needed dark blue for metal 2).

The problem with that page, while fun, is that it turns into the complexity
of a finfet within moments, once you push into it any reasonably sized c
code (even if only a handful of lines) as it will pop out the compiled
assembly language which will have all sorts of complexities almost
instantaneously.

It's as if I asked you to design a chip to turn a light bulb on at 3am every
morning. The task is simple but the chip design can be done ten thousand
different ways to accomplish the exact same simple task, none of which will
make much sense given how capricious the resulting design can be.

Still, it does look like fun, where I looked for a "c++ lab" to simply add
the value stored in accumulator A to that which is stored in accumulator B
and to output the result.
Post by Tavis Ormandy
You write some C on the left, and it shows you nicely formatted
assembly on the right. You can try changing something, and watch what
happens to the generated code.
As I said, I looked for the "lab" to just add what's in two registers,
where, to "create my own lab" for that web page (which I never wanted to
do!), I downloaded the SAMS "teach yourself C++ in 21 days" fifth edition at
http://openstorage.gunadarma.ac.id/pub/journal/Teach%20Yourself%20C++%20in%2021%20Days%205th%20Edition.pdf

I found this on page 73 of that PDF:
int myAge = 5;
int temp;
temp = myAge + 2 // add 5 + 2 and put it in temp
myAge = temp // put it back in myAge
Which they then shortened on page 74 to:
myAge = myAge + 2; // myAge +=2

So I popped that last line into the fun c-code-to-assembly language page
with the result of "<Compilation failed>", which is my whole point about
designing my own capacitor.

I added back the boilerplate syntax (reminiscent of COBOL back in the day,
where every program STARTED with a hundred lines of boilerplate!),
#include <stdio.h>
int main()
{}

That boilerplate resulted in this assembly language code:
main:
xor eax, eax
ret
Which, seems odd to me that a boolean operation that always returns FALSE
would be the result, but hey, I didn't write the code explorer - I'm just
testing it (someone is going to have to explain that one to me!). :)

Of course, adding just this line in between braces results in a failed
compilation:
#include <stdio.h>
int main()
{myAge=myAge+2}

So now I have to play the silly COBOL syntax game of defining everything
that I never wanted to define in the first place, which, of course, had I
read the first 75 pages of the PDF I'm sure will tell me how, but the point
is that a freshman physics capacitance lab doesn't spend 75 pages to first
teach you how to design your own dialectic materials - you simply test out
WORKING dielectrics and learn empirically (if I had wanted to be Joseph
Faraday, that would be a different story).

Just wanting to test the capacitors (i.e., add two numbers), I skim about
adding semicolons and braces to satisfy the syntax requirements to get rid
of the "compilation failed" errors, and after skimming for syntax examples
in the PDF, I piece together a Frankenstein set of C++ code that simply adds
two to a variable:
#include <stdio.h>
int main()
{int myAge;
myAge = myAge + 2;
}

Which returns, surprise!
main:
xor eax, eax
ret

There is no "compilation error", but it says "Compiler returned: 0",
which, I guess, maybe, perhaps, I dunno, is that an error or did it work?

Anyway, if I already knew C++, this might be fun. But I not know C++ and far
worse, I'm allergic to higher level programming languages all doing exactly
the same thing in a billion different ways (just so they can claim to be
different).

In this test of the "fun code", I just wanted to add two numbers in assembly
language by cutting and pasting them from a tutorial that is written like a
freshman physics labs on capacitance.

But I'm writing my own tutorial.
And that's NOT what I had wanted to do.
It's not fun at all.

What's fun is grabbing a bag of colorful tantalum, electrolytic, film, mica,
polymer, vacuum, polarized, pancake, and variable capacitors and testing
their capacitance with the capacitance meter hooked up both ways to the
leads, and writing down the results, like any good lab (aka tutorial) should
do.

In short I just want an assembly language tutorial that anyone would want
(I'm not special). It should assume I'm on the most common home computing
platform on they planet (no surprises there!) and it should tell me where to
download the installer and then it should have me cut and paste the first,
second, third, fourth, and fifth assembly language program which should just
work.

Once I have a half dozen assembly language programs that just work, then I
have already learned what I want to learn. If it's still fun, then I do the
next dozen. And if it's really fun, I even go off road and try to experiment
with them, but if they don't work, I can back up to the last working example
(e.g., if I hook up a capacitance tester the wrong way, I can just reverse
the leads, if it matters).

It's what everyone would want who is a noob who just wants a working set of
examples (aka a tutorial) on the most common computer platform there ever
was.
Tavis Ormandy
2021-01-20 15:38:24 UTC
Permalink
Post by paul
Which, seems odd to me that a boolean operation that always returns FALSE
would be the result, but hey, I didn't write the code explorer - I'm just
testing it (someone is going to have to explain that one to me!). :)
To make different pieces of code work together, all the code has to
follow certain rules - called calling conventions. You don't *have* to
follow those rules, but it means your code will work well with others.

One of those conventions is to put the return code (the result) in the
eax register. So in this case, that's just letting other code know
everything was okay.
Post by paul
Which returns, surprise!
xor eax, eax
ret
There is no "compilation error", but it says "Compiler returned: 0",
which, I guess, maybe, perhaps, I dunno, is that an error or did it work?
It worked, but compilers are smart - it knew that you didn't use the
result of the computation, and so it didn't matter if it did it or not.
That means it can generate a program that does exactly the same thing
but *faster* by not doing it at all.

There are a ton of these you'll notice, some are really confusing when
you first run into them. I think I was fascinated by that, understanding
things like strength reduction (that's where the compiler replaces
expensive operations like multiplication with equivalent cheaper ones
like shifts and adds) - but if you think you'll be frustrated by it,
maybe this won't work.
Post by paul
It's what everyone would want who is a noob who just wants a working set of
examples (aka a tutorial) on the most common computer platform there ever
was.
I don't know if there is a good answer. If you want to skip the
introductory classes, you can't complain that you have to work harder to
catch up :)

Tavis.
--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger ***@sdf.org
_\_V _( ) _( ) @taviso
Rod Pemberton
2021-01-21 07:16:27 UTC
Permalink
On Wed, 20 Jan 2021 13:47:47 +0100
Post by paul
When I asked the question originally, I had no idea it would be this hard.
I figured it would be like any freshman level physics lab.
1. You check out the equipment (e.g., a capacitance tester)
2. You grab a ziplock bag of pre-prepared capacitors of various types
3. You measure their capacitance, and write up a report
Notice that the lab is designed to work.
The student simply follows the steps.
The learning is in watching it work.
This is a return to the 8-bit microprocessors of the 1980's. You're
jumping in after decades of microprocessor development.

It's a bit more like learning calculus. There are centuries of
knowledge which came before you got to class. You get to start at the
very beginning. Lucky you.
Post by paul
The reason I dropped the comp sci curriculum was syntax, where every
language does the same damn thing using completely different syntax.
Just use C. TIOBE's index shows that it has been at the top of the
programming language usage charts for decades. (I have to apologize to
wolfgang every time I say that.) Although, C is a huge time suck to
learn as well, but it'll be around - or it's many derivatives which
dominate the TIOBE index - for a while at least.

https://www.tiobe.com/tiobe-index/
Post by paul
For example, Fortran's trenchant yet precise syntax resulted in a
terse "Error 50", which you had to look up in a book in the computer
room locked down to a table with half the pages missing.
FORTRAN was a horrible language.
Post by paul
On the
opposite side of the spectrum, COBOL was downright loquacious, with
bombastic divisions and gabby data types.
I never programmed in COBOL but have seen it IRL. Very verbose.
Post by paul
Somewhere in between was
PL/1 but my point is they all do the same damn thing, but with
completely different syntax.
I programmed in the Stratus VOS variant of PL/1, but it was more like
souped up Pascal with the power of C and some weird structs. I saw
IBM's mainframe PL/I code once, and it seemed very different and block
structured from what I saw.
Post by paul
I swore I'd never learn another programming language in the early
seventies, and I stuck to my word,
1970's? Which language did you decide was your last to learn? E.g.,

BASIC
Pascal
Fortran
Cobol
Lisp
C
Logo
Snobol
PL/I
Post by paul
and even now, I don't want to learn assembly language just like I
don't want to learn how to design a microprocessor.
I don't think anyone has /wanted/ to design a microprocessor since Byte
magazine of the 1980's.

Did you once learn any 8-bit assembly, e.g., 6502 or Z80?

If so, the early 8086 instructions are similar in terms of
functionality. That's a starting point for you. Get an early 8086
manual.

http://bitsavers.trailing-edge.com/
http://bitsavers.trailing-edge.com/components/intel/8086/

It's the layering of x86 instructions over the decades of the numerous
additional more advanced instruction sets, operating system
instructions, numerous operating modes, and mode specific instructions,
that will cause plenty of mental grief.

If you want to check out the complexity of x86, try getting lost on
this website:

https://www.sandpile.org/
Post by paul
I don't want to write my own assembly language programs.
I just want to watch it happen which is why I seek a tutorial.
There are some in browser emulators around. I don't recall if any
works for x86 code.
Post by paul
In my not too distant past, I had, like everyone did, all the SAMS books,
Not too distant past? Dude, SAMS was late 1980's and early 1990's,
roughly 3 decades ago. Did you just come out of a coma? ;-)

--
paul
2021-01-23 07:24:16 UTC
Permalink
Post by Rod Pemberton
This is a return to the 8-bit microprocessors of the 1980's.
Yes. (IMHO)

All I'm asking for is a working noob tutorial, with an assembler, on the
most common desktop platform on the planet.
Post by Rod Pemberton
You're jumping in after decades of microprocessor development.
No. (IMHO).

The reason for the yes and for the no is...
Nothing has actually changed even when everything seems to have changed.
Post by Rod Pemberton
It's a bit more like learning calculus.
Yes. No. (same reasons as in the above argument about the basics.
a. It's a bit more like learning quantum physics
(e.g., if you think you understand it, you don't)
b. It's a bit more like learning evolutionary biology
(e.g., what works isn't what's best - but what works first)
c. It's a bit more like learning modern electronics
(e.g., it's still just an on/off switch no matter how small)

Nothing has really changed even when everything seems to have changed.
Post by Rod Pemberton
There are centuries of
knowledge which came before you got to class. You get to start at the
very beginning. Lucky you.
That's how _everything_ is given there has never been a freshman (biology,
chemistry, physics, calculus, etc.) class that didn't start with the basic
tenets).

Each comes with a lab (well, not calculus normally) that just works.
All I'm asking for is a tutorial that works on modern home desktops.

As an aside, why calculus doesn't come with a lab is, IMHO, because math
teachers are rather strange people who don't ever seem to comprehend that,
to make sense to most people (i.e., non mathematicians, which is most
people), the equation has to have some physical meaning.

To a freshman or sophomore calculus teacher, simply tweaking what amounts to
an almost meaningless page of similar equations, and then having the student
solve those essentially meaningless equations, is, to them, "learning".

Compare that (IMHO) idiotic approach to the other sciences, such as freshman
or sophomore physics, where no equation is taught without its commensurate
lab (whether it be Snell's law, Bernoulli's equations, Young's double slit
experiment, etc., where, without a lab, there is no real understanding
involved.

All I'm asking for... is the lab.
Labs always work.
In a well-designed lab, the learning is in watching it work.
Post by Rod Pemberton
1970's? Which language did you decide was your last to learn? E.g.,
(a) BASIC <== I wrote plenty in the early days of "home computers"
(b) Pascal <== never touched the stuff
(c) Fortran <== of course - every engineer learned Fortran
(d) Cobol <== why I took COBOL then still astounds me today
(e) Lisp <== no but many interpreted software interfaces are similar
(f) C <== no but we used to have to run Makefiles more often then than now
(g) Logo <== never even heard of it
(h) Snobol <== no, thank God
(i) PL/I <== yes, of course - but we called it PL/1 (Pea El One)
(j) Assembly Language <== everyone learned the IBM Assembly language
(k) Shell scripting <== didn't we all learn c-shell & tsh
Post by Rod Pemberton
Post by paul
and even now, I don't want to learn assembly language just like I
don't want to learn how to design a microprocessor.
I don't think anyone has /wanted/ to design a microprocessor since Byte
magazine of the 1980's.
I used to love Forest Mims' simplicity of TTL code where everybody had the
yellow Texas Instruments books next to the blue National Semiconductor books
for digital and analog chips of the early days of ICs.

If you were really into linear ICs, you dug into the off-yellow Burr Brown
datasheets, but most of us were content with the TI TTL series well before
CMOS became the norm.

We all made the same circuits, e.g., who didn't build their first LED design
with a 555 timer in those days? And who didn't burn out a few Germanium
"tophat" transistors using a 9-volt battery breadboarding their first one
and two transistor amplifier?

In those days, we followed the tutorial.
Nothing has changed over time even as everything seems to have changed.
Post by Rod Pemberton
Did you once learn any 8-bit assembly, e.g., 6502 or Z80?
With the Forest Mims pamphlets from Radio Shack or the SAMS guides, of
course, like everyone, I played with the Commodore 64, Z80, Motorola 6800
series CPUs.

Mostly I learned using the Motorola 68701, simply because I had the SAMS
Guides. I wire wrapped and breadboarded the designs like everyone else did.

Which is my point of having a tutorial that works.
Post by Rod Pemberton
If so, the early 8086 instructions are similar in terms of
functionality. That's a starting point for you. Get an early 8086
manual.
I have Peter Norton's book in my hands:
Peter Norton's Assembly Language Book for the IBM PC (Norton & Socha)
(c) 1989 by Brady Books

But it doesn't come with an assembler.
Post by Rod Pemberton
http://bitsavers.trailing-edge.com/
http://bitsavers.trailing-edge.com/components/intel/8086/
Nice stuff!
But no tutorials with assemblers were there.

121748-001_8086_Relocatable_Object_Module_Formats_1981.pdf
210200-002_iAPX88_Book_1983.pdf
210200_iAPX88_Book_1981.pdf
210912-001_iAPX_86_88_186_188_Users_Manual_1985.pdf
210954-002_iAPX_86,_88,_186_Microprocessors_Part_II_Jul_84_NJ7P-S.pdf
210976-002_iAPX_86,_88,_186_Microprocessors_Part_I_Ver_2.0_Jun_84_NJ7P-S.pdf
9800697B_SDK-86_Assembly_Manual_Nov78.pdf
9800698A_SDK-86_Users_Man_Apr79.pdf
9800699-03C_SDK-86_Monitor_Listings_Sep80.pdf
9800722-03_The_8086_Family_Users_Manual_Oct79.pdf
9800749-1_MCS-86_Assembly_Language_Reference_Guide_Oct78.pdf
Post by Rod Pemberton
It's the layering of x86 instructions over the decades of the numerous
additional more advanced instruction sets, operating system
instructions, numerous operating modes, and mode specific instructions,
that will cause plenty of mental grief.
Nothing has changed even as everything seems to have changed.
All I need is what any noob would need, which is a simple lab.
That lab would start with an assembler & small programs that work.
Those small programs would start with "hello world" perhaps.
Or maybe adding two numbers.
Or maybe even division. And jumps. And pushing & popping on & off stacks.
Whatever.

But they'd all work.
The learning in a lab is from watching it work.

That's why labs exist and that's why tutorials exist (same thing).
Post by Rod Pemberton
If you want to check out the complexity of x86, try getting lost on
https://www.sandpile.org/
Complexity is for math teachers.
IMHO, math teachers are the only science teachers who don't know how to
teach.

No physics teacher would think of teaching physics without a lab.
No physics teacher would throw a bunch of meaningless equations on a test.
No physics teacher would present an equation without a real-life example.
etc.

Math teachers pull that crap all the time because, IMHO, math teachers don't
know how to teach (in general). Math is a lab science, just as much as
assembly language programming is a lab science.

Without the lab (aka tutorial), learning assembly language programming for a
noob, is, imho, worthless.

The learning is by watching it work.
Not by designing complex code from the start.
Post by Rod Pemberton
Post by paul
I don't want to write my own assembly language programs.
I just want to watch it happen which is why I seek a tutorial.
There are some in browser emulators around. I don't recall if any
works for x86 code.
I just want a tutorial for noobs that comes with an assembler that works.
Post by Rod Pemberton
Post by paul
In my not too distant past, I had, like everyone did, all the SAMS books,
Not too distant past? Dude, SAMS was late 1980's and early 1990's,
roughly 3 decades ago. Did you just come out of a coma? ;-)
Nothing has changed even as it may seem everything has changed.

Why do you think they teach Newtonian Physics, almost universally?
Why do you think they don't START kids on Quantum Mechanics instead?

Think about that.
Almost everything in Newtonian Physics is dead wrong, right?

Almost everything in Newtonian Physics is contradicted in Quantum Physics.
And yet, they teach the noobs Newtonian Physics first, right?

Why?
Because of two things that I seek in this quest for a working tutorial:

(1) Nothing has changed even if it seems everything has changed, and,
(2) Noobs learn best by observing things working first.

All I want is a working noob tutorial with a working freeware assembler
(on the most common home desktop computing platform on the planet).
--
DISCLAIMER: This has been my most humblest of opinions throughout.
Steve
2021-01-23 12:32:20 UTC
Permalink
Post by paul
All I'm asking for is a working noob tutorial, with an assembler, on the
most common desktop platform on the planet.
Hi paul,

Have you looked at the MASM32 forum?

http://www.masm32.com/board/index.php?

One of the subforums is

Mikl__'s ml64 examples

which has a 64-bit Windows tutorial/


And the The MASM32 SDK is available at

http://masm32.com/

which has a old version of MASM to install and
has 32-bit Windows examples. A full install gives
you quite a lot of MASM code examples.

Regards,

Steve N.
Kerr-Mudd,John
2021-01-23 13:07:10 UTC
Permalink
On Sat, 23 Jan 2021 07:24:16 GMT, paul
Post by paul
Post by Rod Pemberton
This is a return to the 8-bit microprocessors of the 1980's.
Yes. (IMHO)
All I'm asking for is a working noob tutorial, with an assembler, on
the most common desktop platform on the planet.
[]
Post by paul
All I want is a working noob tutorial with a working freeware
assembler (on the most common home desktop computing platform on the
planet).
I don't think you can have it; all existing asm tutorials are historic
and will, generally, use DOS on an IBM PC in real mode. No 64 bit
(probably not 32bit), no Windows (especially 7/10).

If you truly want to do this (rather than repeatedly ask for the
unavailable) then you'll have to install a DOS emulator, install the
tutorial of choice, learn x86 asm, move up to 32 bit then do some windows
calls, look at 64 bit, and *then* you can put together asm code for
Windows 10.

I think this has been said before, so I'll stop now.
--
Bah, and indeed, Humbug.
Rod Pemberton
2021-01-24 07:07:13 UTC
Permalink
On Sat, 23 Jan 2021 08:24:16 +0100
Post by paul
Post by Rod Pemberton
This is a return to the 8-bit microprocessors of the 1980's.
Yes. (IMHO)
All I'm asking for is a working noob tutorial, with an assembler, on
the most common desktop platform on the planet.
Unfortunately, it almost appears that assembly, not just for x86,
almost isn't being taught anymore.

After a bunch of different Google searches, I'm not sure if there is
anything that will meet all your requirements in a single complete lab
tutorial. There is plenty of stuff online though.

Youtube (videos)
https://www.youtube.com/results?search_query=x86+assembly

Google (pdf)
https://www.google.com/search?&q=x86+assembly+pdf
https://www.google.com/search?&q=university+x86+assembly+pdf

NASM tutorial (text)
https://www.tutorialspoint.com/assembly_programming/index.htm

x86 tutorials, calling the host OS (text/image)
https://cs.lmu.edu/~ray/notes/x86assembly/

Hackr.io's assembly tutorials (free & paid)
https://hackr.io/tutorials/learn-assembly-language

Udemy's Assembly language courses (paid)
https://www.udemy.com/topic/assembly-language/

MIT OpenCourseWare "Intro to Assembly Language" (video)
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2017/c10/c10s2/intro-to-assembly-language-8-13-/

x86-64 Assembly Language Programming with Ubuntu (pdf)
http://www.egr.unlv.edu/~ed/x86.html

There are lots of other course websites, some 50+ besides Udemy, like
Coursera & edX, including another dozen or so that specialize in
programming courses. That doesn't include free Computer Science courses
online at major universities. For the most part, I don't see any
assembly courses. These sites seem to focus on high-level programming
languages used by Silicon Valley software tech companies, and
certifications.

--
George Neuner
2021-01-24 15:40:31 UTC
Permalink
On Sat, 23 Jan 2021 08:24:16 +0100, paul
Post by paul
Post by Rod Pemberton
This is a return to the 8-bit microprocessors of the 1980's.
Yes. (IMHO)
All I'm asking for is a working noob tutorial, with an assembler, on the
most common desktop platform on the planet.
Post by Rod Pemberton
You're jumping in after decades of microprocessor development.
No. (IMHO).
The reason for the yes and for the no is...
Nothing has actually changed even when everything seems to have changed.
The problem is that a noob can't sensibly write anything in assembler
for a modern 64-bit chip. Whether or not you care to admit it, LOTS
of things have changed since the old days. You say you learned IBM
assembler (700? 360?) ... if you remember any of it that is a good
start, but a modern x86 has a vastly larger instruction set.
https://stefanheule.com/blog/how-many-x86-64-instructions-are-there-anyway/

You really do need to start with something simpler and work up. There
are plenty of good guides for 8086 assembler. Set up a virtual
machine running DOS or an old version of Windows[*] and learn on that.
Once you get reasonably good at 8086, then tackle 80386.


[*] XP or earlier (at least 32-bit versions) will run 16-bit code, and
much of what you learn about using the Windows API will carry forward.
Argument widths have changed and new functions have been introduced,
but nearly all of the functions that were available in Windows 3 circa
1990 are still in Windows 10 today.
Post by paul
Nothing has really changed even when everything seems to have changed.
Wrong. The biggest change is that modern operating systems require
programs be run in protected mode. Moreover, as x86 moved from 16 to
32 to 64 bit, certain architecture changes have forced newer programs
to be structured differently.
Post by paul
All I'm asking for... is the lab.
Labs always work.
In a well-designed lab, the learning is in watching it work.
What school did you go to? Labs always have been about screwing up
and discovering why you DIDN'T get the right result. If you were
lucky you got to repeat the labs until you finally did them correctly.
Post by paul
Post by Rod Pemberton
1970's? Which language did you decide was your last to learn? E.g.,
(a) BASIC <== I wrote plenty in the early days of "home computers"
(b) Pascal <== never touched the stuff
(c) Fortran <== of course - every engineer learned Fortran
(d) Cobol <== why I took COBOL then still astounds me today
(e) Lisp <== no but many interpreted software interfaces are similar
(f) C <== no but we used to have to run Makefiles more often then than now
(g) Logo <== never even heard of it
(h) Snobol <== no, thank God
(i) PL/I <== yes, of course - but we called it PL/1 (Pea El One)
(j) Assembly Language <== everyone learned the IBM Assembly language
(k) Shell scripting <== didn't we all learn c-shell & tsh
So, except for the one assembler, you only learned relatively high
level languages. Some C would have been helpful.
Post by paul
I used to love Forest Mims' simplicity of TTL code where everybody had the
yellow Texas Instruments books next to the blue National Semiconductor books
for digital and analog chips of the early days of ICs.
Then your head will explode when you look at x86-64 and the prospect
of interfacing with any modern operating system.


George
Anton Ertl
2021-01-24 16:39:12 UTC
Permalink
Post by George Neuner
The problem is that a noob can't sensibly write anything in assembler
for a modern 64-bit chip.
I teach about 70 noobs every year to write something in assembler for
a modern 64-bit chip, so I obviously disagree.
Post by George Neuner
Whether or not you care to admit it, LOTS
of things have changed since the old days. You say you learned IBM
assembler (700? 360?) ... if you remember any of it that is a good
start, but a modern x86 has a vastly larger instruction set.
So what? You don't need to know every instruction to sensibly write
something in assembler. And I expect that nearly all of these
instructions also work in 16-bit mode; conversely, if you want to
pretend that the 64-bit CPU you use is only an 8086, you can just as
well pretend that this CPU has no 80387, no MMX, no SSE, no AVX and
later extensions, and you end up with a similar number of instructions
as the 8086, and probably fewer that you really want to use (on the
8086 you wanted to use instructions like XLAT and LODS, you normally
don't on a modern CPU).
Post by George Neuner
You really do need to start with something simpler and work up. There
are plenty of good guides for 8086 assembler. Set up a virtual
machine running DOS or an old version of Windows[*] and learn on that.
Once you get reasonably good at 8086, then tackle 80386.
I don't think that's a good approach. If you can write a program for
a task for the 8086, it's easier and better to write it for IA-32 or
AMD64 (the 32-bit and 64-bit descendant architectures; the 8086 is
quite different from them, while they are relatively similar to each
other), and you don't need more different instructions for it, rather
on the contrary, see above.

There may be fewer good guides; but using a search engine ("assembler
guide"), I find on the first page two IA-32 guides, one AMD64 guide,
some for other architectures, none for 8086. When looking for AMD64
guides, note that this architecture is also known as x86-64, x86_64,
x64, and Intel 64.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
***@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
paul
2021-01-25 05:06:12 UTC
Permalink
Post by Anton Ertl
I teach about 70 noobs every year to write something in assembler for
a modern 64-bit chip, so I obviously disagree.
At some point, rather soon, I'm going to have to give up on asking and just
start following _somebody's_ tutorial on my X64 Windows 10 desktop.

Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/

And, what do you think of these Windows x64 assembly language guides?
https://sonictk.github.io/asm_tutorial/#additionalresources
Post by Anton Ertl
There may be fewer good guides; but using a search engine ("assembler
guide"), I find on the first page two IA-32 guides, one AMD64 guide,
some for other architectures, none for 8086.
If nobody proposes anything better, I'm gonna just start with that stuff.
Even so, the guy (sonictk) says his web page is not a tutorial for noobs.

Yet the guy (sonictk) claims the starting environment only needs to have:
(1) A Windows 10 PC (x64)
(2) He claims we need Emacs https://github.com/sonictk/lightweight-emacs
But, due to muscle memory, I'd vastly prefer editing in GVim (aka "vi")
https://www.vim.org//download.php/#pc
(3) He used "Visual Studio 2017" for his C/C++ development environment
where I've learned over the years it's almost always best to use the
EXACT sub version of tools the tutorial author used himself.
(4) He used the "Netwide Assembler" compiler version 2.13.03
https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/

I think it's crazy to need "Visual Studio" just to assemble on a Windows x64
PC, but if nothing better comes up, that's what I'll start with, as it seems
I am forced to write my own noob tutorial from scratch (simply because,
shockingly so, a decent x64 tutorial for noobs hasn't yet been proposed (or,
if it has, I must have missed it).

Anyway, I'll write my own tutorial - but it's crazy that I have to do that.
All I'm asking in this post is if the sonictk site seems reasonable to you.
Anton Ertl
2021-01-25 08:28:06 UTC
Permalink
Post by paul
Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/
It discusses more stuff than I do (in particular, I focus on
architecture when teaching assembly and discuss microarchitectural
stuff like caches and TLBs only in my "efficient programs" course),
but otherwise seems ok. Whether it works as a tutorial, is probably
up to you to determine; I have no checklist for assembly tutorials.
Post by paul
And, what do you think of these Windows x64 assembly language guides?
https://sonictk.github.io/asm_tutorial/#additionalresources
Maybe it would be a good idea to start with the introduction by Chris
Lomont and only then continue with the guide by sonictk.
Post by paul
(1) A Windows 10 PC (x64)
(2) He claims we need Emacs https://github.com/sonictk/lightweight-emacs
But, due to muscle memory, I'd vastly prefer editing in GVim (aka "vi")
https://www.vim.org//download.php/#pc
I see only one mention of Emacs on the page, but only as an example of
"a C/C++ development environment". So I think you can just as well
use vi.
Post by paul
I think it's crazy to need "Visual Studio" just to assemble on a Windows x64
PC
Looks crazy to me, too, but then, I don't program on Windows; I guess
Visual studio is used for what I would do with xterm (have a window
for command-line interaction), bash (the command-line interpreter),
and make (a build tool).

- anton
--
M. Anton Ertl Some things have to be seen to be believed
***@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
paul
2021-01-26 07:23:26 UTC
Permalink
Post by Anton Ertl
Post by paul
Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/
Whether it works as a tutorial, is probably
up to you to determine; I have no checklist for assembly tutorials.
Success (of sorts), at last (I think) for the 10-step hello world tutorial.

Following the previous instructions from "Tavis Ormandy" to check the
"Individual components" Visual Studio Community 2019 checkbox for
"MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28)", I finally have
the necessary Microsoft "link.exe" linker installed (I think).

Here's where I am while trying to faithfully follow the tutorial at
https://sonictk.github.io/asm_tutorial/

(1) Onto my Win10 x64 20H2 computer, I install the latest Nasm from
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe

(2) I then install the latest Microsoft link.exe from
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

(3) After installing Nasm, I check the version of nasm on Windows 10 x64
nasm -v
NASM version 2.15.05 compiled on Aug 28 2020

(4) Then I download the "hello_world.asm" text file to my Win10 x64 system
https://github.com/sonictk/asm_tutorial/blob/master/hello_world.asm

(5) I then assemble that asm file into a hello_world.obj object module
nasm -f win64 -o hello_world.obj hello_world.asm

(6) Then I try the Microsoft Visual Studio Community 2019 linker
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\link.exe" hello_world.obj /subsystem:console /entry:main /out:hello_world_basic.exe

(7) Drat. Errors result even when I follow the tutorial exactly.
Microsoft (R) Incremental Linker Version 14.28.29336.0
Copyright (C) Microsoft Corporation. All rights reserved.

hello_world.obj : error LNK2001: unresolved external symbol ExitProcess
hello_world_basic.exe : fatal error LNK1120: 1 unresolved externals

(8) Given "ExitProcess" is the last line, I commented it out & tried again,
resulting in no errors and the creation of "hello_world_basic.exe"

(9) Yet, when I ran "hello_world_basic.exe" on the Win10 x64 command line
(or in the Win10 x64 File Explorer GUI), it didn't display the expected
output (it actually displayed nothing - but no errors came out either).

(10) I tried "***@4" as per this stackoverflow question
https://stackoverflow.com/questions/4123013/error-lnk2001-unresolved-external-symbol-messagebox
But what I simply need now is an assembly language program that works
as the point, at the point of a "hello world" is NOT to be debugging
bad assembly language coding (debugging programs should come way later).
https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=msvc-160
https://social.msdn.microsoft.com/Forums/vstudio/en-US/71a80e19-4e6a-41fe-b1db-26e331da474d/linking-errors-lnk2001-unresolved-external-symbol-when-compiled-by-nasm
http://www.masmforum.com/board/index.php?topic=15872;prev_next=next

So the hello world is, finally, a bit closer to working with the latest Nasm
& the latest Visual Studio Community 2019, but the syntax in the hello world
example is, somehow, still a bit wrong for running at the Windows 10 x64 CLI.
James Van Buskirk
2021-01-26 12:49:50 UTC
Permalink
Post by paul
Success (of sorts), at last (I think) for the 10-step hello world tutorial.
Following the previous instructions from "Tavis Ormandy" to check the
"Individual components" Visual Studio Community 2019 checkbox for
"MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28)", I finally have
the necessary Microsoft "link.exe" linker installed (I think).
Here's where I am while trying to faithfully follow the tutorial at
https://sonictk.github.io/asm_tutorial/
(1) Onto my Win10 x64 20H2 computer, I install the latest Nasm from
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe
(2) I then install the latest Microsoft link.exe from
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16
(3) After installing Nasm, I check the version of nasm on Windows 10 x64
nasm -v
NASM version 2.15.05 compiled on Aug 28 2020
(4) Then I download the "hello_world.asm" text file to my Win10 x64 system
https://github.com/sonictk/asm_tutorial/blob/master/hello_world.asm
(5) I then assemble that asm file into a hello_world.obj object module
nasm -f win64 -o hello_world.obj hello_world.asm
(6) Then I try the Microsoft Visual Studio Community 2019 linker
"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\link.exe"
hello_world.obj /subsystem:console /entry:main /out:hello_world_basic.exe
(7) Drat. Errors result even when I follow the tutorial exactly.
Microsoft (R) Incremental Linker Version 14.28.29336.0
Copyright (C) Microsoft Corporation. All rights reserved.
hello_world.obj : error LNK2001: unresolved external symbol ExitProcess
hello_world_basic.exe : fatal error LNK1120: 1 unresolved externals
ExitProcess is documented here (usually I try searching for something like
ExitProcess MSDN on google)
https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess
The critical component it says you are missing is Kernel32.lib. You
should be able to fix that by adding the switch
/defaultlib:Kernel32
I found this by searching for link.exe in google and then got to
https://docs.microsoft.com/en-us/cpp/build/reference/defaultlib-specify-default-library?view=msvc-160
Post by paul
(8) Given "ExitProcess" is the last line, I commented it out & tried again,
resulting in no errors and the creation of "hello_world_basic.exe"
(9) Yet, when I ran "hello_world_basic.exe" on the Win10 x64 command line
(or in the Win10 x64 File Explorer GUI), it didn't display the expected
output (it actually displayed nothing - but no errors came out either).
Yeah, that's because your program doesn't do anything obvious. You could use
the Win32 API function wsprintfA to do some output. That needs User32.lib.
alternatively you could use printf from the C library, that wold require
something
like ucrt.lib. Hopefully you know or can figure out how to do basic I/O in
C.
Post by paul
https://stackoverflow.com/questions/4123013/error-lnk2001-unresolved-external-symbol-messagebox
But what I simply need now is an assembly language program that works
as the point, at the point of a "hello world" is NOT to be debugging
bad assembly language coding (debugging programs should come way later).
https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=msvc-160
https://social.msdn.microsoft.com/Forums/vstudio/en-US/71a80e19-4e6a-41fe-b1db-26e331da474d/linking-errors-lnk2001-unresolved-external-symbol-when-compiled-by-nasm
http://www.masmforum.com/board/index.php?topic=15872;prev_next=next
That won't fly because it says to use name-mangling that the STDCALL
convention uses in 32-bit Windows. In 64-bit Windows there is no name
mangling. Well there is for C++ functions, but we aren't going to go there
if we can help it. You will find
https://agner.org/optimize/calling_conventions.pdf
quite useful in this context.
Post by paul
So the hello world is, finally, a bit closer to working with the latest Nasm
& the latest Visual Studio Community 2019, but the syntax in the hello world
example is, somehow, still a bit wrong for running at the Windows 10 x64 CLI.
From your bio you have most of the hard stuff under control; you just
need to get over a little stumbling block!
wolfgang kern
2021-01-25 13:32:36 UTC
Permalink
Post by paul
Post by Anton Ertl
I teach about 70 noobs every year to write something in assembler for
a modern 64-bit chip, so I obviously disagree.
At some point, rather soon, I'm going to have to give up on asking and just
start following _somebody's_ tutorial on my X64 Windows 10 desktop.
Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/
now there you got your win64 hello world tutorial :)

bits 64
default rel

segment .data
msg db "Hello world!", 0xd, 0xa, 0

segment .text
global main
extern ExitProcess

extern printf

main:
push rbp
mov rbp, rsp
sub rsp, 32

lea rcx, [msg]
call printf

xor rax, rax
call ExitProcess
...
Post by paul
Anyway, I'll write my own tutorial - but it's crazy that I have to do that.
All I'm asking in this post is if the sonictk site seems reasonable to you.
good luck.
__
wolfgang
paul
2021-01-25 17:59:40 UTC
Permalink
Post by wolfgang kern
Post by paul
Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/
now there you got your win64 hello world tutorial :)
We already had a hello world working in this thread on January 18th.
Message-ID: <ru342u$p8t$***@gioia.aioe.org>
But, as others may recall, it didn't use Microsoft MASM but MASM32 from
http://www.masm32.com/
Which came with its own linker
C:\mypath\masm32\bin\ml.exe /c /Zd /coff hello.asm
C:\mypath\masm32\bin\Link /SUBSYSTEM:CONSOLE hello.obj
Which worked fine following the steps in this hello world tutorial
https://doc.lagout.org/operating%20system%20/Windows/winasmtut.pdf

But that used "MASM32" and not Microsoft MASM (nor NASM).

Nobody responded when I had asked if that's a decent assembler & linker.
For example, can we use _that_ linker instead of the MS Visual C link.exe?

The linker is the important step as it has to work with the assembler.
*Can someone clarify where we can get a decent linker for object modules?*
Post by wolfgang kern
Post by paul
Anyway, I'll write my own tutorial - but it's crazy that I have to do that.
All I'm asking in this post is if the sonictk site seems reasonable to you.
good luck.
*I need to _simplify_ the step of obtaining a linker for the basic noob.*

I spent _hours_ downloading & creating offline installers for Visual Studio.
Just to get a linker (MS link.exe).

Given MS Visual Studio is astoundingly huge bloatware just for that linker
https://visualstudio.microsoft.com/downloads/

A very important question to resolve for a noob is _where_ to get a linker!
For example, for the assembly code that works with Nasm, can we just
substitute the MASM32 linker above instead of the MS Visual Studio linker?

I don't know what the requirements are for the linker, but I do know that
the way I obtained the linker via Visual Studio is horribly complex for a
basic noob tutorial that I'm just starting to write.

Given I need to _simplify_ the step of obtaining a linker for use with Nasm,
*can someone explain where we can get a decent linker for object modules?*
(Without having to first download & then install immense MS VS bloatware?)
wolfgang kern
2021-01-26 08:29:18 UTC
Permalink
Post by paul
Post by wolfgang kern
Post by paul
Given that, what do you think of this "Understanding Windows x64 Assembly?
https://sonictk.github.io/asm_tutorial/
now there you got your win64 hello world tutorial :)
We already had a hello world working in this thread on January 18th.
But, as others may recall, it didn't use Microsoft MASM but MASM32 from
http://www.masm32.com/
Which came with its own linker
C:\mypath\masm32\bin\ml.exe /c /Zd /coff hello.asm
C:\mypath\masm32\bin\Link /SUBSYSTEM:CONSOLE hello.obj
Which worked fine following the steps in this hello world tutorial
https://doc.lagout.org/operating%20system%20/Windows/winasmtut.pdf
But that used "MASM32" and not Microsoft MASM (nor NASM).
Nobody responded when I had asked if that's a decent assembler & linker.
For example, can we use _that_ linker instead of the MS Visual C link.exe?
The linker is the important step as it has to work with the assembler.
*Can someone clarify where we can get a decent linker for object modules?*
Sorry I never needed nor used any LINKer. Someone else might answer it.
RosAsm compiled text source to PEexe incl.debugger w/o a link process.
FASMW compiled asm-source to either binary (.COM) or winPE w/o linker.

NASM wont link with MASM nor MASM32 tools, but Frank knows it for sure.
__
wolfgang
paul
2021-01-24 18:19:46 UTC
Permalink
Post by George Neuner
The problem is that a noob can't sensibly write anything in assembler
for a modern 64-bit chip.
The goal is & was a simple noob assembly language tutorial for a modern home
computer, where an example comparison is any decent Android Studio tutorial.
https://google-developer-training.github.io/android-developer-fundamentals-course-practicals/en/Unit%201/11_p_hello_world.html
https://www.journaldev.com/8988/android-studio-tutorial-hello-world-app
https://www.tutorialspoint.com/android/android_hello_world_example.htm
https://www.androidauthority.com/hello-world-android-studio-development-877538/
https://crunchify.com/build-hello-world-android-app-with-android-studio/
Post by George Neuner
Whether or not you care to admit it, LOTS
of things have changed since the old days.
The only thing that "may" have changed is that a set of noob tutorials for
X64 Windows perhaps doesn't exist.

Other than that, nothing has changed as a push, pop, mov, and, xor, nor,
ret, int, call, jnz, dec, jne, cmp, je, etc., are the same then as now.
Post by George Neuner
You say you learned IBM assembler (700? 360?) ...
As I recall, it was Fortran on the IBM 1130 and assembly language on the IBM
360/370, now that you jiggle my core memory. I remember a "Winchester" drive
was a big deal in those days.
Post by George Neuner
if you remember any of it that is a good
start, but a modern x86 has a vastly larger instruction set.
I remember burning the EPROM for the Motorola 68701 board, where I "wrote"
in hex, given it was easier than remembering the handful of "higher level"
assembly language commands. The only thing that bothered me when I started
with 8086 was the memory addresses being reversed. But that was decades ago
when my core memory held residual magnetism.

I just wanted to run an assembly language "lab", in an hour or two at home
on my home desktop computer, that's all. It seems that this isn't going to
happen unless I can find a suitable working tutorial.

As I said many times, a chemistry lab is designed to work. The student
checks out the beakers, thermometers, Bunsen burner, and chemicals, and then
the student follows the "hello world" and other beginner labs, and learns by
watching what happens.

That's what tutorials do.
(1) The tutorial is designed to work
(2) The student simply follows the instructions
(3) That's how the student learns

If learning that way wasn't one of the best ways to learn, then labs
wouldn't exist. Yet labs exist in all hard science classes except math
classes (because math teachers, imho, don't know how to teach).
Post by George Neuner
https://stefanheule.com/blog/how-many-x86-64-instructions-are-there-anyway/
You really do need to start with something simpler and work up.
That's what a "hello world" is. :)
Post by George Neuner
There are plenty of good guides for 8086 assembler. Set up a virtual
machine running DOS or an old version of Windows[*] and learn on that.
Once you get reasonably good at 8086, then tackle 80386.
I can set up a virtual machine in Windows 10, I guess. The point is that the
tutorial should tell me exactly what to do given I'm on the most common home
computing platform on the planet.

A well written tutorial would
(1) Tell me how to set up the VM (I'd use VirtualBox most likely)
in my host OS (Windows 10 x64)
(2) Tell me where and how to get the DOS guest OS and what switches
to set it up as so that it works inside a current VirtualBox VM.
(3) Tell me where and how to get a working assembler and then run
me through a half dozen or more basic noob assembly language labs.
Post by George Neuner
[*] XP or earlier (at least 32-bit versions) will run 16-bit code, and
much of what you learn about using the Windows API will carry forward.
Argument widths have changed and new functions have been introduced,
but nearly all of the functions that were available in Windows 3 circa
1990 are still in Windows 10 today.
Exactly.
Nothing has changed even as it seems to some that everything has changed.
Post by George Neuner
Post by paul
Nothing has really changed even when everything seems to have changed.
Wrong. The biggest change is that modern operating systems require
programs be run in protected mode. Moreover, as x86 moved from 16 to
32 to 64 bit, certain architecture changes have forced newer programs
to be structured differently.
A simple "hello world" should still work, as should adding of two numbers,
and comparing two registers, etc.

Do you work on cars? I do. Nothing has changed even as it seems to some that
everything has changed. Sure, we didn't have cats nor radial tires way back
then, and we no longer need to file our points or replace the condenser, nor
do we twist the distributor to set the timing, but the basics are still the
same, whether a carb or a fuel injector atomizes the fuel air mixture to a
stoichiometric ratio in the intake manifold.

The repair basics are the same whether or not the radiator is plastic or all
metal as it was in our early days. The exhaust system has a few more parts
but it's basically the same thing, as is the air conditioning system even as
the refrigerant has changed composition.

Likewise, the friction materials changed composition, but the brakes have
only gotten easier to work on over the years, as has alignment.

To some, everything has changed but in reality, nothing has changed.
(1) An alternator then is as an alternator is now.
(2) A spark plug then is as a spark plug is now
(3) A "fan belt" then, is as a fan belt is now (however serpentine).

Sure there are a few more components (e.g., oxygen sensors and secondary air
systems), but what worked then is as what works now.

Anyone who claims otherwise either knows a lot more than I do about cars, or
knows a lot less than I do (as I argue it's almost the same now as then).

Same with binary bits, hex code, and the "higher level" assembly language.
Post by George Neuner
What school did you go to? Labs always have been about screwing up
and discovering why you DIDN'T get the right result. If you were
lucky you got to repeat the labs until you finally did them correctly.
Huh? They hand you two aspirins or two caffeine tablets and you extract the
acetyl salicylic acid or caffeine and they grade you on your resultant mass.
You learn by doing.

They give you a chunk of wood and they grade you on the volume of methyl
alcohol you distil after heating under a Bunsen burner & cooling with water.

You roll polished steel marbles down chutes shaped as catenaries, parabolas,
angled ramps, & brachistrochrones, and you get graded on your accuracy in
writing down the stopwatch times.

Didn't you ever do ANY of that?

You never sliced cones of clay with handheld wire to form parabolas,
hyperbolas, and ellipses?

You never positioned variously shaped antennas (the control being isotropic)
varying distances from radio transmitters to calculate received signal
strength? That's how you learn what a base-10 decibel is, mind you.

In fact, Galileo did the same thing, in effect, by timing the volume of
water filling a glass when rolling objects of varying mass down an incline.
That's how you learn non Euclidean geometric math, mind you.

Just cutting out with tweezers a teeny tiny chunk of sodium metal previously
in kerosene, and then dropping a pinhead-sized morsel of sodium into a pan
of water, just once, will teach you a lot about redox potentials mind you.

Hell, just pulling the trigger on something as simple as an oxygen dispenser
focused onto a previously heated red-hot chunk of steel teaches you a ton
about oxidation.

Most humans are not math teachers.
Most humans learn by watching what really happens in the real world (imho).

Only math teachers haven't figured that learning method out yet.
Post by George Neuner
So, except for the one assembler, you only learned relatively high
level languages. Some C would have been helpful.
I kind of like low level languages with the less syntax, the better.
After COBOL, I became allergic to higher level language syntax errors.
They all do the same damn thing but each enforces different syntax rules.
Post by George Neuner
Post by paul
I used to love Forest Mims' simplicity of TTL code where everybody had the
yellow Texas Instruments books next to the blue National Semiconductor books
for digital and analog chips of the early days of ICs.
Then your head will explode when you look at x86-64 and the prospect
of interfacing with any modern operating system.
Nope. (IMHO anyway)

Just like the fact that cars haven't fundamentally changed in 100 years, and
chemistry hasn't changed in the past 1,000 years, and humans haven't changed
in the past 10,000 years, and the weather hasn't fundamentally changed in
the past 10,000 years, computers haven't fundamentally changed in the least.

They still do some form of jmp, jnz, jne, mov, add, push, pull, inc, loop,
dec, pop, ret, int, cld, or, xor, jz, xor, call, popf, etc.

Nothing has essentially changed even as it may seem that everything has.

What I seek may no longer exist, but it's a noble goal nonetheless.
wolfgang kern
2021-01-21 10:12:24 UTC
Permalink
On 20.01.2021 13:47, paul wrote:
...
Post by paul
I just want to learn about assembly language by running a simple tutorial.
windoze is NOT simple. In terms of easy programming it is the WORST.

I'm a low level programmer and know x86 instructions very well, but ASM
tools are all different therefore I've gone the pure metal hex-way.
And once (1999) I needed to learn about windoze in general because a
paying client asked for such.

similar to your problem I had no idea where to start and how to get info
about available M$-functions.

I found RosAsm (for 32bit windoze) and a lot of tutorials within it.
With some help of alt.asm and clax I figured the basics of it.

So after a few weeks I could sell my very first (also my last) win-app.
Not sure if the RosAsm forum is still active. just check on it.

Nasm is merely used by Loonix coders, Fasm(Fasmw) is fine for windoze.
Masm is M$-crap (you already figured that)
Masm32 is/was? an attempt to replace Masm.
__
wolfgang
Kerr-Mudd,John
2021-01-21 12:54:49 UTC
Permalink
On Thu, 21 Jan 2021 10:12:24 GMT, wolfgang kern
Post by wolfgang kern
...
Post by paul
I just want to learn about assembly language by running a simple tutorial.
windoze is NOT simple. In terms of easy programming it is the WORST.
I'm a low level programmer and know x86 instructions very well, but
ASM tools are all different therefore I've gone the pure metal
hex-way. And once (1999) I needed to learn about windoze in general
because a paying client asked for such.
similar to your problem I had no idea where to start and how to get
info about available M$-functions.
I found RosAsm (for 32bit windoze) and a lot of tutorials within it.
With some help of alt.asm and clax I figured the basics of it.
So after a few weeks I could sell my very first (also my last)
win-app. Not sure if the RosAsm forum is still active. just check on
it.
Nasm is merely used by Loonix coders, Fasm(Fasmw) is fine for windoze.
Masm is M$-crap (you already figured that)
Masm32 is/was? an attempt to replace Masm.
__
wolfgang
I use nasm for DOS programs, but I've never graduated to an IDE, just an
edit, asm, debug cycle
--
Bah, and indeed, Humbug.
George Neuner
2021-01-21 19:39:48 UTC
Permalink
On Thu, 21 Jan 2021 11:12:24 +0100, wolfgang kern
Post by wolfgang kern
...
Post by paul
I just want to learn about assembly language by running a simple tutorial.
windoze is NOT simple. In terms of easy programming it is the WORST.
Programming any GUI is complicated: working with X[*] on Unix/Linux is
not easier (and can be much harder, depending) than working with GDI
on Windows.

For command line programming, Unix/Linux and Windows use different
APIs, but the complexity of just using OS calls is roughly equivalent.

YMMV,
George

[*] typically using high(er) level Qt or GTK libraries - very few
people stoop to using the raw X API nowadays.
R.Wieser
2021-01-20 08:41:17 UTC
Permalink
Paul,
Post by paul
I press the Windows key & the "r" key, and then I type "cmd"
and then I press the "enter" key. Whatever CLI that happens to
be called, is what I want the program I assemble to work inside of.
The problem is that you can run true (16-bit) DOS programs[1] (using INT 21h
and whatnot) as well as CLI (Command Line Interface - Windows Console)
programs (using the full gamut of Windows DLLs) in there.

[1] Caveat emptor: I'm using Win XP myself. I have no idea if still works
under Win10.

IOW, mentioning /where/ you want to run it doesn't tell us much I'm afraid.

Could you give a few examples of the kind of programs you think you want to
make ? Than we can tell you which environment (DOS or CLI) you are aiming
for.

Remark: It doesn't really matter which one of the above you start with, as
long as you start with console I/O (non-GUI) based programs.

Regards,
Rudy Wieser
George Neuner
2021-01-21 19:57:00 UTC
Permalink
On Wed, 20 Jan 2021 09:41:17 +0100, "R.Wieser"
Post by R.Wieser
Paul,
Post by paul
I press the Windows key & the "r" key, and then I type "cmd"
and then I press the "enter" key. Whatever CLI that happens to
be called, is what I want the program I assemble to work inside of.
The problem is that you can run true (16-bit) DOS programs[1] (using INT 21h
and whatnot) as well as CLI (Command Line Interface - Windows Console)
programs (using the full gamut of Windows DLLs) in there.
[1] Caveat emptor: I'm using Win XP myself. I have no idea if still works
under Win10.
Win10 does not natively run 16-bit software.

There *was* an XP subsystem - separate from the "compatibility"
settings - available for Win7 Professional (or higher). It still
works on Win10 ... but most people who could have installed it on Win7
never did, and it won't install on Win10 - the only way to have it is
via in-place upgrade of Win7 to Win10.

Best to set up a VM and run an older version of Windows (or DOS).

George
Herbert Kleebauer
2021-01-20 10:49:37 UTC
Permalink
Post by paul
I apologize if I didn't know enough to ask the right question.
If you think a simple tutorial can teach you assembly programing,
then maybe are misunderstanding something. There are 3 parts of
assembly programming:

1. Writing a sequence of CPU instructions.

Just scroll through the first part of the instruction manual:

https://www.intel.de/content/www/de/de/architecture-and-technology/64-ia-32-architectures-software-developer-vol-2a-manual.html

and then decide again if you want to write a sequence of these
instructions.


2. Communicating with the operating system.

Spend a few weeks on:

https://docs.microsoft.com/en-us/windows/win32/api/

and the decide again if you really want to use a low
level interface to the OS.


3. Put 1+2 in a format (exe file format), so that the OS can load
and start your sequence of CPU instructions and is able to
execute the OS calls. This is normally done by the assembler
and linker, but an assembly programmer should know whats the
purpose of each byte in the exe file.


If you still want to start with assembly programming, here a
very simple demo program. Shouldn't be a problem to convert it
to the syntax of your preferred assembler, because it's mostly
only byte declarations and a few CPU instructions, starting at
Winmain:. No liker needed, all is done manually in the assembler
source.


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MINI.mac: display a message box ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

UseIdatSection=0 ; 0 if no idat section is used
UseUdatSection=0 ; 0 if no udat section is used

;#==================================================================#
;# Start of Headers #
;#==================================================================#

; +--------------------------------------------+
; | Start of DOS Header |
; +--------------------------------------------+

; DOS .EXE header
00000000: 00000000: 4d 5a dc.b 'MZ' ; Magic number
00000002: 00000002: 0160 dc.w dosfilesize\512 ; Bytes on last page of file (0->512)
00000004: 00000004: 0001 dc.w (dosfilesize-1)/512+1
; Pages in file (Page=512 byte)
00000006: 00000006: 0000 dc.w 0 ; Relocations (nr of entries)
00000008: 00000008: 0004 dc.w doshead_end/16 ; Size of header size in paragraphs (16 byte)
0000000a: 0000000a: 0000 dc.w 0 ; Minimum extra paragraphs needed
0000000c: 0000000c: ffff dc.w $ffff ; Maximum extra paragraphs needed
0000000e: 0000000e: 0000 dc.w 0 ; Initial (relative) SS value (ss=load_adr+nr)
00000010: 00000010: 0160 dc.w dosstack ; Initial SP value
00000012: 00000012: 0000 dc.w 0 ; Checksum
00000014: 00000014: 0000 dc.w dosmain ; Initial IP value
00000016: 00000016: 0000 dc.w 0 ; Initial (relative) CS value (cs=load_adr+nr)
00000018: 00000018: 0040 dc.w reloc ; File address of relocation table
0000001a: 0000001a: 0000 dc.w 0 ; Overlay number
0000001c: 0000001c: 0000 0000 0000
00000022: 00000022: 0000 dc.w 0,0,0,0 ; Reserved words
00000024: 00000024: 0000 dc.w 0 ; OEM identifier (for e_oeminfo)
00000026: 00000026: 0000 dc.w 0 ; OEM information; e_oemid specific
00000028: 00000028: 00000000 00000000
00000030: 00000030: 00000000 00000000
00000038: 00000038: 00000000 dc.l 0,0,0,0,0 ; Reserved words
0000003c: 0000003c: 000000a0 dc.l WinHeader ; File address of new exe header
reloc:
doshead_end:

@=$0
00000040: 00000000: 0e dosmain:move.w s6,-(sp)
00000041: 00000001: 1f move.w (sp)+,s0
00000042: 00000002: ba 000e move.w #_text,r1
00000045: 00000005: b4 09 move.b #$09,m0
00000047: 00000007: cd 21 trap #$21
00000049: 00000009: b8 4c01 move.w #$4c01,r0
0000004c: 0000000c: cd 21 trap #$21
0000004e: 0000000e: 4e 69 63 65 20 74
00000054: 00000014: 6f 20 6d 65 65 74
0000005a: 0000001a: 20 73 6f 6d 65 62
00000060: 00000020: 6f 64 79 20 77 68
00000066: 00000026: 6f 20 69 73 20 73
0000006c: 0000002c: 74 69 6c 6c 20 75
00000072: 00000032: 73 69 6e 67 20 44
00000078: 00000038: 4f 53 2c 0d 0a _text: dc.b 'Nice to meet somebody who is still using DOS,',13,10
0000007d: 0000003d: 62 75 74 20 68 69
00000083: 00000043: 73 20 70 72 6f 67
00000089: 00000049: 72 61 6d 20 72 65
0000008f: 0000004f: 71 75 69 72 65 73
00000095: 00000055: 20 57 69 6e 33 32
0000009b: 0000005b: 2e 0d 0a 24 dc.b 'but his program requires Win32.',13,10,'$'
0000009f: 0000005f: 00 even 16

dosstack=@+256 ; 256 Byte stack
dosfilesize=@+256

; +--------------------------------------------+
; | End of DOS Header |
; +--------------------------------------------+


; +--------------------------------------------+
; | Start of Windows Header |
; +--------------------------------------------+

ImageBase== $00400000
SectionAlignment== 4096
FileAlignment== 512

WinHeader=@@
@=ImageBase

; see WINNT.H for information
000000a0: 00400000: 50 45 00 00 dc.b 'PE',0,0 ; magic word
; _IMAGE_FILE_HEADER:
000000a4: 00400004: 014c dc.w $014c ; Machine ($014c=Intel x86 processor)
000000a6: 00400006: 0001 dc.w NumberOfSections ; NumberOfSections
000000a8: 00400008: 36a57950 dc.l $36a57950 ; TimeDateStamp (seconds since 31.12.69 16:00)
000000ac: 0040000c: 00000000 dc.l 0 ; PointerToSymbolTable
000000b0: 00400010: 00000000 dc.l 0 ; NumberOfSymbols
000000b4: 00400014: 00e0 dc.w SizeOfOptionalHeader ; SizeOfOptionalHeader
000000b6: 00400016: 010f dc.w $010f ; Charcteristics

; 0x0001 Relocation info stripped from file.
; 0x0002 File is executable (i.e. no unresolved externel references).
; 0x0004 Line nunbers stripped from file.
; 0x0008 Local symbols stripped from file.
; 0x0010 Agressively trim working set
; 0x0080 Bytes of machine word are reversed.
; 0x0100 32 bit word machine.
; 0x0200 Debugging info stripped from file in .DBG file
; 0x0400 If Image is on removable media, copy and run from the swap file.
; 0x0800 If Image is on Net, copy and run from the swap file.
; 0x1000 System File.
; 0x2000 File is a DLL.
; 0x4000 File should only be run on a UP machine
; 0x8000 Bytes of machine word are reversed.

@a=@ ; _IMAGE_OPTIONAL_HEADER
000000b8: 00400018: 010b dc.w $010b ; Magic
000000ba: 0040001a: 05 dc.b 5 ; MajorLinkerVersion
000000bb: 0040001b: 0c dc.b 12 ; MinorLinkerVersion
000000bc: 0040001c: 00000200 dc.l SizeOfCode ; SizeOfCode
000000c0: 00400020: 00000000 dc.l SizeOfInitializedData ; SizeOfInitializedData
000000c4: 00400024: 00000000 dc.l SizeOfUninitializedData ; SizeOfUninitializedData
000000c8: 00400028: 00001092 dc.l winmain-ImageBase ; AddressOfEntryPoint
000000cc: 0040002c: 00001000 dc.l BaseOfCode ; BaseOfCode
000000d0: 00400030: 00002000 dc.l BaseOfData ; BaseOfData
000000d4: 00400034: 00400000 dc.l ImageBase ; ImageBase
000000d8: 00400038: 00001000 dc.l SectionAlignment ; SectionAlignment
000000dc: 0040003c: 00000200 dc.l FileAlignment ; FileAlignment
000000e0: 00400040: 0004 dc.w 4 ; MajorOperatingSystemVersion
000000e2: 00400042: 0000 dc.w 0 ; MinorOperatingSystemVersion
000000e4: 00400044: 0000 dc.w 0 ; MajorImageVersion
000000e6: 00400046: 0000 dc.w 0 ; MinorImageVersion
000000e8: 00400048: 0004 dc.w 4 ; MajorSubsystemVersion
000000ea: 0040004a: 0000 dc.w 0 ; MinorSubsystemVersion
000000ec: 0040004c: 00000000 dc.l 0 ; Win32VersionValue
000000f0: 00400050: 00002000 dc.l SizeOfImage ; SizeOfImage
000000f4: 00400054: 00000200 dc.l SizeOfHeaders ; SizeOfHeaders
000000f8: 00400058: 00000000 dc.l 0 ; CheckSum
000000fc: 0040005c: 0002 dc.w 2 ; Subsystem
; 0: Unknown subsystem.
; 1: Image doesn't require a subsystem.
; 2: Image runs in the Windows GUI subsystem.
; 3: Image runs in the Windows character subsystem.
; 5: image runs in the OS/2 character subsystem.
; 7: image run in the Posix character subsystem.
; 8: image run in the 8 subsystem.
000000fe: 0040005e: 0000 dc.w $0000 ; DllCharacteristics
00000100: 00400060: 00100000 dc.l $00100000 ; SizeOfStackReserve
00000104: 00400064: 00001000 dc.l $00001000 ; SizeOfStackCommit
00000108: 00400068: 00100000 dc.l $00100000 ; SizeOfHeapReserve
0000010c: 0040006c: 00001000 dc.l $00001000 ; SizeOfHeapCommit
00000110: 00400070: 00000000 dc.l $00000000 ; LoaderFlags
00000114: 00400074: 00000010 dc.l NumberOfRvaAndSize ; NumberOfRvaAndSize (entries
; in the data dir)

; ..............................................
; : Start of Image Data Directory :
; ..............................................

; virtual address, size
@b=@
00000118: 00400078: 00000000 00000000 dc.l 0,0 ; Export Directory
00000120: 00400080: 00001010 0000003c dc.l imp_start,imp_size ; Import Directory
00000128: 00400088: 00000000 00000000 dc.l 0,0 ; Resource Directory
00000130: 00400090: 00000000 00000000 dc.l 0,0 ; Exception Directory
00000138: 00400098: 00000000 00000000 dc.l 0,0 ; Security Directory
00000140: 004000a0: 00000000 00000000 dc.l 0,0 ; Base Relocation Table
00000148: 004000a8: 00000000 00000000 dc.l 0,0 ; Debug Directory
00000150: 004000b0: 00000000 00000000 dc.l 0,0 ; Description String
00000158: 004000b8: 00000000 00000000 dc.l 0,0 ; Machine Value (MIPS GP)
00000160: 004000c0: 00000000 00000000 dc.l 0,0 ; TLS Directory
00000168: 004000c8: 00000000 00000000 dc.l 0,0 ; Load Configuration Directory
00000170: 004000d0: 00000000 00000000 dc.l 0,0 ; Bound Import Directory in headers
00000178: 004000d8: 00001000 00000010 dc.l iat_start,iat_size ; Import Address Table
00000180: 004000e0: 00000000 00000000 dc.l 0,0 ; 14
00000188: 004000e8: 00000000 00000000 dc.l 0,0 ; 15
00000190: 004000f0: 00000000 00000000 dc.l 0,0 ; 16

NumberOfRvaAndSize = (@-@b)/8
SizeOfOptionalHeader = @-@a

; ..............................................
; : End of Image Data Directory :
; ..............................................

; ..............................................
; : Start of Image Sections Header :
; ..............................................

@a=@

00000198: 004000f8: 2e 74 65 78 74 00
0000019e: 004000fe: 00 00 dc.b '.text',0,0,0 ; name
000001a0: 00400100: 000000e4 dc.l VSizeOf_text ; virtual size
000001a4: 00400104: 00001000 dc.l VBaseOf_text ; virtual address
000001a8: 00400108: 00000200 dc.l FSizeOf_text ; size of raw data
000001ac: 0040010c: 00000200 dc.l FBaseOf_text ; pointer to raw data
000001b0: 00400110: 00000000 dc.l 0 ; pointer to relocatins
000001b4: 00400114: 00000000 dc.l 0 ; pointer to line numbers
000001b8: 00400118: 0000 dc.w 0 ; number of relocations
000001ba: 0040011a: 0000 dc.w 0 ; number of line numbers
000001bc: 0040011c: e0000020 dc.l $e0000020 ; characteristics


IF UseIdatSection
dc.b '.idat',0,0,0 ; name
dc.l VSizeOf_idat ; virtual size
dc.l VBaseOf_idat ; virtual address
dc.l FSizeOf_idat ; size of raw data
dc.l FBaseOf_idat ; pointer to raw data
dc.l 0 ; pointer to relocatins
dc.l 0 ; pointer to line numbers
dc.w 0 ; number of relocations
dc.w 0 ; number of line numbers
dc.l $e0000040 ; characteristics
ENDIF

IF UseUdatSection
dc.b '.udat',0,0,0 ; name
dc.l VSizeOf_udat ; virtual size
dc.l VBaseOf_udat ; virtual address
dc.l FSizeOf_udat ; size of raw data
dc.l FBaseOf_udat ; pointer to raw data
dc.l 0 ; pointer to relocatins
dc.l 0 ; pointer to line numbers
dc.w 0 ; number of relocations
dc.w 0 ; number of line numbers
dc.l $e0000080 ; characteristics
ENDIF

NumberOfSections=(@-@a)/40

; ..............................................
; : End of Image Sections Header :
; ..............................................

; characteristics
; 0x00000020 // Section contains code.
; 0x00000040 // Section contains initialized data.
; 0x00000080 // Section contains uninitialized data.
; 0x00000200 // Section contains comments or some other type of information.
; 0x00000800 // Section contents will not become part of image.
; 0x00001000 // Section contents comdat.
; 0x01000000 // Section contains extended relocations.
; 0x02000000 // Section can be discarded.
; 0x04000000 // Section is not cachable.
; 0x08000000 // Section is not pageable.
; 0x10000000 // Section is shareable.
; 0x20000000 // Section is executable.
; 0x40000000 // Section is readable.
; 0x80000000 // Section is writeable.

; +--------------------------------------------+
; | End of Windows Header |
; +--------------------------------------------+

000001c0: 00400120: 00 00 00 00 00 00
000001c6: 00400126: 00 00 00 00 00 00
000001cc: 0040012c: 00 00 00 00 00 00
000001d2: 00400132: 00 00 00 00 00 00
000001d8: 00400138: 00 00 00 00 00 00
000001de: 0040013e: 00 00 00 00 00 00
000001e4: 00400144: 00 00 00 00 00 00
000001ea: 0040014a: 00 00 00 00 00 00
000001f0: 00400150: 00 00 00 00 00 00
000001f6: 00400156: 00 00 00 00 00 00
000001fc: 0040015c: 00 00 00 00 evencom FileAlignment

SizeOfHeaders==@@

;#==================================================================#
;# End of Headers #
;#==================================================================#

;#==================================================================#
;# Start of Sections #
;#==================================================================#

; +--------------------------------------------+
; | Start of .text Section |
; +--------------------------------------------+

FBaseOf_text==@@
VBaseOf_text==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
BaseOfCode==VBaseOf_text
@=ImageBase+VBaseOf_text


; ..............................................
; : Start of Thunk Table :
; ..............................................


iat_start=@-ImageBase

USER32_thunk:
00000200: 00401000: 00001060 MessageBoxA:: dc.l USER32_MessageBoxA -ImageBase
00000204: 00401004: 00000000 dc.l 0

KERNEL32_thunk:
00000208: 00401008: 00001084 ExitProcess:: dc.l KERNEL32_ExitProcess -ImageBase
0000020c: 0040100c: 00000000 dc.l 0


iat_size=@-ImageBase-iat_start

; ..............................................
; : End of Thunk Table :
; ..............................................


; ..............................................
; : Start of Import Directory :
; ..............................................


imp_start==@-ImageBase

imp:

00000210: 00401010: 00001058 dc.l USER32_import -ImageBase
00000214: 00401014: 00000000 dc.l 0
00000218: 00401018: 00000000 dc.l 0
0000021c: 0040101c: 0000104c dc.l USER32_name -ImageBase
00000220: 00401020: 00001000 dc.l USER32_thunk -ImageBase

00000224: 00401024: 0000107c dc.l KERNEL32_import -ImageBase
00000228: 00401028: 00000000 dc.l 0
0000022c: 0040102c: 00000000 dc.l 0
00000230: 00401030: 0000106e dc.l KERNEL32_name -ImageBase
00000234: 00401034: 00001008 dc.l KERNEL32_thunk -ImageBase

00000238: 00401038: 00000000 dc.l 0
0000023c: 0040103c: 00000000 dc.l 0
00000240: 00401040: 00000000 dc.l 0
00000244: 00401044: 00000000 dc.l 0
00000248: 00401048: 00000000 dc.l 0

imp_size==@-imp

; ..............................................
; : End of Import Directory :
; ..............................................



USER32_name:
0000024c: 0040104c: 55 53 45 52 33 32
00000252: 00401052: 2e 64 6c 6c 00 dc.b 'USER32.dll',0
00000257: 00401057: 00 even

USER32_import:
00000258: 00401058: 00001060 dc.l USER32_MessageBoxA -ImageBase
0000025c: 0040105c: 00000000 dc.l 0
even

USER32_MessageBoxA:
00000260: 00401060: 0000 dc.w 0
00000262: 00401062: 4d 65 73 73 61 67
00000268: 00401068: 65 42 6f 78 41 00 dc.b 'MessageBoxA',0
even


KERNEL32_name:
0000026e: 0040106e: 4b 45 52 4e 45 4c
00000274: 00401074: 33 32 2e 64 6c 6c
0000027a: 0040107a: 00 dc.b 'KERNEL32.dll',0
0000027b: 0040107b: 00 even

KERNEL32_import:
0000027c: 0040107c: 00001084 dc.l KERNEL32_ExitProcess -ImageBase
00000280: 00401080: 00000000 dc.l 0
even

KERNEL32_ExitProcess:
00000284: 00401084: 0000 dc.w 0
00000286: 00401086: 45 78 69 74 50 72
0000028c: 0040108c: 6f 63 65 73 73 00 dc.b 'ExitProcess',0
even





; ..............................................
; : Start of Code :
; ..............................................


label_block
seg32


winmain::
00000292: 00401092: 6a 00 moveq.l #0,-(sp)
00000294: 00401094: 68 004010ae move.l #text1,-(sp)
00000299: 00401099: 68 004010be move.l #text2,-(sp)
0000029e: 0040109e: 6a 00 moveq.l #0,-(sp)
000002a0: 004010a0: ff 15 00401000 jsr.l (MessageBoxA)
000002a6: 004010a6: 6a 00 moveq.l #0,-(sp)
000002a8: 004010a8: ff 15 00401008 jsr.l (ExitProcess)

000002ae: 004010ae: 4d 69 6e 69 6d 75
000002b4: 004010b4: 6d 20 57 69 6e 64
000002ba: 004010ba: 65 6c 61 00 text1: dc.b "Minimum Windela",0
000002be: 004010be: 20 20 2d 2d 2d 20
000002c4: 004010c4: 41 73 73 65 6d 62
000002ca: 004010ca: 6c 65 72 20 50 75
000002d0: 004010d0: 72 65 20 61 6e 64
000002d6: 004010d6: 20 53 69 6d 70 6c
000002dc: 004010dc: 65 20 2d 2d 2d 20
000002e2: 004010e2: 20 00 text2: dc.b " --- Assembler Pure and Simple --- ",0


; ..............................................
; : End of Code :
; ..............................................

VSizeOf_text==@-Imagebase-VBaseOf_text
@a=@
000002e4: 004010e4: 00 00 00 00 00 00
000002ea: 004010ea: 00 00 00 00 00 00
000002f0: 004010f0: 00 00 00 00 00 00
000002f6: 004010f6: 00 00 00 00 00 00
000002fc: 004010fc: 00 00 00 00 00 00
00000302: 00401102: 00 00 00 00 00 00
00000308: 00401108: 00 00 00 00 00 00
0000030e: 0040110e: 00 00 00 00 00 00
00000314: 00401114: 00 00 00 00 00 00
0000031a: 0040111a: 00 00 00 00 00 00
00000320: 00401120: 00 00 00 00 00 00
00000326: 00401126: 00 00 00 00 00 00
0000032c: 0040112c: 00 00 00 00 00 00
00000332: 00401132: 00 00 00 00 00 00
00000338: 00401138: 00 00 00 00 00 00
0000033e: 0040113e: 00 00 00 00 00 00
00000344: 00401144: 00 00 00 00 00 00
0000034a: 0040114a: 00 00 00 00 00 00
00000350: 00401150: 00 00 00 00 00 00
00000356: 00401156: 00 00 00 00 00 00
0000035c: 0040115c: 00 00 00 00 00 00
00000362: 00401162: 00 00 00 00 00 00
00000368: 00401168: 00 00 00 00 00 00
0000036e: 0040116e: 00 00 00 00 00 00
00000374: 00401174: 00 00 00 00 00 00
0000037a: 0040117a: 00 00 00 00 00 00
00000380: 00401180: 00 00 00 00 00 00
00000386: 00401186: 00 00 00 00 00 00
0000038c: 0040118c: 00 00 00 00 00 00
00000392: 00401192: 00 00 00 00 00 00
00000398: 00401198: 00 00 00 00 00 00
0000039e: 0040119e: 00 00 00 00 00 00
000003a4: 004011a4: 00 00 00 00 00 00
000003aa: 004011aa: 00 00 00 00 00 00
000003b0: 004011b0: 00 00 00 00 00 00
000003b6: 004011b6: 00 00 00 00 00 00
000003bc: 004011bc: 00 00 00 00 00 00
000003c2: 004011c2: 00 00 00 00 00 00
000003c8: 004011c8: 00 00 00 00 00 00
000003ce: 004011ce: 00 00 00 00 00 00
000003d4: 004011d4: 00 00 00 00 00 00
000003da: 004011da: 00 00 00 00 00 00
000003e0: 004011e0: 00 00 00 00 00 00
000003e6: 004011e6: 00 00 00 00 00 00
000003ec: 004011ec: 00 00 00 00 00 00
000003f2: 004011f2: 00 00 00 00 00 00
000003f8: 004011f8: 00 00 00 00 00 00
000003fe: 004011fe: 00 00 evencom FileAlignment
@=@a

FSizeOf_text==@@-FBaseOf_text
SizeOfCode==FSizeOf_text


; +--------------------------------------------+
; | End of .text Section |
; +--------------------------------------------+


; +--------------------------------------------+
; | Start of .idat Section |
; +--------------------------------------------+


FBaseOf_idat==@@
VBaseOf_idat==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
BaseOfData==VBaseOf_idat
@=ImageBase+VBaseOf_idat

; Insert initialized variables here (and set UseIdatSection=1
; at the top of this file). Because the code section is set
; r/w-able, you can put initialized variables also into the
; code section.

; var1: dc.l 0
; var2: dc.l $12345678

VSizeOf_idat==@-Imagebase-VBaseOf_idat
@a=@
evencom FileAlignment
@=@a
FSizeOf_idat==@@-FBaseOf_idat

; +--------------------------------------------+
; | End of .idat Section |
; +--------------------------------------------+

SizeOfInitializedData==FSizeOf_idat


; +--------------------------------------------+
; | Start of .udat Section |
; +--------------------------------------------+


FBaseOf_udat==@@
VBaseOf_udat==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
@=ImageBase+VBaseOf_udat

; Insert uninitialized variables here (and set UseUdatSection=1
; at the top of this file). Because the code section is set
; r/w-able, you can put uninitialized variables also at the END
; of the code section.

; buf1: blk.l 10
; buf2: blk.l 200

VSizeOf_udat==@-Imagebase-VBaseOf_udat
@a=@
evencom FileAlignment
@=@a
FSizeOf_udat==@@-FBaseOf_udat

; +--------------------------------------------+
; | End of .udat Section |
; +--------------------------------------------+

SizeOfUninitializedData==VSizeOf_udat
SizeOfImage==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment


;#==================================================================#
;# End of Sections #
;#==================================================================#






And here the binary as a self extracting batch file:


@echo off
certutil -f -decode %~f0 MINI.exe>nul
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgaGlzIHByb2dyYW0gcmVx
dWlyZXMgV2luMzIuDQokAFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
AAAAAAAAAACSEAAAABAAAAAgAAAAAEAAABAAAAACAAAEAAAAAAAAAAQAAAAAAAAA
ACAAAAACAAAAAAAAAgAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
EBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAQAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAADkAAAAABAAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgEAAAAAAAAIQQAAAAAAAA
WBAAAAAAAAAAAAAATBAAAAAQAAB8EAAAAAAAAAAAAABuEAAACBAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAVVNFUjMyLmRsbAAAYBAAAAAAAAAAAE1lc3NhZ2VCb3hBAEtF
Uk5FTDMyLmRsbAAAhBAAAAAAAAAAAEV4aXRQcm9jZXNzAGoAaK4QQABovhBAAGoA
/xUAEEAAagD/FQgQQABNaW5pbXVtIFdpbmRlbGEAICAtLS0gQXNzZW1ibGVyIFB1
cmUgYW5kIFNpbXBsZSAtLS0gIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----
paul
2021-01-20 13:04:01 UTC
Permalink
Post by Herbert Kleebauer
If you think a simple tutorial can teach you assembly programing,
then maybe are misunderstanding something. There are 3 parts of
I wasn't clear in my opening post if I said I wanted to "learn" assembly
language programming.

Just as a person can hike an existing trail that someone else dug out and
put all the steps and bridges and maps in place years before, I just want to
"walk the trail" of an existing assembly language programming tutorial.

If I had wanted to build my own trail, cutting steps in the snow, attaching
belay lines across the Hillary Step, staking down ladders across the Khombu
Icefall, designing my own oxygen cylinder breathing apparatus, designing my
own insulating clothing, testing out the chemicals for the rubber soles of
my boots, designing my own shoe laces, etc., I would have started with my
existing books by Peter Norton & Jeff Duntemann on Assembly Language
Programming, step by step.

I don't want to build the trail - I just want to follow the existing trail.

I'm not Lewis & Clark, where I have to build my own bridges and dig out my
own canoes just to figure out what's at the end of a river, where if I don't
portage across the waterfall, I'm dead (that's no fun).

I apologize that I wasn't clear in the opening post because I was under an
illusion that there existed an assembly language tutorial (much like the
Android Studio tutorial that exists) which simply walks you though the
steps, so that in an hour or two, you've already got a half dozen programs
working.

It's fun to follow a trail that someone else already built, but if I have to
chop down a tree to build my own canoe just to get across to the other side
of the river, then it's no fun anymore.

When I get to the other side of the river, I will find that there is no
trail, and worse, all there is on the other side is a never ending swamp of
bog after bog, which is "no fun".

Fun is a trail to get you to the river, and then a bridge to get across the
river, and then on the other side, someone put down duckboard to get across
the swamp, where they already knew the shortest way through the swamp to get
to the flowers that are growing at the piedmont.

Fun is an assembly language tutorial to get you across the river of
installing and assembling your first program, and then across the swamp of a
few examples, so that in an hour or two, you already have a half dozen
assembly language programs working.

After that, if you still want to step off into the peat bog, if you think
that's fun, you can do it - knowing that you can back up if you step into
quicksand, and you'll be back on the working duckboards.

Back to the original need, I will endeavor to find a tutorial that works on
the most common computer platform in the world, using whatever assembler
that tutorial suggests.
Kerr-Mudd,John
2021-01-20 16:01:21 UTC
Permalink
On Wed, 20 Jan 2021 13:04:01 GMT, paul
<***@nospicedham.nospam.invalid> wrote:
[]
Post by paul
Back to the original need, I will endeavor to find a tutorial that
works on the most common computer platform in the world, using
whatever assembler that tutorial suggests.
Sorry we couldn't help; x86 is ancient technology that requires a lot of
effort to get into. I doubt there's much impetus to create a slick modern
streamlined tutorial.
--
Bah, and indeed, Humbug.
wolfgang kern
2021-01-21 10:24:48 UTC
Permalink
Post by Kerr-Mudd,John
On Wed, 20 Jan 2021 13:04:01 GMT, paul
[]
Post by paul
Back to the original need, I will endeavor to find a tutorial that
works on the most common computer platform in the world, using
whatever assembler that tutorial suggests.
Sorry we couldn't help; x86 is ancient technology that requires a lot of
effort to get into. I doubt there's much impetus to create a slick modern
streamlined tutorial.
The Basics weren't much to tell. Bernhard could do a few lines on it :)
I still have the twelve lessons from good old RosAsm. most lines
describe just the different syntax, but beside this it explains a lot
how win32 work at all. Even windoze10 is 64bit but it must support
32-bit programs as well.
__
wolfgang
Bernhard Schornak
2021-01-21 18:06:43 UTC
Permalink
Post by wolfgang kern
The Basics weren't much to tell. Bernhard could do a few lines on it :)
I doubt "paul" is interested in learning AT&T syntax. If I understood
his posts right, he tries to execute 16 bit DOS low level calls in 64
bit windoze. Never will work without an extender (DOSEMU), because 64
bit windoze denies execution of 16 bit programs - no way to get a DOS
tutorial's examples running on modern hardware.

Nevertheless, my libraries can be found here:

https://drive.google.com/file/d/0B1OgMlxNnSNEVnJNeTNSeEM1bTQ/view?usp=sharing

There is a (incomplete) HTML-Documentation for the functions and some
tutorials about basics of my programming system. (The 7z archive also
includes full source code of working programs using my libraries, all
written in 100% assembler.)


Pfüat'Di!

Greetings from Augsburg

Bernhard Schornak
Herbert Kleebauer
2021-01-20 16:03:47 UTC
Permalink
Post by paul
Just as a person can hike an existing trail that someone else dug out and
put all the steps and bridges and maps in place years before, I just want to
"walk the trail" of an existing assembly language programming tutorial.
I suppose, you are joking. It's like asking for a tutorial to write
a German novel, but refusing to first learn the German language. You
don't need instructions how to put an empty sheet of paper into the
typewriter and how to transfer letters to the paper as long as you
don't understand the language you want to use for your novel. But
if you refuse to learn German, you can write the novel in English and
use Google to translate it to German.

So, start to read the few thousands pages of documentation I gave you.
And once you have understood them, you can start to read the additional
10 pages how to use the assembler to generate a binary from your source
code. But if you refuse to learn the assembly language and the OS interface,
you can write your code in any HLL and use an automatic translator to
convert it to assembly code (called compiler). But that has nothing
to do with assembly programming.

An other way to start assembly programming would be to not use an
x86 CPU and Windows 64 but a simple micro-controller with no
OS at all (like AVR). The instruction set is much simpler and there
is no OS interface to understand, so you can start programming after
a few hours reading the processor manual. And in this case you will
also find the sort of tutorial you want.
Pavel vitsoft Šrubař
2021-01-20 22:16:01 UTC
Permalink
Post by paul
Just as a person can hike an existing trail that someone else dug out and
put all the steps and bridges and maps in place years before, I just want to
"walk the trail" of an existing assembly language programming tutorial.
€ASM with its macrolibraries might be the right "trail" for you.
Download and unzip "euroasm.zip",
copy "Hello world" source text from the yellow box at https://euroassembler.eu/eadoc/#HelloWorld
paste it to "hello.asm",
assemble and link with "euroasm hello.asm"
and try to run "Hello32.exe" and "Hello64.exe".
When it works, feel free to extend the source with instructions retrieved from tutorials enumerated at
https://euroassembler.eu/eadoc/links.htm#Tutorials

vitsoft
Rod Pemberton
2021-01-21 07:16:19 UTC
Permalink
On Wed, 20 Jan 2021 14:04:01 +0100
Post by paul
Just as a person can hike an existing trail that someone else dug out
and put all the steps and bridges and maps in place years before, I
just want to "walk the trail" of an existing assembly language
programming tutorial.
So, you want a tutorial for which you can view the executing
x86 instructions via a debugger or disassembler or interpreter?

The really old way of doing this was to get some binary code and
disassemble it, looking up each instruction in the programmer's
reference manual, and mentally following along with what the code was
doing.

The next really old way of doing this was to get some binary code and
step through it in a debugger, dumping the registers as you went, while
looking up each instruction in the programmer's reference manual, and
mentally following along with what the code was doing.

I don't recall if there is any modern, in-browser, online website for
x86 code which does something like either of those. Travis pointed you
to Mr. Godbolt's emulator.

You might want to run some emulator, like DOSBox or MAME/MESS or QEMU
or Bochs or one of numerous others, depending on what computer and
operating system you use, to boot up a 16-bit DOS machine, e.g.,
FreeDOS. Then, experiment with DOS .com's, use DEBUG the debugger and
disassembler for DOS, and some assembler such as MASM or perhaps NASM.
NASM also comes with a disassembler.

https://www.freedos.org/
https://www.nasm.us/

https://www.dosbox.com/
https://www.mamedev.org/
http://bochs.sourceforge.net/
https://www.qemu.org/

--
Frank Kotler
2021-01-20 00:27:30 UTC
Permalink
On 01/19/2021 12:37 PM, paul wrote:
...
Post by paul
Does that mean there are no free assemblers (along with beginner tutorials)
that work native on a modern Win10 x64?
Free assemblers, yes. Tutorials may not be so easy.

If you installed Nasm using the installer, DO NOT USE the uninstaller! I
cannot confirm this, but I am told that it will delete "valuable
programs" as well as Nasm,

Nasm does not come with a linker. Golink is popular. Many others will work.

There is an example of "Hello World" for Windows64 on the Nasm forum:
http:forum.nasm.us It is not a tutorial.

I haven't run Windows since win98 so I can't help you much. I'll try
(again) to find that example,

Best,
Frank
Frank Kotler
2021-01-20 03:19:19 UTC
Permalink
I'll try (again) to find that example,

https://forum.nasm.us/index.php?topic=2656.msg11959#msg11959

Not a tutorial.

Best,
Frank
Kerr-Mudd,John
2021-01-20 10:14:25 UTC
Permalink
On Wed, 20 Jan 2021 03:19:19 GMT, Frank Kotler
Post by Frank Kotler
I'll try (again) to find that example,
https://forum.nasm.us/index.php?topic=2656.msg11959#msg11959
Not a tutorial.
Best,
Frank
Sounds like someone else is trying nasm under W10:

https://forum.nasm.us/index.php?topic=2396.0
--
Bah, and indeed, Humbug.
Rickey Bowers
2021-01-19 00:48:40 UTC
Permalink
Another modern way to get MASM is through the build tools download:
https://aka.ms/buildtools

Especially if one has an existing development environment or preferred editor.

Kind regards, bitRAKE
Frank Kotler
2021-01-18 06:04:42 UTC
Permalink
On 01/17/2021 05:38 PM, paul wrote:
...
Post by paul
Name is easy.
Binary installer is harder.
Choosing a beginner assembler even harder still.
In order of suggested above
Masm
Requires visual c
https://www.microsoft.com/en-us/download/details.aspx?id=12654
Maybe not
MASM https://sourceforge.net/projects/masm611/
Okay if all you want is Windoze...
Post by paul
Nasm
https://nasm.us/
https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/
Good for 'doze, Linux, BSD, Macos. eic.
Post by paul
Fasm
Maybe here? https://sourceforge.net/projects/fasm/
Or here?
https://flatassembler.net/download.php
Probably this one...
Post by paul
Which is the right downloads for Windows 10 (64-bit)?
Any should do...

Best,
Frank
wolfgang kern
2021-01-17 07:12:26 UTC
Permalink
Post by paul
advise for a good beginner windoze assembler?
windoze is an HLL OS, you may need a lot of hints to find its functions.
assembler for windoze is fine if you already know a bit of both.

so I'd advise:
1. look into the (AMD/Intel) CPU manuals for the instruction set.
2. if you're now not confused enough to quit then start reading M$-stuff
3. still interested ? :) OK then:
4. ask away all your questions (sure to occur) here or in ASM forum.
__
wolfgang
paul
2021-01-17 22:31:18 UTC
Permalink
Post by wolfgang kern
ask away all your questions (sure to occur) here or in ASM forum.
Which is the ASM forum you speak of if not this one?
I have Peter Norton's ASM hand book but it doesn't come with the assembler.
wolfgang kern
2021-01-19 06:10:12 UTC
Permalink
Post by paul
Post by wolfgang kern
ask away all your questions (sure to occur) here or in ASM forum.
Which is the ASM forum you speak of if not this one?
I have Peter Norton's ASM hand book but it doesn't come with the assembler.
NASM, FASM and I think even MASM have their own forum, google mayu help.
__
wolfgang
a***@nospicedham.spamtrap.com
2021-01-19 22:48:08 UTC
Permalink
On Tue, 19 Jan 2021 07:10:12 +0100, wolfgang kern
Post by wolfgang kern
NASM, FASM and I think even MASM have their own forum, google mayu help.
https://www.asmcommunity.net/
--
aen
Bonita Montero
2021-01-27 19:33:23 UTC
Permalink
Post by paul
advise for a good beginner windoze assembler?
Begin with 32 bit programming and use the inline-assembler of
MSVC (64 bit MSVC++ hasn't any inline-assembler any more). With
naked functions (functions without a compiler generated prologue
and epilogue) you don't have to learn the directives for an
assembler.
Rickey Bowers
2021-02-08 18:48:31 UTC
Permalink
Post by paul
advise for a good beginner windoze assembler?
https://flatassembler.net/

fasm requires no installation beyond setting the include directory and has plenty of examples in 32-bit/64-bit windows. Besides comp.lang.asm.x86 it's probably the longest running community on x86. The assembler is written in x86, and open source. At just over a megabyte, it might be the smallest option as well.

disclaimer: I'm approaching 20 years of working fasm/fasmg. My x86 path was: debug, tasm, nasm, masm, fasm.
Loading...