b4.1417691487.1046871164-beta
Full Changelog: 2.1.0.r1-b4-beta...b4.1417691487.1046871164-beta
NewASM Release Notes
Welcome to NewASM: 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.
- Version:
b4.1417691487.1046871164-beta
NOTE: This is a pre-release which means that this product version doesn't represent the final quality of the product - it may contain bugs and problems that aren't yet discovered.
What's new
- Added the new debugger window a.k.a. Progwin API.
- The CTL mode has been optimised and renamed to the shell mode.
- Added
loginandlogoutcommands to the shell mode. - Added the new
bosregister which stands forbyte output size. Basically, before printing text, you have to specify a number of bytes you want to print out.
.start
mov tlr, "hi"
mov bos, 2 ; size of the text inside tlr
mov stl, 0c1 ; next line character
mov fdx, 1
sysenter %ios
syscallYou can easily calculate the length of a string inside the data module.
.data
txt myText : "hello"
num lenMyText : $-myText ; $- (sizeof) operator exclusive for the data section and num type, which means you cannot use it in any other section or any other datatypeAlso, you can tell the interpreter to calculate the exact bos value for you so you don’t have to specify the bos size all the time:
.start
int 0x3 ; enable autobos- Added the
switchandcaseinstructions. Example:
.start
switch tlr
case 2 -> mov fdx, 2
case "Hi"-> mov fdx, 1
case 27.4->mov fdx, 2
case 21..82-> __say 0, "lol"
case ref-> __say 0, "reference"
default->mov fdx, 1
; supports case and type checking- Added I/O port emulation system. Now you can manipulate your console using emulated I/O ports and use colors. Currently, only emulated hardware is the screen.
.start
mov tlr, 1 ; red color
out 1 ; send green to the screen port
mov tlr, "Hello World"
mov stl, 0c1
mov bos, 11
mov fdx, 1
sysenter %ios
syscall- Added the new virtual memory. Now you can save data and load data from the virtual memory. Virtual memory behaves differently from the heap and the stack. In order to allocate a specific amount of cells in the virtual memory, use
malloc:
malloc 27_ ; use the _ operator to tell malloc to REALLOCATE number of cells in the virtual memory
vmov {4}, "Hello" ; in the new vmov instruction we can modify this memory
cast txt ; tell the interpreter to read a string
mov tlr, {4} ; using the {} operator we access the data inside the virtual memory
malloc 0_ ; we can free the memory manually, but not really needed since the program does that for us- Added the new
asyncinstruction, now procedures can act as threads usingasync:
.start
proc myProc
; code
end
async &myProc ; start proc as a separate thread
; your other code- Added support for loading OS-specific dynamic libraries:
.start
mov tlr, "ARG"
mov stl, "ARG2"
mov fdx, 1
mov dlx, "myDynLib" ; without the extension
sysenter %ext
syscall - Added the new directives! Lines of code that can be executed in any code section:
.$using %ios ; tell the interpreter that we are using iostream
.start
; other stuff- Added decorators! Currently only, available decorator is
[lock]which marks a variable as a variable that can be used only within the main thread:
.data
[lock] ; constructive decorator
num localNumber : 9
[!lock] ; destrucive decorator
thread myThread : {
mov tlr, localNumber ; does not work
; …
}
.start
mov tlr, localNumber ; works
retn tlrDecorators can be used in the .data code sections.
What's changed
- The following instructions now take references (pointers) as operands:
stor,load ref,sysreq,pop. - Now structs are just called objects:
.data
obj Vehicle : {
txt make = "Volkswagen"
num hp = 8
}- Now
%-prefixed statements are just built-in references. Special characters are now "character" codes prefixed with0c:
.start
mov tlr, "hello world"
mov stl, 0c1 ; endline
mov fdx, 1
sysenter %ios
syscall
ret 0List of special characters:
0c1 - new line;
0c2 - carriage return;
0c3 - tabulator;
0c4 - alert;
0c5 - backspace.
Fixed issues
- Fixed threads — now you can use them as they were intended.
- Fixed OS-specific DL loading.
Important notes
- No important notes.
Building from source
- Use the following command to compile your own build of
NewASM; make sure that you have G++ installed:
C:\path_to_your_compiler\g++ -static -std=c++20 index.cpp -o index.exe- If you are using Windows Subsystem for Linux, use the following command:
wsl g++ -m32 -static -std=c++20 index.cpp -o index.outDownloading
- Download one of the following archives that suits your system. Once you have downloaded it, extract the archive into a folder of your choice and begin using the application.
Using the application
- Use the following command to execute your
NewASMprograms on Windows:
newasm -input yourfile.asm- If you are on Linux, just add the
.outextension:
./newasm.out -input yourfile.asmWriting your first NewASM app
- Create the file named
yourfile.asm, or just name it whatever you like, and edit it with an editor of your choice:
.$using %ios
.data
txt string : "Hello world!"
num len : $-string
.start
mov tlr, string
mov stl, 0c1
mov bos, len
mov fdx, 1
sysenter %ios
syscall
ret 0Output:
Hello world!