NewASM is an interpreted low-level programming language which combines explicit memory and register control, giving it a breeze of assembly-like feel, with high-level functionalities such as objects, threads and more.
Note
NewASM language runs inside a NewASM Virtual Machine.
Below is the simple Hello World program written in New-Assembly.
using "ios"
.data
string text : "Hello world\n"
intg len : $-text
.start
mov tlr, text
mov fdx, 1
mov bos, len
sysenter "ios"
syscall
ret 0
Warning
The wiki is being completely reworked, so it may be missing some stuff.
NewASM allows you to write semi-efficient low-level programs in one universal assembly-like language. This language features many things immediatelly out-of-the-box such as concurrency, thread channels, basic crypto, file, math and console functionality, etc., so you do not have to worry about any library installation. However, if you wish to add any new functionality, you can easily integrate dynamic libraries (DLLs, SOs) into your project.
Since NewASM runs in a virtual machine, it is thus running in a fully controlled sealed environment, so it is great for learning and experimenting.
NewASM build consists of 2 programs, newasm and nprogwin. What YOU need is the newasm executable file which may be run in 2 modes.
Arguments are provided using the newasm_args variable you create before running the executeable, ergo:
- Windows
set newasm_args=arg1,arg2
- Linux
export newasm_args=arg1,arg2
| Argument | Parameters | Description |
|---|---|---|
h |
– | Displays help about these commands. |
l |
– | Turn on the logging system. |
nv |
– | Disable version checking. |
std |
– | Use the standard library. |
nodbg |
– | Disable the debug window. |
Example:
When running the newasm executeable, you can run it in 2 different modes:
- interpreter: this is the default interpreter mode, it just does the primary idea of what it is supposed to do – run the assembly code;
- shell: this is the shell, or control console, mode – application will run as the command prompt with its own commands, you can install packages and maintain your project.
To run the interpreter, use newasm , but to run the shell, just run the newasm app.
Note
To read more about configuring your NewASM application, click here…
Shell mode brings new different commands with it. Below is a list of available commands:
| Command | Arguments | Description |
|---|---|---|
help |
– | Displays this panel within the console. |
exit |
– | Closes the application. |
repl |
– | Enter the read-evaluate-print console. |
install |
|
Install a library online (currently there’s no libraries that are available!). |
login |
– | Log into your local account. |
logout |
– | Log out of your local account. |
addenv |
– | Adds an environment variable. |
remenv |
– | Deletes an environment variable. |
modenv |
– | Modifies the environment variable. |
renenv |
– | Changes the variable name. |
printenv |
– | Prints all the environment variables. |
passwd |
– | Change your password. |
usernm |
– | Change your username. |
Interpreter mode runs your application through several phases.
- Linker phase: In this phase, the linker links all files included in the application into one internal format.
- Internal compilation: In this phase, the system tokenizes and resolves some compile-time stuff before running the program. This ensures safe and stable program execution. In this phase, the system is telling the virtual machine what kernel modules will be used during the execution of the program.
- Execution: Final phase, the system runs the compiled code!
Tip
We’re planning to add JIT compilation into native code, but that’s in the testing phase.
Note
Click here… to read more about compile-time instructions/directives.
This section of the wiki provides a deep walkthrough of the language itself.
NewASM code is, as in other assemblers, divided into different sections that have their own syntax.
There are 4 different sections and each one has a different purpose:
.start– this is the code section that contains functional code (instructions), can contain procedure (function) and thread definitions;.data– this is where you declare your variables, references, containers, and more;.text– this is where you declare macros.
You change a section by doing:
For example:
.start
; code
.data
; declarations
; etc...
In NewASM there’s a huge variety of built in variable types and data containers. Read more…
NewASM features many instructions, around 70 of them. Here is a list:
- Data manipulation instructions
- Manual memory allocation instructions
- Kernel-related instructions
- Execution flow instructions
- Miscellaneous instructions
- Mathematical instructions and bit operations
- Thread-related instructions
- Union-related instructions
- Switch block instructions
- I/O port-related instructions
NewASM features different concepts such as decorators, namespaces, primitive classes and more advanced stuff.
This is a list of extra resources that might help.
