Charles, what do I think? ... well every day you blow me away with what you come up with
That very loud boom in the sonics language is me being blown away!!
The code can contain easy parts and hard parts. It is possible to build "domain-specific" mini languages for handling particular tasks with an appropriate syntax.
The virtue is being able to build an ad hoc system that compiles into machine code, without the overhead of runtime interpretation
How about:
(
Sonics Language
very loud boom
12 reverberations
4.5 second envelope
go
)
A substantial piece of macro coding is hidden away in "Sonics Language" to make this possible of course.
Charles, what do I think? ... well every day you blow me away with what you come up with
That very loud boom in the sonics language is me being blown away!!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Well let's see how that might work syntactically. Here is a sketch to test the concept
first we have to invent a new macro parameter called %0 which is the word immediately before instead of after the macro word.
Some of these macros are single liners so brackets are not required.
def language include "lang_%0.asm"
' these defs hidden away in lang_sonics.asm...
var 4 this_sound,magnifier,amplitude,frequency,scaler,duration,reverbs,shape
set_initial_values
def very mov magnifier,10
def loud mov amplitude,100000
def boom (
this_sound =proc start_boom magnifier,amplitude,frequency
'restore defaults
mov magnifier,1
mov amplitude, 10000
mov frequency, 120
)
def second (
mov float dword duration, %0
mov scaler,1000
fld dword duration
fimul dword scaler
fstp dword duration
)
def reverberations (
mov reverbs,%0
)
def enveolope (
proc envelope1 this_sound,duration,shape
)
def go (
proc activate this_sound
)
The new sound is timesliced for each frame until it is completed
What can I say, wow... and I see a this_ in there. this_sound = proc...
Very very easy to understand and follow along!!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Very nice Charles ,
can't wait to start code like that!
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
It won't be very long, Petr. I have almost finished the main coding - ready to debug. Talking it through has been very useful, exposing some of the hidden issues that have to be addressed eg
handling floating point literals.
Nearly ready:
After an intensive week of coding and testing, the enhanced Asmosphere is almost ready. My aspiration this time is to make it as concise to use as a higher level compiled language. So far it has passed all its operational tests and useabilitiy tests. Serious stress testing is yet to come with lengthy cruel and unusual coding practices
The piece below shows how to bind to functions in a DLL. In this example, Asmosphere does not return a string with the assembled code. It is retained in a buffer on the module side. Up to 512 buffers are available so thinBasic does not need to handle the binaries directly if it does not want to.
One further refinement is multiple entry points which enables an assembled string itself to become a library of related functions - like a DLL or thinBasic module.
[code=thinbasic]
'How to make an sdk/dll call
Uses "Oxygen"
dim src as string = "
indexers `esi` offset 0 ascending ' tell asm how to map variables
push esi ' save esi register
esi=dataspace 256 ' create some inline storage
var 4 user32 ' create a 4 byte variable
user32=loadlibrary `user32.dll` ' get libray handle
bind user32 `mbox MessageBoxA` ' bind procaddresses
mbox 0,`Hello World!`,`Greeting`,0 ' call the dll proc
freelibrary user32 ' free the library
pop esi ' restore esi register
ret ' return
"
o2_asmo src 'assemble but do not return string
o2_exec ' execute this
[/code]
Thanks Charles,
looks very promising!
How can we index the buffers? If I get it right, o2_asmo src compiles the code in string, and places it in buffer.
o2_exec probably executes this buffer?
Does it work like stack?:
Or does it work differentely?o2_asmo src1
o2_asmo src2
o2_asmo src3
o2_exec ' -- Executes latest added, src3 and removes from machine code stack, shifts src2 mc as first now
o2_exec ' -- Executes src2, and removes it from stack
o2_exec ' -- Executes src1
Thanks,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Wow, with so much power, I hope I'll get the time and knowledge to use this stuff. Thanks Charles for all your work.
Hi Petr, to use different buffers ther another function: o2_buf
To use several buffers:
o2_buf 1 : o2_asmo prog11
o2_buf 2 : o2_asmo prog12
o2_buf 3 : o2_asmo prog13
then executing them:
o2_buf 1: o2_exec
o2_buf 2 : o2_exec
...
If there are pieces of code that need to be preassembled then these can be done in the previous way with:
mycode=o2_asm mysrc
mc_exec mycode
Then the code trings can be stored somewhere in a file, and used later as long as they dont bind directly to thinBasic variables (#v etc) at assembly time. In most instances the code strings are relocatable and do not require fixups as EXEs do.
Hi Michael,
This opens a Pandora's box of possibilities, since there are none of the assumptions made by high level languages but there isn't much of safety net (apart from GPF ). With its ability to localise both macros and functions I hope this will be suitable for large programs,- by avoiding name conflicts almost completely.
I am producing some small example scripts showing the new features, to go with the new release.
Bookmarks