News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Newbie

Started by radarblue, February 18, 2015, 09:42:17 AM

Previous topic - Next topic

radarblue

good day.

I work with electricity and want to learn Assembly. Mostly because we get into PLC automation and BCD chips in the "computer chapters". Always loved Amiga and the old stuff, or rather machine logic. Picked up a book called "X86 Assembly and C fundamentals" and having fun with binary arithmetic. However trying to code is a disaster. I cant even get a C compiler to run proper and feel completely lost . And the Visual Express c++ is not exatly working for me. A friend told me to use GCC.

I also have the MASM installed, but I dont get much out of it ...
My goal is to learn Assembly and insert the "inlines" to C.

well cheers.

dedndave

i worked with PLC's a little bit - nothing like assembler, unfortunately - lol
i didn't care for the "ladder logic" languages
i know electronics and assembler - and they didn't make sense   :lol:

if you have installed the masm32 package...
you can examine some of the examples in the masm32\examples folder to get some ideas

rrr314159

Welcome radarblue,

a supplement to dedndave's advice,
Quoteif you have installed the masm32 package...
If you haven't: do so! I was in exactly the same boat as you until I ran into masm32, played with the examples - best environment around, IMHO. Any questions, just ask, somebody (for newbie q's, probably everybody) knows the answer
I am NaN ;)

Gunther

Hi  radarblue,

welcome to the forum.

Gunther
You have to know the facts before you can distort them.

Siekmanski

radarblue, welcome to the forum.
Creative coders use backward thinking techniques as a strategy.

Vortex

Hello radarblue,

Welcome to the Masm Forum.

radarblue

Thanks
The MASM32 is installed. And thats about it .
And looking into some examples and "how to`s..".
Its an enormous amount of read .

And I who thought, this was going to be easy  ;)

radarblue

Installing.
I install MASM32 once again. I get some errors similar to this :
http://masm32.com/board/index.php?topic=1110.0

incl2Exe
1. The ordinal 200 could not be located in the dynamic link liberary
C:\windows\appPatch\AcGenral.DLL

2. the ordinal 202 could not be located in the dynamic link liberary
C:\windows\appPatch\AcLayers.dll

And so on, maybe 20 errors on a row, at the end of the installer.
I have a windows 8 on a PC dual core 2.

Q1 . Will the MASM editor perform as expected without therse DLL`s?


The forum says Hutch :
Try something unusual, if you have a much later version of ML.EXE and LINK.EXE, place them in the BIN directory then run the batch file. There should not be anything in INC2L.EXE that triggers this problem but it repeatedly calls ML.EXE and LINK.EXE.

Q2 : I dont understand. Put the installer file on a special place before installing ?

radarblue

I found a file called "hello" text file and loaded into Qeditor . masm32\tutorial\console\demo1.
I got the OBJ.file and the .EXE file without errors. However the .EXE file will not run or display anything .

Question : why ?

However running the original hello.exe file provided in the tutorial folder, it blinks the text " hey this actually works" for a brief second .


jj2007

1. Did you use "console build all"?
2. If yes, run the exe from a command prompt (as qEditor does not recognise that the console window needs to be kept open).

radarblue

#10
 :biggrin:
No I didnt. I used "Project>Build all".
But when I use "Project>Console Build all". It comes up like expected .
THANKS !

Q : How do I make the "progam" stay on screen and not disappear in a instant ?

dedndave

for console mode programs, we often use the "inkey" macro before exit
this displays "Press any key to continue...", and waits for the user to press a key

; program code

    inkey
    exit     ;or INVOKE ExitProcess,0

rrr314159

Hello radarblue,

Here's how I dealt with those issues; probably not the normal way, but works for me. IF you're familiar with the DOS command prompt it will work for you too, otherwise maybe not.

Anyway, in qEditor hit "CTRL-D" to bring up the DOS window. Type "hello" at the prompt (or, hello.exe), hit enter, the program runs in the command window and the results stay there; no need for inkey.

You can just use that simple trick, but if you're familiar with the DOS cmd window (or, are willing to become so) read on.

I use the cmd window most of the time, instead of the qEditor menus. It's actually easier (for me) and gives me more control. Here is a simple "makefile" batch file:
@echo off

if exist "%1.obj" del "%1.obj"

\masm32\bin\ml /c /coff "%1.asm"
if errorlevel 1 goto theend

if exist "%1.exe" del "%1.exe"

\masm32\bin\link /nologo /subsystem:console  /OPT:NOREF %1.obj
if errorlevel 1 goto theend

%1

:theend


If you're not OK with batch files this might not help you. Anyway, (if you want) copy this into a file "do.bat" and put in your directory. Then, in the cmd window, type "do hello" and it will assemble, link and run your hello sample program. Again, the results stay on the screen.

Get any other sample program, put in your directory, type "do MySample", it will work.

Use the up-arrow key, in the DOS window, to bring back the last-typed line. So, I modify the .asm file using qEditor, then hit up-arrow / Enter to quickly re-compile/link/run. This way I retain a history of what I've done ... and, can modify the batch file to change ml and linker options, link multiple files, etc ... I just find this approach gives more control and is actually quicker.

Your mileage may vary! If you don't want to get involved with this method, at least the ctrl-D trick allows you to run "hello" without inkey.

Good luck, c u later! ..
I am NaN ;)

jj2007

Quote from: radarblue on February 20, 2015, 08:22:45 AM
Q : How do I make the "progam" stay on screen and not disappear in a instant ?

There is rrr314159's way to do it from the commandline, or Dave's proposal to insert an inkey. The latter needs a minor modification, though:
    print chr$("Hey, this actually works.",13,10)
    uselib msvcrt
    inkey chr$("Hey, this actually works.",13,10)

Finally, there is RichMasm, an editor that autodetects if a program is GUI or console mode (and builds the app accordingly); it keeps the console window open in the latter case (unless it detects 'inkey' in the source - in this case it doesn't keep the window open, because it knows that the app will do that).

rrr314159

Wow - RichMasm checks for inkey and behaves accordingly? A minor point, but I have to say, that's impressive; you put a lot of thought into that program!
I am NaN ;)