Hi everyone !

I'm very, very new at all this programming lark.  But it's just something that grabbed my interest so I thought why not try it out.  Sadly I had a few problems already.

This is about how much I know at the moment:

  • A little bit about registers

  • A few opcodes mov, jmp, conditional jmps, etc. etc.li]

I've done a little programming before but not enough to be mentionable.  I have however done quite a bit of memory editing before which is how I got introduced to asm in the first place.

Right now I intend to just plough through the stuff here:

But I have a few questions already.  First question is have I got the right software to be learning ASM ?  I just installed "Easy Code Visual Assembler IDE for Masm" and also I 'think' I installed masm but I'm not sure.  There's a folder in the root drive with heaps of stuff in it but there is no other file appearing on the program list.  So where do I go from there to get into the masm program/assembler ?

Oh yeah I'm on Windows Vista so I'm not sure if that affects anything.

Last question is how do I start compiling code ?  From the basics I learnt now, things go in this format kinda:
opcode ,

Is that right or wrong ?  So many questions  :P

Thanks  ;)
Posted on 2007-05-03 11:43:58 by Slugsnack
As far as I know Windows Vista is mostly making use of .NET stuff so masm wouldn't be the right choice for native vista apps. Vista probably has a fallback arrangement for standard win32 apps, i guess. To learn assembly language I would suggest you buy a copy of a "Revolutionary guide to assembly language". At amazon auctions it is pretty cheap i think. There you will learn assembly language from ground up in DOS. To make it work in Vista you need Microsoft Virtual PC 2004/2007 or another virtual machine like vmware, even DosBox (sourceforge) might work out for your needs of learning.
Posted on 2007-05-03 12:08:55 by atcl
Aww I can't learn with Vista without Virtual PC and stuff ?
Posted on 2007-05-03 12:18:00 by Slugsnack
I am very sure that masm works in the vista environment. I believe you just haven't set it up properly... Did you install the masm32 package? Is it there on drive C under masm32\ ? What happens when you open an example program inside Easycode and hit compile/run?
Posted on 2007-05-03 12:29:54 by JimmyClif
I tried to compile this:
MOV DL,"!"
INT 21h
INT 21h

And it gives this error in the Debug bit:
============== Project1 - Debug ==============

Assembling: apple
apple.asm(6) : error A2008: syntax error : Include
apple.asm(1) : warning A4012: line number information for segment without class 'CODE' : _DATA

Errors ocurred.

Btw thanks for replying so quick.
Posted on 2007-05-03 12:49:45 by Slugsnack
Oh, that's because you're trying to compile 16bit code on a 32bit geared development environment. Read on this thread how to compile 16bit code:

I don't know if Easycode has any support for 16bit code. I do know that radasm does have the option on creating dos (app) & (com) projects.
Posted on 2007-05-03 13:33:13 by JimmyClif
Sorry but could you explain to me the difference between 16 bit and 32 bit please ?  I know it vaguely but it'd be great to get a proper definition from someone who knows their stuff.

Yeah I had a little search already  :P
Posted on 2007-05-03 14:11:33 by Slugsnack
Click and go 16bit ASM interactive Interpreter/assembler/debugger tutorial.

No setup this no setup that.



Have a wee read and give us a shout in about 3 months. :lol:
Posted on 2007-05-03 14:27:42 by eek
Thanks so much.  You guys are really helpful.  From what I read it looks like 16 bit is no longer supported really ?  Is there any point in learning it ?  And if not then where can I find tutorials for only 32 bit ?  (Still don't know the difference really  :))
Posted on 2007-05-03 14:37:59 by Slugsnack
Iczelion's tutorials are great for an introduction to 32 bit Windows programming. 16 bit is still useful to learn though less and less so with each processor generation. However, almost all assembly programming in a commercial environment is 16 bit, that is BIOS, programmable controllers, embedded architecture controllers etc... Not that these things cannot be 32 or 64 bit but those parts of the industry are slow to change due to compatibility issues and "retooling" costs. From a strictly hobby viewpoint, 16 bit is pretty much as dead as DOS and about as useful.

As for supporting 16 bit, all Windows versions have a WoW mode for 16 bit and can still run much of it though those applications which rely heavily on DOS interrupts will generally fail on all but the oldest Windows versions so it is wise to have a separate dev PC running older OS versions.

Posted on 2007-05-03 19:34:31 by donkey
16-bit is dead and useless, imho :)

Don't start off with learning it anyway, it's a bit more complex than 32-bit because of it's limitations, and the need for memorizing a lot of numeric constants for interrupt calls, instead of names and symbolic values for API calls. Once you're on par with 32-bit assembly, you can always pick up 16-bit if necessary.

16-bit is unavailable on all 64-bit windows versions by the way, since there's no hardware support for running 16-bit code in x86-64 mode. You'll need dosbox or a CPU emulator then. But there's still a decent amount of old dos apps that won't work well, since they were written in dirty and very harware dependent ways.
Posted on 2007-05-04 07:07:42 by f0dder

Would you happen to have any tutorials to recommend for 32 bit ?  I had a look at the wiki-book and googled but had a little problem getting exactly what I wanted.
Posted on 2007-05-04 10:18:47 by Slugsnack
Vista has little to no bearing on writing x86 Windows 32 bit assembly programs.

Writing Win32 assembly programs is to a large degree
a combination of assembly instructions and Windows API calls.

Win32 assembly programs are native code applications,
which run on any of the 32 bit x86 windows OSes
Windows 95, 98, 98SE, ME, NT, 2000, XP, Vista, etc
though different OS versions have varying support of the various API calls.

.NET programs are not written in x86 assembly language but in languages
such as C# or VB.NET and are compiled to .NET IL assembly language then
assembled to .NET bytecode, IL is vastly different and incompatible with x86 assembly.

The .NET runtime is needed for .NET programs to run
and can be used on 2000, XP, Vista and some other Windows versions.

The following code is source for a short MASM example program.
It shows a messagebox then ends.

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

includeLib \masm32\lib\user32.lib
includeLib \masm32\lib\kernel32.lib

  szMessage0 db "The message:  The number is  0",0
  szMessage1 db "The message:  The number is  1",0
  szMessage2 db "The message:  The number is > 1",0
  szCaption  db "The caption, the titlebar text.",0


  lea edx, szMessage2  ; put the address of szMessage2 into edx
  mov eax, 1          ; put the immediate value 1 into eax
  cmp eax, 0          ; compare eax with 0
  jne M1              ; jump if not equal to label  M1
  lea edx, szMessage0
  jmp Past            ; jump to label  Past
  cmp eax, 1
  jne Past
  lea edx, szMessage1

;-------------------- Roughly equivalent using MASM's
;-------------------- built in high level syntax
;-------------------- it is replaced with low level code
;-------------------- like the opcode version above.
;    .if eax == 0
;      lea edx, szMessage0
;    .elseif eax == 1
;      lea edx, szMessage1
;    .else
;      lea edx, szMessage2
;    .endif

  invoke MessageBox, 0, edx, addr szCaption, MB_OK  ; MessageBox API call

  invoke ExitProcess, 0  ; ExitProcess (Program)  API call
end start

As already mentioned the Iczelion tutorial/example programs show how
to code many types of Windows programs.

A reference to Windows API calls is the win32.hlp file that can be found
online, it is written using a C styled syntax but is still applicable to assembly
language programming. Other sources of information are searching the web or searching within assembly language forums.

Depending on the assembler and editor/assembly environment
the steps to create a executable program from assembly source code
can differ substantially from using a command line or batch file
to selecting an item from a menu.

Some of the various assemblers are MASM, FASM, GoAsm, NASM, HLA, YASM
some editor/environments  QEditor, FASMW, Easy Code, RadAsm etc.
Posted on 2007-05-04 17:31:07 by dsouza123
Would you happen to have any tutorials to recommend for 32 bit ?

Iczelion's tutorials are great for an introduction to 32 bit Windows programming.

Posted on 2007-05-04 22:40:53 by ti_mo_n
I'm writing a new crossplatform and crossarchitecture assembler/compiler/linker tool, and it does/will NOT support 16 bit code, at least unless I am petitioned to implement it.
I have built basic support for late implemention right into the framework regardless, dunno why I bothered ;)
Posted on 2007-05-07 05:45:04 by Homer
But...but...what about my 286 dev box?  :lol:

Seriously, what about boot sectors and the initial jump into protected/realbig mode? MASM is a real bitch for that.
Posted on 2007-05-07 05:58:22 by sinsi