Saturday, 12 February 2011

ASM Compiler

This is an utility for assembler programmers that allocate ram variable automatically.

With this compiler the ram memory is divided in two section:
  1. Public variables.
  2. Private variables.
Private variable section is started at end of public variable section.
In public variable section this compiler allocate all variables with no overlaps between them.
But in private variable section, at beginning of each functions the variable is overlapped.

an example:

If beginning of public variables section is 0x100, and end of this section is 0x1FF.
All function has beginning of private variables at 0x200.

This is good because at exit from a private function in no longer needed for allocated variables by this function, in this case the next function overlaps his variables over variables allocated by the function above.

V1.0.0

All of the next functions is macros instead functions 55,56,57,58 that is definitions.

In this version can be used the next function:

  1. public char,Var1,null;alloc char variable in public section but is not initiated.
  2. public char,Var1,100;alloc char variable in public section initiated with 100 value.
  3. public uchar,Var1,null;alloc uchar variable in public section but is not initiated.
  4. public uchar,Var1,100;alloc uchar variable in public section initiated with 100 value.
  5. public short,Var1,null;alloc short variable in public section but is not initiated.
  6. public short,Var1,100;alloc short variable in public section initiated with 100 value.
  7. public ushort,Var1,null;alloc ushort variable in public section but is not initiated.
  8. public ushort,Var1,100;alloc ushort variable in public section initiated with 100 value.
  9. public long,Var1,null;alloc long variable in public section but is not initiated.
  10. public long,Var1,100;alloc long variable in public section initiated with 100 value.
  11. public ulong,Var1,null;alloc ulong variable in public section but is not initiated.
  12. public ulong,Var1,100;alloc ulong variable in public section initiated with 100 value.
  13. public long_long,Var1,null;alloc long_long variable in public section but is not initiated
  14. public long_long,Var1,100;alloc long_long variable in public section initiated with 100.
  15. public ulong_long,Var1,null;alloc long_long variable in public section but is not initiated.
  16. public ulong_long,Var1,100;alloc long_long variable in public section initiated with 100variable.
  17. public array,char,Var1,64;alloc array with 64 char variables in public section.
  18. public array,uchar,Var1,64;alloc array with 64 uchar variables in public section.
  19. public array,short,Var1,64;alloc array with 64 short variables in public section.
  20. public array,ushort,Var1,64;alloc array with 64 ushort variables in public section.
  21. public array,long,Var1,64;alloc array with 64 long variables in public section.
  22. public array,ulong,Var1,64;alloc array with 64 ulong variables in public section.
  23. public array,long_long,Var1,64;alloc array with 64 long_long variables in public section.
  24. public array,ulong_long,Var1,64;alloc array with 64 ulong_long variables in public section.
  25. public string,Var1,256,"Hello";alloc string variable in public section and initiate with "Hello" string.
  26. private char,Var1,null;alloc char variable in private section but is not initiated.
  27. private char,Var1,100;alloc char variable in private section initiated with 100 value.
  28. private uchar,Var1,null;alloc uchar variable in private section but is not initiated.
  29. private uchar,Var1,100;alloc uchar variable in private section initiated with 100 value.
  30. private short,Var1,null;alloc short variable in private section but is not initiated.
  31. private short,Var1,100;alloc short variable in private section initiated with 100 value.
  32. private ushort,Var1,null;alloc ushort variable in private section but is not initiated.
  33. private ushort,Var1,100;alloc ushort variable in private section initiated with 100 value.
  34. private long,Var1,null;alloc long variable in private section but is not initiated.
  35. private long,Var1,100;alloc long variable in private section initiated with 100 value.
  36. private ulong,Var1,null;alloc ulong variable in private section but is not initiated.
  37. private ulong,Var1,100;alloc ulong variable in private section initiated with 100 value.
  38. private long_long,Var1,null;alloc long_long variable in private section but is not initiated.
  39. private long_long,Var1,100;alloc long_long variable in private section initiated with 100.
  40. private ulong_long,Var1,null;alloc long_long variable in private section but is not initiated.
  41. private ulong_long,Var1,100;alloc long_long variable in private section initiated with 100variable.
  42. private array,char,Var1,64;alloc array with 64 char variables in private section
  43. private array,uchar,Var1,64;alloc array with 64 uchar variables in private section.
  44. private array,short,Var1,64;alloc array with 64 short variables in private section.
  45. private array,ushort,Var1,64;alloc array with 64 ushort variables in private section.
  46. private array,long,Var1,64;alloc array with 64 long variables in private section.
  47. private array,ulong,Var1,64;alloc array with 64 ulong variables in private section.
  48. private array,long_long,Var1,64;alloc array with 64 long_long variables in private section.
  49. private array,ulong_long,Var1,64;alloc array with 64 ulong_long variables in private section.
  50. private string,Var6,256,"Hello";alloc string variable in private section and initiate with "Hello" string.
  51. write_low Var1;If is not array or string this write R16 if is char or uchar,R16:R17 if is short or ushort, R16:R17:R18:R19 if is long or ulong, R16:R17:R18:R19:R20:R21:R22:R23 if is long_long or ulong_long to Var1(type of variable is autodetected).
  52. write_high Var1;If is not array or string this write R0 if is char or uchar,R0:R1 if is short or ushort, R0:R1:R2:R3 if is long or ulong, R0:R1:R2:R3:R4:R5:R6:R7 if is long_long or ulong_long to Var1(type of variable is autodetected).
  53. read_low Var1;If is not array or string this read from Var1 to R16 if is char or uchar,R16:R17 if is short or ushort, R16:R17:R18:R19 if is long or ulong, R16:R17:R18:R19:R20:R21:R22:R23 if is long_long or ulong_long(type of variable is autodetected).
  54. read_high Var1;If is not array or string this read from Var1 to R0 if is char or uchar,R0:R1 if is short or ushort, R0:R1:R2:R3 if is long or ulong, R0:R1:R2:R3:R4:R5:R6:R7 if is long_long or ulong_long(type of variable is autodetected).
  55. function(NameOfFunction);with this is declased one function(is absolute necessarily to declare like that the function because this will be reset the private variable pointer.
  56. end_function; in this version this can be replaced by Ret instruction.
  57. call_func(function,null);this calls a private function with no transferred variable to him.
  58. call_func(function,Var1);this calls a private function with Var1 transfered to function, in Z is the address of Var1, this variable can be one char, uchar, short, ushort, long, ulong, array or one string, in Y is the base address function that called this function(not yet completed).
Var1 is the name of variable.

All of your stuff can be between ".include "Sys/Compiler.inc"" and ".include "Sys/Compiler_End.inc""

This compiler is at firs version 1.0.0 and can be downloaded from here.

0 comentarii: