News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Assembler Enhancement Initiative

Started by Serj, July 26, 2007, 09:18:44 AM

Previous topic - Next topic

Serj

...Well Tedd, I Dont Like When people who dont know me closely try to treat me like a child!!! If you guess about something I haven't told about yet, ask before typing dozens of lines! It's all my emotions, sorry. but I really don't appreciate such treatment.

So, specially for you:
1) I was using assembler for all recent years and I preffer it to HLLs. (I just want to kill you (not right now!!!)))) when you say I dont think like asssembler programmer)
2) Errors in my macrolibrary are really caused with bugs in MASM's preprocessor. I've done some dumping to figure it out and I don't want to listen that I dont know MASM's macro language quite well. I can almost speak it!!))
3) The scenario you described IS JUST YOUR OWN POINT OF VEIW. NOT MINE. Almost everything you described is NOT among my ideas!

So, thats enough for emotions))

1. Type checking
   I think that type casting that causes implicit code insertion or modification is just HLLs' business. Let them do it, DONT even pronouce a sound about it when talking about assembler!! When I say 'type checking' or 'casting' I mean mechanisms that make it possible not just to tell assembler about variable's SIZE but to provide it some additional information about what data structure a variable points to, how many arguments a procedure takes (you DO use invoke syntax) and so on. When asembler knows about it it can make a hit (not issuing an error message and stopping compilation process) at the fact the pointer you provide in a call points to some structure that is not quite big so it can prevent errors when data is erased or your program tries to access memory that was not allocated. And so on.
2. Classes. Well, I consider all today's OOP no more than SHIT. And I don't wanna hear about it any more!!! I suggest using nested procedures I the way I mentioned above. Procedure's prologue in my macrolibrary creates a new namespace so you shouldn't warry about name conflicts any more. Procedure's epilogue closes the namespace. You can use some procedures just to group some others into a container, 'caz procedures may be
empty (not contain their own code) and have many subprocedures. Nesting is unlimited (dont even tell me about local variables!!)
3. I wanna say it loud that I dont want to bring HLLs' features into assembler as they are. I'm against using syntax like a=b*c. I'm not against expressions like this eax=911, 'caz it's just another form of mov eax,911 but nevertheless I don't like such syntax. I'm for common assembler expressions when command's name goes first with a tail of comma-separated arguments appended to it.
...Assembler provides us unlimited freedom. I don't wanna lose it. Please, everybody, next time you want to say I'm gonna introduce constructions that generate uncontrollable code or generate errors where it's ok in MASM, think twise or better ask me before.

hutch--, I've considered closely every feature you mentioned, I'm using masm32 v9 since in was released. Before it I used preivious version. Long ago I used to develope DOS applications in MASM 5.10. When you say
Quoteyou will probably get a cool response from anyone who has escaped from this trash and can write assembler code where they want to.
I dont get you. I think I said it in plain English that assembler must provide features that will make it possible to write pure code when you want to write exactly puse assembler code and use HL constructions when you want to save your time but without loosing control or the like.

Well, guys no offends of course, but get me right, I almost thrown my monitior away through the window when I read everithing you wrote here!!)))))

Vortex

Hi Serj,

Take it easy, Tedd or any other member will not treat you in an other way. Masm forum is a place with mature members and we are here like a family. Nobody would like to hurt you.

eax=911 is a statement accepted in the C-- language, Sphinx C-- is a mixture of asm and C :

http://c--sphinx.narod.ru/indexe.htm

I guess Randall Hyde's HLA is what are you looking for. It has a very powerfull macro engine, more even powerfull than Masm. HLA accepts nested function parameters like HLLs. Why you don't give a try?

hutch--

Serj,

What you run into here is just a few of many hundreds of people who float around this forum who have heard probably every flavour of HLL based criticism of how and why there is something wrong with assembler that needs to be fixed (IE made into a HLL). Given that the vast majority of programmers floating around here are fluent in at least a number of programming languages as well as various forms of scripting, thy all write assembler when they need it for very good, well informed reasons.

A long time ago when I first laid out MASM32 as a project and this is after a background of years of commercial assembler programming in the DOS market I went out of my way to avoid making assembler programming as a subset of HLL programming. By treating assembler as a language in its own right its real strengths could be capitalised upon without the limitations and irritations of various HLLs and the body of folklore built up around them.

Data types based on "how big" they are instead of some phony name based on multi-port theory, pointers that are known from their documentation so that every pointer in win32 is the same size, 32 bit. No guessing what a range of phony data types were based on the theory of portability and native processor WORD size.

Its not that anyone is trying to take the fun out of programming for you but if anyone inflicted limitations of the ty[pe you have in mind on them theywould throw their monitors (at least the old CRT type) at you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

anunitu

Almost sounds like you might be looking for something like FORTH, a somewhat HLL, that is very low level. A contradiction? Perhaps, perhaps not. Do a search, and check it out.


Anunitu

GregL

Serj,

Well, let's see a bit of what you have in mind.


Betov

Serj wrote:

"... almost impossible to develope large serious projects using assembler..."

In this matter, opinions are nothing. Only fact matters, and one fact that one maight consider is that RosAsm, which has been developped with this target in mind, is actually a monolithic Assembly Source, 4 Megas long. So, it proves, by itself, two things:

* Large Sources are very possible, in Assembly.

* Large Assembly Sources can be developped collectively.

It also makes a demonstration (by the minimalist number of RosAsm users) of the fact that, 99% of the programmers, who introduce themselves as Assembly programmers are, in fact, HLLers, making occasional use of Assembly, and that they will never consider writting anything real in Assembly.


Betov.

< http://rosasm.org >





Serj

Well, either RosAsm or C-- are just another compilers with their own features and look at compilation process. But if I was searching for such tools there'd be no need for me to write another assembler. There is considerable amount of assemblers that are quite flexible and extensible. But as Tedd wrote (sorry, guy, if i hurted you))) the more HL features they introduce the more control they lose. I wanna quite another level of control. I like assembler 'caz (you will probably disagree) it's declarative i.e. when coding in assembler I'm just describing some data structure that will be called a program as it is. I'm just describing. Almost full control. But there are still some limitations. Assembler sources are mostly 'flat' - I mean there are some procedures, some variables put side by side on the same nesting level. I'm also a web-developer, so I get used describe what iI write far more carefully. When I say I need HL features I also mean I need some means for better describing and structuring of my code.

Let's say a program is just a chunk of data (if it makes a confusion you may think that OS's loader treats a program like other data file - it loads it, places some parts at certain addresses and so on). Let's also say we only deal with data chunks when building a program. So, every such chunk has three main characteristics: size, offset from the begining of parent chunk (an absolute one or calculated using alignment value). There can also exist some other characteristics like maximum chunk size, alignment of its sub-chunks etc. So, as I treat assembler as a declarative language I want it to provide easy means to 'mark up' my code. Using all existing assemblers you can only write 'this is a dword variable inside .data segment' or 'this is a procedure that contain tree commands each 2 bytes long' and the like. But I need more. I want to be able to express such phrases like 'this is a set of variables, located inside another one that starts at address 80h from the beging of .data segment. It contains two dwords located at its beginig and one byte at offset 12 from it'. I think its very very important to have absolute control of your code, to be able to describe it entirely or in other words to set all its layout attributes. You may say assembler is already possible to, but you are wrong then (what about nesting of code, what about structuring at all?). I invented a syntax for describing data structures more carefully. I dont consider MASM's types enough descriptive, 'caz they just say what size varible is but no more. Naming types with arbitary (i mean not based on their size) names is common practice. I guess you wont chose a name like '32dwords' or '128bytes' for a structure that's 32 dwords long)) We all get used to see names like 'dword' or 'byte' in variable declarations but it doesnt mean we cannot use another names. So, here's  my syntax. I lay it out for you JUST to think what kind of control i have in mind. I use some type names that you may hate but honistly I prefer them to traditional ones 'caz they tell about variable's size in a more native manner.

object - directive for describing a piece of code that can communicate with others tru call-ret mechanism. Example

object myObj(int32 par1, int32 par2):default at 80h maxsize 128
   .... ; some code goes heree
endobj myObj

With this I tell approximately this 'this is a piece of code that is also the antry point of a program, its maximum size is 128 bytes, it's located at offset 80h from the begining of .code segment and when you call it you should put two integer 32-bit variables onto the stack'

varset - directive for describin' data structures. Example

varset i_hate_bush:bss   ; a set of variables named i_hate_bush
   int32 i   ; 32-bit variable named as 'i'
   int8 hate
   int32 bush at :4  ; dword 'bush' with 4-byte alignment relative to the begining of i_hate_bush variable set
   varset at :32 ; unnamed varset at offset multiple of 32 bytes
     int8 myStr "And what about you?#0" ; a null-terminated string
     int8 str1 "Ah??#0"
     int8 font "Tahoma" maxsize 16 ; a 16-byte string buffer
     varset myStruct:struct ; structure declaration. 'Structure' mean here a template you can use for rapid declaring of large data structures.
        int32 x 15 ; if initial value isl not supplied when instantiatin' 15 will be used instead
        int32 y 16
     endset myStruct
   endset
endset i_hate_bush

There some other smart ones but I think that enough for this time.

What is about compilation process I dont share all today's approaches. Most assemblers just translate soucre to binary code and then probably fix it.
I think that its quite out-of-date. I think its far more smart to buid a tree instead. Its nodes would present separete data chunks and due to perferct structuring abilities they can also store all the info about node nesting. This is exactly what I ment when was talking about namespaces (each node can be named at all chunk's attributes can be attached to it). When holding such a tree in the memomy it's so easy to resolve any reference and fix opcodes. So, when you have a program tree you can easily translate it into any arbitary file format - pe, bin or any other.

I also introduce 'chain typing' if its possible to say so. Imagine you are going to store in a dword variable a pointer to a COM object

ppIActiveScript dd ?

When you want to call a method within that object you should either do it as it requires to or use some macros. So, to call a method you should do something like this

...;push here all the arguments
mov eax,ppIActiveScript
push eax
mov eax,[eax]
call (IActiveScript ptr [eax]).<method_name>  ; Let IActiveScript be a MASM structure that describes the interface

To declare ppIActiveScript to make calls easily I suggest describe pointers in this way

int32*int32*IActiveScript ppIActiveScript

You should read it as 'a 32-bit variable that contains address of another one that contains addr. of IActiveScript structure'. Here IActiveScript is a structure (template) that lets assembler know that it only contains pointers to procedures.
Then you can call a method in a quite easy way

ppIActiveScript.<method_member>(this,....parameter list)  ; 'this' is placeholder for ppIActiveScript

I think it's far more transparent way then that introduced in masm32 package. I should also note that when you use ppIActiveScript you are working with IActiveScript structure. To make it possible to work with the pointer I use root sign '^', so I call int32 a root type and IActiveScript a target type. It may seem to be very complex or too 'high-level', so just forget about it)) I dont insist on this technigue though I find quite convenient.


..I'm not willing to create just another assembler 'caz I'd better sit and code in MASM or NASM or FASM or the like. I hope you wont tell me that structured coding is a bad manner otherwise I will think bad about you)). I dream of a tool that will make it possible to describe any structures of any compexity. So HL features (note that I dont type 'HLL'. HL stands for 'High Level' here) are perfect way to introduce structuring without any loss of control.

ramguru

Your syntax tends to eliminate use of asm instructions, how the hell I know I'm still using an assembler, when I look at Visual_Basic-like code, what Intel Manuals will be for?

zooba

I suggest reading about the STRUCT statement in MASM. It does exactly what you describe. You could also read about the UNION statement, which will let you overlap two variables. You can specify default initialisers for structure members, but they are only used in situations that don't require any code generation.

TYPEDEF will let you rename the built-in types to whatever name you like.

Apologies in advance if producing your unnecessarily complex results requires more thinking than in your scenario, but that is the realm of assembly language programming. The requirement to be fully aware of the abilities of your tools and how to use them to achieve your aim is what we enjoy about it.

Cheers,

Zooba :U

Betov

Serj wrote:

"Well, either RosAsm or C-- are just another compilers with their own features and look at compilation process. But if I was searching for such tools there'd be no need for me to write another assembler".

I was not telling you that RosAsm is the tool you mean to write (it is much evidently not). I was talking about the intention of developping an Assembler for writting real Applications, in real Assembly - which, by the way, would never be achieved by what you are thinking about, but this is another story... -.

What i was just saying is that RosAsm has entirely been developped with that goal in mind, and that its existence is the direct demonstration of the fact that this is doable, and viable.

Now, the problem is, that you would have to face, admitting you would be right, and admiting your project would go somewhere, the fact that you would get, - leet's be optimistic - 10 times less users that RosAsm, because there does simply not exist Programmers who would consider developping Applications in full Assembly. Now, think of this:

10 Times less users than RosAsm, this make about... 1 user: Yourself. :P


Betov.

< http://rosasm.org >


TNick

Men, you're killing him here! :)
No, really, Serj, why don't you write some code so that we can understand you better (for this project, I mean).

Nick

Serj

ramguru, there's no great tend to eliminate assembly instructions, I just use HLLs' approach for declaring variables. It makes possible to declare several variables per line. And well it may look like VB, but if you look better you will find some similarity with XML. but I did mentioned I laid it out JUST to show what I mean when talk about structured programming. Generally, I chose this sysntax 'caz its very expressive, what I can't say about assembler's syntax. And dont think I'm gonna replace common semantics for opcodes. They are saint for every assembly developer.

zooba, d'you think I'm so silly that I've never read about STRUCT statement? It's just funny)) But there's a difference you dont see at all: when using STRUCT you should define a structure and then instatiate it but when using my syntax you describe data as it is in place where it lies. Well, I think it's not pleasant to define MASM structures every time you just want to describe structure of some piece of data that doesnt seem to appear at any other place in your code again. What about TYPEDEF, you are absolutely right but read the two first lines of this post again, please. Now I think you see why I dont' use TYPEDEF.

QuoteI was talking about the intention of developping an Assembler for writting real Applications, in real Assembly - which, by the way, would never be achieved by what you are thinking about, but this is another story... -.
--... Sure?? I think you just advertice your project and dont wanna understand what I'm talking about.

TNick, what code d'you want to see exactly? I can lay out several sources and show my approach in action. ...But well, excuse my, it's about time so I should go. I'll write more the next time. Just wait. At last I want to say this: when using most HLLs or some mixtures of HLL and assembler you're just afraid to write what you want where you want (I mean declaring a variable outside a class or method and so on). It's not about my ideas. I say you should write what you want where you want. But if you choose to use some HL constructions you should follow some easy rules they require. Anyway if you know perfectly what they do (what code they generate or they may not generate it at all) you can do absolutely everything.

Note: almost all assemblers require typing some code (mostly directives) before even an empty program can be built. NASM treats absolutely empty sources as full-fleged ones and you use directives and anything else only if you deside you need it. Isn't that beautifull. And another thought. In early versions of NASM they used macros to generate PEs so you just compile your exe like a binary file and macros do all needed work for you. Today there's almost no assembler that wiil allow you to fully describe your programs. You will probably want to let them do some work behind the scenes but I think it's better to have an ability to control final layout generation.

hutch--

Serj,

Its not that the people around here want to spoil your fun or even a task of the size you have in mind, its just the value judgement system that goes with it about what is virtuous in a computer language and what is not will find very many detractors in a forum like this one.

I personally characterise OOP as OOP(S)[another mistake] and prefer another definition borrowed from a friend of mine, HOP = Hardware Oriented Programming, write things that agree with the processor to make it small and fast. Abstraction belongs in "Alice in Wonderland" and objects are nothing new, we have all been writing them for years in procedural programming.

Hardware in x86 produces traditional procedural programming from the inbuilt CALL / RET nature of branching and alternatives to procedural programming in x86 have to add padding to the is basic hardware capacity to produce the level of abstraction that many in HLLs want.

What offends a vast number of assembler programmers when they want low level capacity is the notion that they don't have access to the bare bones of assembler programming when they want it in anything else but an assembler. The other thing you will find is a highly ingrained independent streak in assembler programmers which is very hard to bypass on the alter of new and inovative ideas.

Most want a capacity that is reliable and accessible where they can write any damned thing they like without a second hand set of asumptions inflicted by a software author on them.

My generation actually LIKE code written like an assembler dump and have in the past written a lot of code that way. The general change has been to ensure that assembler programming can and will be understood by the next generation.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Serj

hutch--, I've been thinking a lot about what makes assembler special, what are its pros and cons. And, yeah, I agree with you at many points. I'm not against what you call 'code written like an assambler dump'. I just wanna add some means for structured programming to go side by side with old-style code. 'Flat' style coding is mostly applicable for development of small programms. And its exactly what you mostly deal with as I see. But I think assembler has too pure abilities to describe big and complex programs. Writing something complex code 'like an assembler dump' looks like trying to write a document that contains pictures, nested lists and so on without any markup. But even when trying to write a small reusable component that majority of advanced programs consist of you often need some more than common assemblers can offer 'cause the component's structure may appear to be very complex. I guess strutured programming is just another way of thinking. When you try to put your brilliant idea to some code you try to describe its 'structure' step by step, figuring out what you really have in mind. It's the point you start thinking in a 'structured' way even not realising it.

Well, may be it's difference in ages that makes it so difficult for us to come in terms but I want you to see that I'm just trying to bring assembler to the next level, to make it a tool not just for elite. Almost anyone here knows that only a small precent of all programmers use assembler as a stand-alone full-fledged development tool. I want to break this rule that assembler is often considered too complex to be worth learnig. The more time pass the more assembler shifts to a tool just for underground developres, hackers and so on. Why not to make it possible to develope assmbly products more easily. Of course I see that today there are very few people that would like to start using assembler the way we do but I think if we make it more structural it will become more understandible thus more popular.
And there's another pain. The more 'advanced' products M$ realeases the more these products lose in quality, speed and robustness. And it's not about M$ only. But today there's no power that will make people think more before the start coding. Assembler teaches us to but it's really too complex today. I dont wanna say it's complex for me, but I've never met a man of my age (I real life I mean) that would use assembler (no matter standalone or built-in), most of them dont even know what it is at all or are frightened with its complexity. Lasy creatures))).. I'm sure assembler needs encancements. If you dont agree, it just means you 're satisfied with it's today's abilities. But what about those who want more... I need a tool that will make it possible to build programs easily but without loss of control and the like. There's no such a tool today, so this is why I started this topic, why I spend time explaining you my ideas. The world shifts to structured describin' of everything and programming is not an exception. So, why not to bring it into assembler?? Please tell me.
I will appreciate it very much if you tell me what features d'you want assembler to provide, 'caz as I see it's no more than a habit to code in well-known old style that is the real reason of your criticism

Serj

I think, guys you will understand me better if you keep in mind that HL constructions I use are more just markup than something that generates uncontrolable code. My 'object' and 'return' generate code in exactly the same way 'proc' and 'ret' do. I dont insist upon the names I used for my syntax, it's not significant. I just wanted to show what structured coding may look like. So, give it a thought one more time. Nobody's gonna steal your dwords)) Of course you can keep on coding the way you get used to and use tools of yor choice. But before you write the next line of code, please think just a bit about the other way of coding and may be about the future of assembly programming...