Hi there, sorry if this is the wrong category, I found it quite hard to locate a category that is best suited, I was recommended to check this forum out as I hear it has many great assembly coders.
Over the past year i have been working on a programming language (on and off) - Currently the language is semi low/high level language, alot of asm syntax, however many higher level code, the idea is to build a objective assembly alike language, it current has support for many features and it grows by the day, If anyone is interested in checking it out it would be great to hear some opinions since it is a language i am building to increase popularity of programming in ASM.
A small sample of the syntax
ZPtrList myIntList;
myIntList = new ZPtrList;
edi = myIntList as ZPtrList;
for (ecx = 1 to 1000) {
edi.AddPointer(ecx);
}
edi.DeleteIndex(996);
for (ecx = 0 to 998) {
eax = edi.GetDataByIndex(ecx);
printd(eax);
}
edi.Deinit();
delete myIntList;
a few of the features listed:
Class support - OOP (Object Orientated Programming).
Extendable using inline function and procedure macro system.
Supports already alot of opcodes. Many things have been simplified such as assignment. e.g.
mov eax, ecx
eax = ecx;
xor ecx, ecx
ecx = xor;
push 0
call ExitProcess
ExitProcess(0);
and so on, i will not go further into detail since this is a MASM forum, however bare in mind some of my ideas have came from the MASM assembler. The website of the language is @ http://www.codeziron.com for anyone interested in providing ideas and feedback.
-OverHertz
welcome to the forum :U
you might be interested in Jochen's "MasmBasic"
http://www.masm32.com/board/index.php?topic=12460.0
hi thanks for the welcome :) - Ii will take a look at MasmBasic for further ideas.
just to add onto my first post....i have stated ziron as a compiler, however in reality it is an assembler with high level functionality, such as block statements like if, while, repeat and so on.
I wanted also to ask the opinion of an ASM community, does anyone think it is a good/bad idea to have plug-in support for the compiler/assembler. i.e. to output custom file formats, to add extra functionality to the compiler/assembler and so on?
Thanks,
there are many such formats already defined for other IDE's
i think it would be best if you could use the ones that are out there
take a look at a few IDE's, editors, and debuggers to get some ideas
not sure what you mean by "many such formats already defined"
Ziron already has its own syntax, already usable to create applications etc, has built in assembler, linker etc
well - there are DEF files, DBG files, and so on
Looks interesting, have to download and play around with it. Could be an option to add it as a supported language in RadASM.
Quote from: OverHertz on September 20, 2011, 03:55:08 PMI wanted also to ask the opinion of an ASM community, does anyone think it is a good/bad idea to have plug-in support for the compiler/assembler. i.e. to output custom file formats, to add extra functionality to the compiler/assembler and so on?
If the interface is well-conceived, it would make your compiler very powerfull.
qWord
Quote from: fearless on September 21, 2011, 09:03:49 AM
Looks interesting, have to download and play around with it. Could be an option to add it as a supported language in RadASM.
that would be good idea.
Quote from: qWord on September 21, 2011, 10:19:40 AM
If the interface is well-conceived, it would make your compiler very powerfull.
originally i started working on an editor, which i will again in time, specially for the language, however anytime i spend on this project is specifically on the compiler/assembler (just a console app)
I also still have alot of documentation to write, i have only wrote very little, need to add write how to insert resources, using classes, structs, and many other things (some of the things already have samples, but only in the forum - at some point i will get round to it.
Thanks for the interest.
-OverHertz
Interesting.
Is it written in asm, or HLL?
BTW, I see the source code is not available. Will it be available sometime in the future?
Hi TmX it is written in a high level lang (alot of inline tasm), i plan to rewrite parts of into Ziron once i believe the language is fully ready... the reason i wrote in a HLL is for a quick prototype and faster additions to the feature-set.
in regards to the source, i have not yet decided that yet, in the future once there is a larger community i may consider that further :)
Hi OverHertz,
Does your compiler create MS COFF object modules?
it can output pe-coff (exe or dll), both gui or cui - no object support (yet - it could/would be possible for someone to implement coff obj file output via a plugin)
Quote from: OverHertz on September 20, 2011, 03:55:08 PM
hi thanks for the welcome :) - Ii will take a look at MasmBasic for further ideas.
Hi OverHertz,
It seems Ziron is very close to C, as your example (http://www.codeziron.com/forum.php?page=topic&id=31) shows:
function getFileExt(char* path) {
eax = path;
ecx = xor;
while (char[eax] != 0) {
if (char[eax] == ".") {
ecx = eax;
}
eax++;
}
if (ecx) {
eax = ecx;
eax++;
}
}
The same in MasmBasic would look like this (a complete Win32 console app, by the way :bg):
include \masm32\MasmBasic\MasmBasic.inc ; download (http://www.masm32.com/board/index.php?topic=12460)
Init
Let esi="This is a filename.jpg.txt"
Inkey Mid$(esi, Rinstr(esi,".")+1)
Exit
end start
Output:
txtUnder the hood, MasmBasic is simply a library. Code assembles with Masm or JWasm and can be freely mixed with the Masm32 package and other libraries.
I understand that Ziron is a compiler. How do you handle assembler instructions? You pass them 1:1 to Masm? Can you use Masm32 macros in Ziron code?
Welcome to the Forum,
Jochen
Ziron is not just a compiler, under the hood, Ziron is an assembler itself, it does not rely on other assemblers and so on, it literally assemblers the instructions itself. It also has its own linker. So actually in comparison to MasmBasic, it would be possible to put a set of libraries together that will do just the same without the complexity :)
function getFileExt(char* path) - this would be like a MasmBasic library function just it is exposed since it is assembled by Ziron and no masm is in no way related to Ziron, as before it is a whole new assembler/language, however i have implemented a basic macro system via the inline keyword, if you check the include folder there is samples of macros.
so to compare that sample from MasmBasic you posted, a whole program build with Ziron to do what you have wrote >
program WIN32CUI 'Sample';
#include 'console.zir';
#include 'zirutils.zir';
eax = getFileExt('This is a filename.jpg.txt');
//output to console
println(eax);
ExitProcess(0);
the language i have build up from suggestions from friends and personal preference, the language of course resembles assembly, c and pascal with bits of uniqness in there too.
and thanks for the welcome :)
What kind of mathematically support are you planning to add: FPU, SSEx ?
FPU programming is sometimes really annoying - a strong expression evaluator would be a great thing :U
currently FPU support is a minimum, but i plan to add everything i can, any opcode someone wants, i most likely will add it, and i plan to write an evaluator, i did but i didnt like it so i scrapped it until i finish correcting other problems :)
just to note my previous post i cheated, since i did not have an inkey macro, so i checked and see inkey calls a wait_key proc so i've put together a wait_key procedure just to make the evaluation correct.
procedure wait_key(char* text) {
if (text == 0) {
println('Press any key to continue');
} else {
println(text);
}
DWord mode;
FlushConsoleInputBuffer(hStdIn);
GetConsoleMode(hStdIn, @mode);
SetConsoleMode(hStdIn, 0);
WaitForSingleObject(hStdIn, 0xFFFFFFFF);
SetConsoleMode(hStdIn, mode);
}
it does not look nice, but anyways this can be added to library function and then i will change the code to:
program WIN32CUI 'Sample';
#include 'ziron32.zir';
#include 'console.zir';
#include 'zirutils.zir';
eax = getFileExt('This is a filename.jpg.txt');
wait_key(eax);
ExitProcess(0);
actually it should be
wait_key(getFileExt('This is a filename.jpg.txt'));
but i have a bug to fix it seems :)
Edit: Corrected bug
Quote from: OverHertz on September 21, 2011, 08:13:31 PM
wait_key(getFileExt('This is a filename.jpg.txt'));
but i have a bug to fix it seems :)
The MasmBasic equivalent would be more like
include \masm32\MasmBasic\MasmBasic.inc
include SomeOfMyToys.inc
Init
Inkey "The extension is ", getFileExt('This is a filename.jpg.txt')
Exit
end start
I once analysed one big source of >600k of Organically Grown Code
TM written in an old Basic dialect with some 600 or so commands. It turned out that I had used only 100 of the 600 commands, and 90% of them only once or twice. Therefore my logic is "provide the 100 most important BASIC functions (http://www.masm32.com/board/index.php?topic=12460) but make sure the user can add the missing bits in standard assembler syntax". The result is assembler (pure Microsoft Macro Assembler aka MASM) with
inline Basic...
Nowadays a proper HLL has thousands of commands and functions, and getFileExt might well be one of them. The downside is you are stuck with those few thousands. Masm (or JWasm) has no such limitations. Everything is possible, at the highest physically feasible speed. MasmBasic is pretty fast, it's often SSE2, but if you need to get millions of file extensions in an innermost loop, here you go: Masm and JWasm understand SSE4, just add your tailored SpeedyGetFileExt to SomeOfMyToys.inc...
My 2 cts :thumbu
Ziron also does not have limitations, hence things like getFileExt is not built into the assembler, the programmer can write in pure assembly also.
compare
procedure strLunarize(char* str) {
push esi
mov esi, str
mov edx, esi
@chkupper:
lodsb
al = or;
je @exit;
cmp al, 'A'
jb @chklower;
cmp al, 'Z'
ja @chklower;
cmp al, 'S'
jnz @else1;
mov al, 'z'
@else1:
add al, 0x20
mov [esi-1], al
@chklower:
lodsb
al = or;
je @exit;
cmp al, 'a'
jb @chkupper;
cmp al, 'z'
ja @chkupper;
cmp al, 's'
jnz @else2
mov al, 'Z'
@else2:
sub al, 0x20;
mov [esi-1], al
jmp @chkupper;
@exit:
pop esi
ret
}
with
procedure strLunarize(char* str) {
uses esi;
esi = str;
edx = esi;
repeat {
lodsb
if (al == 0) break;
if ((al => 'A') and (al <= 'Z')) {
if (al == 'S')
al = ord('z');
else
add al, 0x20;
[esi-1] = al;
}
lodsb
if (al == 0) break;
if ((al => 'a') and (al <= 'z')) {
if (al == 's')
al = ord('Z');
else
sub al, 0x20;
[esi-1] = al;
}
};
}
Ziron has the same concept as MASM only it aims to be more powerful, also whilst providing low level assembly ability and high level syntax :)
so unfortunately I fail to see your point...the big difference with MasmBasic and Ziron is.... MasmBasic is a set of libraries for MASM... Ziron is a whole assembler, so to compare the 2 is useless. Since in actual fact it would be possible to port MasmBasic also to Ziron...
Hi OverHertz,
An interesting project. For what its worth, the idea of a plugin interface is the future of compilers/assemblers and it will depend on just how powerful the exposed interface is as to how useful it will be.
Hi hutch--
I'd like to expose as much as possible, allowing for maximum flexibility, for example
internal macros.
internal procedures
adding/removing internal constants
adding new linking file formats (e.g. creating a linux bin file exporter)
adding/removing opcodes
etc....
The idea of this is for users to input their suggestions, if someone decides to write a plugin, if they tell me what they would like to do/access, it will give me a good idea which parts of the plugin system to implement first, as i go i will write a specification of the plugin system.
Quote from: OverHertz on September 21, 2011, 09:08:57 PM
so unfortunately I fail to see your point...the big difference with MasmBasic and Ziron is.... MasmBasic is a set of libraries for MASM... Ziron is a whole assembler, so to compare the 2 is useless. Since in actual fact it would be possible to port MasmBasic also to Ziron...
I understand, and I wish you all the best for Ziron. However, I suspect you underestimate the complexity of the Masm/JWasm macro engine - for example, the Let and Dim macro have over 100 lines, the deb Macro over 200. Most probably, it will not be possible to compile existing Masm code in Ziron, unless it is really simple... correct me if I am wrong. There are some samples in \masm32\examples, although for testing your macro engine, they are far too simple...
In a nutshell: You may find it difficult to convince members here to abandon Masm/Jwasm and use Ziron instead.
Hi jj2007, i do not plan to convince anyone to abandon MASM/JWASM since they are both excellent development tools, however i believe there is no harm in testing other tools, am i right?
You are correct that the Ziron macro system is only basic for now, but with feedback and ideas from other people i intend to make it very powerful, take into consideration the small amount of time i have so far put into the project (under 1 year), I am giving people the opportunity to be a part of Ziron' history. :)
tested the sample with win XP sp3
compiled: OK
run: Nothing
hi ToutEnMasm, which sample did you assemble? note that calling
wait_key(getFileExt('This is a filename.jpg.txt'));
this will not work on current released version i fixed this bug for next release
the following will work :)
eax = getFileExt('This is a filename.jpg.txt');
wait_key(eax);
:bg if you do not mean this sample, please post the source file you have compiled :)
i tell ya - crt__kbhit and crt__getch are not as easy to replace as they seem :P
not to mention - the console is buggish to start with
the wait_key seems to work perfectly well for now :)
Quote
hi ToutEnMasm, which sample did you assemble? note that calling
They are not too numerous in the package i have downloaded,only ONE:
\ziron\samples\winsock_server_1\sample.zir
oh the sample that is with the compiler, it works for sure, did you connect to 127.0.0.1:1111 when you run the sample ? ;)
I'm guessing you did not read the README.txt that is in the same dir as the sample file - i will add more samples to the next upcoming release.
(http://www.codeziron.com/uploads/sample.ss1.JPG)
the ziron forum has more and better samples.
Quote
oh the sample that is with the compiler, it works for sure, did you connect to 127.0.0.1:1111 when you run the sample ? ;)
I read it
Perhaps a batch to compile it or/AND an execute file will be more efficient than all this questions in the forum.Seems you have a little work to make it more usable.
The sample show no one string on the screen ,the cursor is fixed on the upper left corner and that all.
sorry i do not understand, and the samples are not meant to be full programs written for you, they are just samples of the language syntax etc. But if you explain more in detail what you mean, maybe i can make some changes/additions :U
i think you still do not understand it is a console that displays nothing, it is not supposed to show anything - so maybe you did not understand the readme.txt, you need to connect to it with telnet via (cmd.exe)
as for usability, it is just like any other compiler, it has an executable that assembled a file, it is possible to drag and drop a .zir file onto the exe and it will startup and assemble it (creating the exe in the same dir as the .zir file)
just to mention i have released an update today (version 1.1.20.2 (http://www.codeziron.com/forum.php?page=topic&id=3)) containing 7 samples.
string sample - creating/using strings.
using classes - how to use a class.
remote app - example showing opening another process.
loadfs - how to use internal macro "loadfs".
simple message server - a simple winsock hello world message server.
using directives - how to use some of the directives.
api window - creating a GUI window using the win api.
if anyone has suggestions for more simple samples or would like to contribute some sample, please let me know :)
thought i would post to show about some updates i have been working on, primarily for interfaces and improving classes (inheritance etc)
a directx9 sample application that can be compiled with the upcoming release
program WIN32GUI 'DX9Sample';
#include 'user32.zir';
#include 'kernel32.zir';
#include 'messages.zir';
#include 'colors.zir';
#include 'directx/direct3d9.zir';
//////////////////////////////
//directx globals
D3DPRESENT_PARAMETERS presParams;
/////////
//other variables
tagWndClassA wndClass;
tagMsg msg;
DWord hInstance = GetModuleHandleA(nil);
//
//handles
DWord hMainFRM;
//
//////////////////////////////
function WindowProc(DWord hWnd; DWord uMsg; DWord wParam; DWord lParam) {
if (uMsg == WM_COMMAND) {
eax = DefWindowProcA(hWnd, uMsg, wParam, lParam);
ret
} elseif (uMsg == WM_DESTROY) {
PostQuitMessage(0);
} else {
eax = DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
}
const className = 'ZMainFRM';
wndClass.hbrBackground = COLOR_BACKGROUND;
wndClass.hInstance = hInstance;
wndClass.lpszClassName = className;
wndClass.lpfnWndProc = @WindowProc;
RegisterClassA(@wndClass);
hMainFRM = CreateWindowExA(0, className, 'Ziron DirectX9 Demo', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, 0, 0, hInstance, nil);
ShowWindow(hMainFRM, SW_SHOWNORMAL);
presParams.hDeviceWindow = hMainFRM;
presParams.Windowed = True;
presParams.BackBufferWidth = 1024;
presParams.BackBufferHeight = 768;
presParams.BackBufferCount = 1;
presParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
presParams.AutoDepthStencilFormat = D3DFMT_D24X8;
presParams.EnableAutoDepthStencil = True;
IDirect3DDevice9 dx_device;
IDirect3D9 dx_object = Direct3DCreate9(D3D_SDK_VERSION);
edi = dx_object;
eax = edi.CreateDevice(0, D3DDEVTYPE_HAL, hMainFRM, 64, @presParams, @dx_device);
//edi as nothing;
edi = dx_device;
push esi;
esi = 0xFF000000;
// Set up message loop
while (eax <> WM_QUIT) {
edi.clear(0, nil, 3, esi, 1.0, 0);
edi.BeginScene;
//
//render something here :)
//
edi.EndScene;
edi.Present(nil, nil, 0, nil);
add esi, 0x512
eax = PeekMessage(@msg, 0, 0, 0, 1);
if (eax) {
TranslateMessage(@msg);
DispatchMessageA(@msg);
eax = msg.message;
}
}
edi as nothing;
pop esi
ExitProcess(0);
creates window, inits directx9 and changes window colour, assembles as a 3kb exe :)
today just now i released the new version of the assembler, along with 2 new samples (now 9 in total) - the macro system is becoming more advanced and much more useful, macro variables can be assigned complex expressions such as
$var = (5+4* 4 shl 3-1 xor 5)*4-2+(5*5 shr $anothervar+5*5+(2+4*2))*5 % 5 or $yetanothervar and SomeMacroFunc();
Nice work OverHertz.
when will Ziron be solid?
how to include COFF files which output from another language with Ziron code?
Not to bash you, but getFileExt('This is a filename.jpg.txt'); is bad - very, very bad.
Quote from: Emil_halim on October 21, 2011, 07:15:08 PM
Nice work OverHertz.
when will Ziron be solid?
how to include COFF files which output from another language with Ziron code?
Thanks, Ziron will be constantly improved and updated dependant on requests, it will also be possible for others to improve the assembler via plugins with a further release, as for included COFF files, once i am satisfied that the language has enough support and a good user base i will begin adding support for including lib/coff files and other misc things :)
Quote from: Horton on October 22, 2011, 03:30:30 AM
Not to bash you, but getFileExt('This is a filename.jpg.txt'); is bad - very, very bad.
and why is that? :)
ps: the only thing i see "bad - very, very bad" is your comment, along with other useless, unhelpful comments... lol
thought I'd mention to anyone interested... about a new release of Ziron that finally supports the new plugin system.. it is pretty basic for now but it has a supplied sample plugin with it too along with the basic documentation.
for those interested, you can check it out here (http://www.codeziron.com/forum.php?page=topic&id=3)