3Nigma's utility site
Home · Articles · News CategoriesSeptember 07 2010 00:28:16
Navigation
Home
Articles
Forum
myBlog[Romanian]
FAQ
News Categories
Contact Me
Links
Search
eniMath - Challlenges
eni - SkyCams
eni - Stamps
Users Online
Guests Online: 2
No Members Online

Registered Members: 27
Newest Member: selba
Friendly links
SkullBox - IT Knowledge Realm
after a while...
eniAsm Ok,it has been a while now since i have posted my last progress,I'm sorry about that[been working on several projects lately,most of them I'll even put on my page - "Migrating to knowledge!",do not forget!],but let me assure you that I've not given up! Oh no...In fact I'm far from giving up,want proof?
Well I can proudly say that I managed to release another version. Yes,you have heard me well...3Nigma proudly presents eniAsm v0_7 .


articles: 103.gif

1.Version details

This version contains many improvements from the other releases in a sens that it is better strucured as I will explain further on in this news,it contains many new instructions,fixed some bugs,and the list continues and I will unfold it as I'll remember the changes[the changes are so many that maybe I'll foget some but please forgive me,I consider I have a rather good motive :P].
What is more better for a project then the outgoing of itself. An ideea is worth living unless it is not fought for. Keep in mind that,as I did,nothing is impossible.

articles: 114.gif
2.What does the archive contain?

The archive that you managed to download[the project itself] consists of 4 directories.Briefly they are:
  • sources v0_7 - sources of eniAsm
    • raw sources - contains only the headers and main body of the project
    • Borland developer project 2005 - working BDS2005 project[I'll come to this in a moment]
  • v0_7 compiled - the binary as compiled with BDS2005
  • eniAsm tests - some tests that show what eniAsm is capable of
  • brief documentation - short documentation about current version
Ok,maybe you're wondering why did I choose to make this program in Borland Developer Studio 2005 and not stick to what I have promissed[Bloodshed c++ or BC++ 5.5]? It's a rather interesting question might I add...the reason for this betrail is,well NONE. I have chosen BDS2005 in favor of the others compilers because it has the original borland c++ syntax compatibility included.
As you may or may not remember,when the first version reached the light of usage for the first time on this page,it was intended for the compilation with BC++ 3.1!Things have moved along since then,I needed a better compiler[in the sens that it can manage programs a little bit better] so I went to Bloodshed dev c++ ,it is a good compiler but it is not fully compatible with Borlands standards[Bloodshed is built with a gcc compiler at it's core] and migrating to this environment although it was possible it was difficult in the sens that v0_5 was allready realeased and many things needed to be watched,so I moved on...
The next choice was a borland compiler[the mighty 5.5] ,it was all good till it got to manage with projects[in fact it has no project management],the IDE that I was using didn't had even a decent "project option" so compiling and debugging was a pain .
Something had to be change but in the perspective of sticking with Borland.So then came along...the all to powerfull BDS2005. I've succesfully ported my project from BC5.5 to this version and let me tell you that it has been a releaf since! Debugging is no longer a pain in the ass,project management is all to well organised with loads of options.
BDS2005 has been a blessing to me and let me say firmly to you that eniAsm will,from this day forward,be intended for compiling with BDS2005!
No more compiler migration,this is finally!

The reason why I added 2 folders in the sources v0_7 main folder is to facilitate project interportability...although it is not much,one folder consists of the BDS2005 eniAsm project and the other folder consists of the minimum sources needed for the project.

articles: 104.gif

3.Where has the project gotten to?

The short answer: v0_7 are you blain or something? :P
The normal answer: a long way!
I don't know which answer is shorter though and I night be corrected on this one :P. Ok,some further explanation is in order.
In the beginning the project consisted of only one file as you saw in the past news :eniAsm_v0.2.cpp,and it's main layout was as simple as the following image shows you:

That's all fine and dandy...but what is the difference between v0_2 and v0_7? Well...let us look at the raw sources contained in the "crude sources" directory[along with some explanations]:
  • eAsm_aditi.h
    • contains functions aditional to the purpose of the assembler
  • eAsm_compiledProgram.h
    • contains directives on making and tying the effective program
  • eAsm_debug.h
    • contains directive on debuging the assembler or assembled sources
  • eAsm_dt.h
    • contains various 'home made' data types that work hand in hand with eAsm_x86Instruction class
  • eAsm_prog_dt.h
    • contains various 'home made' data types that work hand in hand with eAsm_compiledProgram class
  • eAsm_x86Instruction.h
    • class that processes the command and 'spits' out the correct processor encoding
  • eniAsm_main.cpp
    • contains 'main()' that ties all together to make eniAsm possible
  • LICENSE.txt
    • hey! I got to have one,don't I? Don't worry it's realaxed by nature :).
I'll let you compare,in number,the difference between 1 file and 7[the current version number of files].
Why so many files?you ask. These are many??? Larger projects have hundreds of files,but between them and I,there are hords of programmers working eaach at there file,where I am only one.
The number of files is not important,not really. It is not a rule that if you have many files,the your project is more evolved,not really. Splitting a program into many files is helpful in the sens that helps you organise different segments of the project accordingly.A good example is spliting the class files from the 'data type' files. It' much more easy to work on.

You have seen the program layout of v0_2,now,let me show you the program layout of v0_7:


The difference is obvious isn't it?
The new things present are the:
Debug - responsible for debugging the eniAsm assembler and the eniAsm source file. There are 2 states of debugging enabled which are controlled from the "const int isDebugging" variable in "eniAsm_main.cpp" file.
The values that it the variable can have are:
  • 0 - ilustrates that debug is turned off
  • 1 - instruction by instruction debug type. Shows the way of an instruction as it passes through x86Instruction Class Processor
    • example with isDebugging=1 on "ENIEX_V7.EAS"
  • 2 - shows the opcodes of each instruction present in the assembled source and the opcodes present in the output file
    • example with isDebugging=2 on "ENIEX_V7.EAS"

Besides this,the debug module is responsible for debugging the source code .It is not that well evolved in this aspect,put much work will be added to this module in future relases.

compiledProgram - contains routines for handling label related instructions and for making the program,ready to be written to the output file.
It is basically an array of all the opcodes instructions in the source file after they are produced by the x86Instruction class.


On the other hand,remember the 3 instructions supported in v0_2? [move,rets and inter] well...let's see what have I implemented in v0_7:

Command

Implemented as

Parameters

Example

Add

Add

Immediate to register

Add 2 to ax,

Clc

Clearcf

--

Clearcf,

Cld

Cleardf

--

Cleardf,

Cli

Clearif

--

Clearif,

Cmc

Compcf

--

Compcf,

Dec

Decr

Register

Decr ax,

Inc

Incr

Register

Incr ax,

Int

Inter

<interrupt value>

Inter 16,

Loop

Loop

<label> [faza beta]

Loop ciclu,

Mov

Move

Immediate to register

Move ‘2’ to bx,

Mov

Move

Register1 to register2

move

Mov

Move

Register to segment register

Move ah to ds,

Mul

Multip

Register with al,ax,eax

Multip bx,

Nop

Noop

--

Noop,

Not

Not

Register

Not ax,

Popa/popad

Popallr

--

Popallr,

Popf/popfd

Popallf

--

Popallf,

Pusha/pushad

Pushallr

--

Pushallr,

Pushf/pushfd

Pushallf

--

Pushallf

Ret

Rets

--

Rets,

Stc

Setcf

--

Setcf,

Std

Setdf

--

Setdf,

Sti

Setif

--

Setif,

Wait

Wait

--

Wait,

Xchg

Exchange

Register1 to register2

Exchange cx to bx,


What do you think of this? I know it is a bit too short for an assembler but you have to admit that it is a start.Knowing these instructions lets us make some interesting usage of them as the next section shows:

articles: 141.gif


4.The examples

If you may or may have noticed...one of the folders within the archive is "eniAsm tests".This folder contains some tests that I've put together to implement some of the new features.
All of these examples have already been built and their binary bare the same name as the source files[only ending in .com to make it executable]
Let me remaind you that,for now,the .com format is the only format that let's you execute the program under windows OS. It is a crude and raw binary file that let's you execute,upon running,any instructions written in it.
Let's take a closer look on these examples.



4.1 "hello eniasm!"

It is example "ENIEX_V6.EAS" and it's source code is:

*program that 'meets the world!'
*prints 'hello eniasm!'
*assembled in eniasm v0_7
move 0 to bh,
move 14 to ah,

move 'h' to al,
inter 16,
move 'e' to al,
inter 16,
move 'l' to al,
inter 16,
move 'l' to al,
inter 16,
move 'o' to al,
inter 16,
move ' ' to al,
inter 16,
move 'e' to al,
inter 16,
move 'n' to al,
inter 16,
move 'i' to al,
inter 16,
move 'a' to al,
inter 16,
move 's' to al,
inter 16,
move 'm' to al,
inter 16,
move '!' to al,
inter 16,

move 0 to ah,
inter 22,

rets,

Remember when I've told you that among future examples,maybe Ill include a classical "hellow world!" example? Well I have lied...it's eniAsm we're talking here...why not make it "hello eniasm!"? Well...been there,done that.How?
The code uses the teletype (int 16 ah=14 al=char) and puts all the individual characters on the screen and then it uses a "wait for keyboard press" instruction before exiting.
Upon running it's assembled version,you will see something like this:

Simple,yet elegant.



4.2 loop sequence in the house

It is example "ENIEX_V7.EAS" and it's source code is:

*program that highlights the usage of loop instruction[beta testing]
*prints "eniasm eniasm eniasm eniasm eniasm"
*assembled with eniasm v0_7
move 0 to bh,
move 14 to ah,
move 5 to cx,

ciclu:
move 'e' to al,
inter 16,
move 'n' to al,
inter 16,
move 'i' to al,
inter 16,
move 'a' to al,
inter 16,
move 's' to al,
inter 16,
move 'm' to al,
inter 16,
move ' ' to al,
inter 16,
loop ciclu,

move 0 to ah,
inter 22,
rets,


The main purpose of this small program is to test the loop sequence.
Upon running you will get a screen similar to:

'Loop' instruction is in beta testing and some errors may occur.



4.3 Increment it

It is example "ENIEX_V8.EAS" and it's source code is:

*program that highlights the usage of 'incr' along with loop sequence[beta testing]
*prints all characters from 0 to 255[ascii form]
*assembled in eniAsm v0_7
move 0 to bh,
move 14 to ah,
move 255 to cx,
move 0 to dl, *register that holds the printing character[ascii form]

ciclu:
move dl to al,
inter 16,
move ' ' to al,
inter 16,
incr dl, *increment register value for next character
loop ciclu,

move 0 to ah,
inter 22,
rets,

This example,as its header states,shows the use of increment instruction along with the loop instruction to print out all the characters of the ascii form as shown:




4.3 add it while it's digit

It is example "ENIEX_V9.EAS" and it's source code is:

*program that highlights the usage of 'add' along with the loop instruction[testing stage]
*prints the even digits
*assembled with eniasm v0_7
move 0 to bh,
move 14 to ah,
move 5 to cx,
move 48 to dl, *register that holds the output character

ciclu:
move dl to al,
inter 16,
move ' ' to al,
inter 16,
add 2 to dl, *increment the register for next output
loop ciclu,

move 0 to ah,
inter 22,
rets,

Program that shows the use of add instruction along with a loop sequences. Basically it prints out the even digits by incrementing the ascii code from 0[ascii-48] to 8[ascii-56].
And here is an output:


articles: 142.gif

5. In the end

Well that's all about this version. We are gathering momentum on this project.
What does the future hold,you might ask?
More instructions and a completed debug directives,that's all I can think at the moment [I am a little tired].
If you can contribute in any way to the project,please let me know and we'll see what we can do.

Till next time,take care...and stay tunned ;)
Any questions/suggestions/whatever at all…post them here.
(c)3Nigma 10April 2008

3Nigma on April 10 2008 21:30:49 0 Comments · 895 Reads · Print
Comments
No Comments have been Posted.
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Shoutbox
You must login to post a message.

No messages have been posted.
Copyright "3Nigma's brain"© 2008