A glimpse of ASM

It was kind of shocking last Friday when our client didn't approve our project plan. Instead of having a 4 month duration that would involve design, coding and delivery our time was cut down to 1 month(20 days to be exact). I am pretty confident though that we could beat the deadline for even such a short time. It's Saturday, this morning I was researching on how to implement a Connection pool with Tomcat and also I was reading a paper that I printed in the office about how to make your own Connection pool class. This blog entry isn't related to anything I said. I just love to tell things to people that isn't directly related to my point hehehe.

I was up tonight at about 9:00 PM. I was suppose to read about Allegro, a game programming library for C/C++ which I plan to use in my hobby project. C/C++ was also a part of my life even though my work has nothing to do with it and although I have done nothing useful with it. But out of boredom as I was searching/reviewing about C++ file organization or whatever they call it(I was researching on how to separate the .h and .c implementation) I happen to see a link to a assembly x86 tutorial. Now... I haven't touched assembly even once...

Assemly is a language that I can say... A virgin in my eyes. I haven't coded anything assembly in my life before. Yes, I have a book on it which I haven't even flipped a single page from. I am not intimidated by the fact that assembly is a low-level, powerful language that existed even the day I was born... At least it's not J2EE/JEE from which you get confused with the large array of technologies available. There is only one assembly, and yet it's hard for me to start coding in it... I wonder why...

To help me remember that things I've read, I am writing this post.

First of all, I figured that assembly uses a code structure like most language do. For example, in C you have the topmost level to declare the libraries you plan to use, followed by variables and then the main method. There's also  something like that in assembly though a lot of difference may arise, if you've ever coded in your life this shouldn't be a problem.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.model tiny                 ; Tell compiler to build a tiny program model
.stack
.data
msg db "My First ASM PROGRAM!!!! WHOOOO", 13, 10, "$"
.code
START:
mov ax, seg msg ; mov the contents of seg msg into AX register
mov ds, ax ; mov the contents of AX into DS
mov dx, offset msg ; mov the offset of msg into dx
mov ah, 09 ; tell 21h interupt to print msg to screen
int 21h

mov ax, 4c00h ; Exit The Program
int 21h ; Safely
END START

 
Code above was taken from http://www.free2code.net/plugins/articles/read.php?id=154 which I think is a good intro for assembly newbies like me.

It's really a waste of time trying to explain what the program does here when someone else already did. Besides, I'm getting sleepy... If I decide to make something out of what I read today then that will be fun. I just finished downloading TASM and I also got a link for list of interrupts, the only thing left is motivation.
Published 09-23-2006 7:33 AM by lamia
Filed under: ,

Comments

Monday, September 25, 2006 7:12 PM by cvega

# re: A glimpse of ASM

Good, now if you want motivation and would like to start in assembly language, you should forget (for the meantime) about DOS programming and hardware interrupts, and go straight with 32-bit Assembly Programming using Windows APIs.

Download MASM32 from http://www.masm32.com and start with the help folder, you can find ASMINTRO.HLP that is enough for you to get started in 32-bit Assembly Programming on Windows OS. Try it, it's fun and much easier than using hardware interrupts.

Cheers,

-chris