News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Trying to learn Assembly

Started by mamoon.xilix, August 05, 2017, 01:38:14 PM

Previous topic - Next topic

mamoon.xilix

Hello guys, hope u are all having a good day.
My goal is to learn Assembly language programming for 32 bit processor.
I m making a compiler. I have already created a parser for it. Now i want to convert source language (which is being parsed) into 32 bit assembly language.
Where i am having a problem ?
I dont wanna learn like invoke calls to system libraries, I wanna learn basic Assembly language with movs and ints.
Masm32 has different syntax and other assemblers also have different syntax. I am too confused. Assembler provided by microsoft (ml.exe) always crashes at int 21h.
Please guide me. I know this is a bad written question and i also hope u got the point.
Thank you

felipe

Welcome to the forum!   :icon14:
int 21h is an old dos "call" to the most typical functions provided by dos, so is not for windows.
Your project seems to be a big thing, but seems like you are trying to learn assembly from scratch, just from now.
So, if you want to do it i guess is good for you.  :bgrin: But you have to be patient, it can't be done like a magic act. Take your time with it. Maybe you want to keep runing other projects at the same time, that's ok, i guess. But be constant and patient and you will get it. As hutch said sometime: "Don't take shortcuts". (or something like that)  :icon_mrgreen:.

I highly recommend you this forum and the masm32 sdk package. And don't be afraid of the high level facilities it provides. They are part of the understanding you will need to learn assembly, oh yeah!  :lol:

mamoon.xilix

Thank you man, for a very nice reply. I was too afraid i might get a roasting as my question too noob.
I am ready to give my time to learning, even if it takes a year. I dont mind.
Can you please guide to a good tutorial site that will guide me through. I checked Icezilon's (Sorry if the name is wrong) tutorials and Lena's reverse engineering. But they are not telling to learn from the start. If u please guide me.
Thank you so much.

jj2007

Quote from: mamoon.xilix on August 05, 2017, 01:38:14 PMI have already created a parser for it.

That sounds very interesting! Can you zip the source and post it here?

hutch--

mamoon,

Spend the time getting the swing of protected mode Windows programming. Instead of DOS-BIOS interrupts, you have API calls and they are far more powerful that the old DOS real mode architecture. The memory addressing scheme in 16 bit real mode DOS cannot be used as Windows 32 and 64 bit use what is called a flat memory model, DOS use a "segment : offset" memory model that is not compatible with the later architecture.

> I was too afraid i might get a roasting as my question too noob

Don't worry about this, no-one gets roasted in here and if anyone tries it, we boot them out.

mamoon.xilix

> That sounds very interesting! Can you zip the source and post it here?
Bro, i dont wanna sound mean or something but u dont really wanna see the source code, u will laugh like never before. Too much memory leaks plus some ideas that i wanna keep to myself (for a certain time). Please dont mind.

mamoon.xilix

Thanks @admin for a really nice and great gesture.
One more quick question if you dont mind.
Where can i find a binary for system calls, like for example, print a message on screen require
invoke StdOut,addr message ; supposing message is the variable where the String is stored

Where can i find the binary or code behind StdOut function ?

hutch--

You will find the entire MASM32 library with full source in the subdirectory "m32lib".

mamoon.xilix

Thank you guys, you all are great.

Vortex

Hi,

You can also use the C run-time function printf :

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\msvcrt.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\msvcrt.lib

.data

string      db 'Hello world!',0

.code

start:

    invoke  crt_printf,ADDR string

    invoke  ExitProcess,0

END start

Mikl__

Hi, mamoon.xilix!
Assembly language programming for 8/16/32-bits processor remained in the last century. It is necessary to learn the assembler for 64 or 128 bits systems. DOS and programming for int 21h died in the 90s of last century. hutch-- is right 
Quoteyou have API calls and they are far more powerful that the old DOS real mode architecture