indexbase 0
$ filename "test3c.exe"
#include "..\..\inc\RTL32.inc"
zstring a[]="ABCDE"
zstring b[]="12345"
Sub H_strcpy(zstring dst,src)
#HLAsm {
uses edx ebx
Eax = dst
Edx = src
.repeat
CL = char[Edx]
char[Eax] = CL
Eax++
Edx++
CL = char[Edx]
.until CL != 0
}
End Sub
H_strcpy(&a,&b)
print a
what is the main point - speed or optimization or both ?Neither.
OIL OxygenBasic Intermediate language
and BrainFuck is your high level language of choice.
BF is a difficult language, unfriendly to both man and machine. The name itself is a warning to all who use it!
jrs@laptop:~/sb/sb22/test$ time scriba skitri.sb
*
* *
* *
* * * *
* *
* * * *
* * * *
* * * * * * * *
* *
* * * *
* * * *
* * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* *
* * * *
* * * *
* * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SPLITA STRING(30000,48) BY "" TO memory
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
WEND
cellptr += 1
memory[cellptr] += 4
WHILE memory[cellptr] > 0
cellptr -= 1
memory[cellptr] += 8
cellptr += 1
memory[cellptr] -= 1
WEND
cellptr += 1
memory[cellptr] += 8
WHILE memory[cellptr] > 0
cellptr += 1
memory[cellptr] += 4
cellptr -= 1
memory[cellptr] -= 1
WEND
cellptr += 2
memory[cellptr] += 2
cellptr += 3
memory[cellptr] += 1
cellptr += 3
memory[cellptr] += 1
cellptr -= 10
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 1
cellptr -= 1
WEND
cellptr += 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr -= 1
memory[cellptr] += 1
cellptr += 3
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
cellptr -= 2
WEND
cellptr += 3
WHILE memory[cellptr] > 0
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 8
WHILE memory[cellptr] > 0
cellptr += 1
memory[cellptr] += 4
cellptr -= 1
memory[cellptr] -= 1
WEND
cellptr += 1
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
cellptr -= 2
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 1
cellptr -= 1
WEND
memory[cellptr] += 1
cellptr += 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 10
cellptr -= 2
memory[cellptr] += 1
cellptr += 1
WEND
cellptr += 1
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
WEND
cellptr += 1
WEND
WEND
memory[cellptr] += 1
cellptr -= 3
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 1
cellptr -= 1
WEND
memory[cellptr] += 1
cellptr += 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr -= 1
memory[cellptr] += 1
cellptr += 3
memory[cellptr] -= 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr += 1
memory[cellptr] += 1
cellptr -= 1
WEND
memory[cellptr] += 2
cellptr += 1
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
cellptr -= 1
memory[cellptr] -= 1
cellptr += 1
WEND
cellptr -= 3
WEND
cellptr -= 4
WEND
memory[cellptr] += 10
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
memory[cellptr] += 3
IF memory[cellptr] = 10 THEN
PRINTNL
ELSE
PRINT CHR(memory[cellptr])
END IF
WHILE memory[cellptr] > 0
memory[cellptr] -= 1
WEND
cellptr -= 1
WEND
memory[cellptr] += 5
include "sw.inc"
Window 320,240,1
SetText 0, 0, GetWidth() /2, 0
SetText 0,20, GetHeight()/2, 0
SetText 0,40, GetWidth() *2, 0
SetText 0,60, GetHeight()*2, 0
SetText 0, 80, GetWidth() -20, 0
SetText 0,100, GetHeight()-20, 0
SetText 0,120, GetWidth() +20, 0
SetText 0,140, GetHeight()+20, 0
WaitKey
Quit
indexbase 0
include "sw.inc"
Window 256,256,1
SetFont 12,24,bold,"courier"
SetCaption "Sirpinsky shake"
int numSteps=10000
float ax = 10, cy = 10
float ay = 256 - 10
float bx = 256 - 10
float by = 256 - 10
float cx = 256 / 2
float px = ax, py = ay
While Key(27)=0
Cls RGB 12,230,40
For n=0 To numSteps
DrawPoint px, py, 2, 2, RGB 0,0,255
Select Case Rnd(0,2)
Case 0
px = (px + ax) / 2
py = (py + ay) / 2
Case 1
px = (px + bx) / 2
py = (py + by) / 2
Case 2
px = (px + cx) / 2
py = (py + cy) / 2
End Select
Next
Sync
Wait 45
Wend
Quit
Gentlemen please! Be kind to each other.
change that
convert float,int
to this
convert float to int
I would say that A high level assembler is somewhere between a normal programming language and traditional Assembler. You can get slightly better performance, and still have something that is easier to read block structure than the list format of Assembly code.
def AbsI
%1
#HLAsm {
eax=%1
cdq
xor eax,edx
eax-=edx
}
end def
int fastcall strlen2(EAX)
{
EBX=EAX;
while(DSBYTE[EAX] !=0 )
{
EAX++;
}
EAX -= EBX;
}
Giving script languages the ability to handle callbacks is one of the more complex tasks I've encountered.
I assume you are catching specific callbacks in your IUP module.
think the use of a macro here is justified to reduce repetitive code and potential for errors.One man, one opinion.
$filename "Test.exe"
#include "..\..\inc\RTL32.inc"
#include "../../inc/MinWin.inc"
' find layer folder
'==================
bool FindLayerFolder ()
{
WIN32_FIND_DATA f
sys h = FindFirstFile("Layer", @f)
if h and f.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY then return true
return false
}
' get files in layer folder
'==========================
int LayerNo = 0
string LayName[20]
sub GetLayers()
WIN32_FIND_DATA f
sys h , e
h = FindFirstFile("Layer/*.dll", @f)
if h then
do
LayerNo++
LayName[LayerNo] = f.cFileName
e=FindNextFile( h, @f )
if e = 0 then exit do
end do
FindClose( h )
end if
end sub
' load all layers
'================
dword LayerHandle[20]
dword procStart[20]
dword procProcess[20]
dword procEnd[20]
sub LoadLayers()
sys i
for i = 1 to LayerNo
LayerHandle[i] = LoadLibrary( LayName[i] )
procStart[i] = GetProcAddress(LayerHandle[i],"StartLayer")
call procStart[i]
procProcess[i] = GetProcAddress(LayerHandle[i],"ProcessLayer")
procEnd[i] = GetProcAddress(LayerHandle[i],"EndLayer")
next
End sub
sys i
print FindLayerFolder
if FindLayerFolder() then
GetLayers()
for i = 1 to LayerNo
print LayName[i]
next
end if
$ filename "leyer.exe"
include "RTL32.inc"
include "MinWin.inc"
each one will process the source code as it want then next one and so on...
$filename "t.exe"
and
$ filename "t.exe"
$ filename "Test.exe"
#include "..\..\inc\RTL32.inc"
#include "../../inc/MinWin.inc"
' find layer folder
'==================
bool FindLayerFolder ()
{
WIN32_FIND_DATA f
sys h = FindFirstFile("Layer", @f)
if h and f.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY then return true
return false
}
' get files in layer folder
'==========================
int LayerNo = 0
string LayName[20]
sub GetLayers()
WIN32_FIND_DATA f
sys h , e
h = FindFirstFile("Layer/*.dll", @f)
if h then
do
LayerNo++
LayName[LayerNo] = f.cFileName
e=FindNextFile( h, @f )
if e = 0 then exit do
end do
FindClose( h )
end if
end sub
' load all layers
'================
dword LayerHandle[20]
dword procStart[20]
dword procProcess[20]
dword procEnd[20]
sub LoadLayers()
sys i
for i = 1 to LayerNo
LayerHandle[i] = LoadLibrary( LayName[i] )
procStart[i] = GetProcAddress(LayerHandle[i],"StartLayer")
call procStart[i]
procProcess[i] = GetProcAddress(LayerHandle[i],"ProcessLayer")
procEnd[i] = GetProcAddress(LayerHandle[i],"EndLayer")
next
End sub
' free all layers
'================
sub FreeLayers()
for i = 1 to LayerNo
call procEnd[i]
FreeLibrary(LayerHandle[i])
next
end sub
sys i
print FindLayerFolder
if FindLayerFolder() then
GetLayers()
for i = 1 to LayerNo
print LayName[i]
next
end if
LoadLayers()
FreeLayers()
'
' Layere define Example
'
$ dll
$ filename "define.dll"
#include "..\..\..\inc\RTL32.inc"
' start function
'===============
sub StartLayer(), export
print "from Define start function layer"
end sub
'process function
'================
function ProcessLayer(string* src) as bool , export
print "from Define process function layer"
end function
'End function
'============
sub EndLayer() , export
print "from Define end function layer"
end sub