Ziron Programming Language - Assembly Based

Started by OverHertz, September 20, 2011, 12:50:02 PM

Previous topic - Next topic

qWord

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
FPU in a trice: SmplMath
It's that simple!

OverHertz

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
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

jj2007

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 CodeTM 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 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

OverHertz

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...
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

OverHertz

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.
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

jj2007

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.

OverHertz

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. :)
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

ToutEnMasm

tested the sample with win XP sp3
compiled: OK
run: Nothing   


OverHertz

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 :)
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

dedndave

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

OverHertz

the wait_key seems to work perfectly well for now :)
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

ToutEnMasm

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

OverHertz

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.



the ziron forum has more and better samples.
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.

ToutEnMasm

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.