Oxygen Basic
Programming => Problems & Solutions => Topic started by: Peter on September 10, 2012, 11:25:44 AM
-
Deleted
-
Hi & wanted to reuse this thread bcause my ? is about a prob with asm:
OB seems not to understand i.e. "lodsb" & family; also, i.e. lea reg, var + imm yields lea reg, var
Does OB have anonymous labels and relative branching (i.e. branch backward/forward to next/nearest label)?
X
-
Unfinished work
Now supported:
rep repnz repz repe repne
ins lods movs outs cmps stos scas
insb lodsb movsb outsb cmpsb stosb scasb
insw lodsw movsw outsw cmpsw stosw scasw
insd lodsd movsd outsd cmpsd stosd scasd
insq lodsq movsq outsq cmpsq stosq scasq (64bit)
sys a[100]
sys b
indexbase 0
a[0]=0x32210
a[1]=0x32211
a[2]=0x32212
lea esi,a ' same as lea esi,[a]
lodsb
'print hex al '10
def offs 4
lea esi,[@a+offs]
lodsb
'print hex al '11
mov ecx,3
lea esi,[@a+0]
lea edi,[@a+40]
(
lods
stos
dec ecx
jnz repeat
)
'print hex a[11] '32211
mov ecx,3
mov eax,0x12345678
lea edi,[@a+80]
rep stos
print hex a[22] '12345678
Charles
-
Excellent support as always. Thank you Sir.
So, what else is unfinished :D Just kidding.
-
Ok Peter,
You can use pushf and popf - same opcodes: 9c 9d
-
:o
It was using an integer start number - should have adopted float. Sorry!
(pushfd popfd should now work too)
-
And again
-
This is also cool:
does not work:
int a = 1
mov eax, @a
add [eax], 10
print a
but this does:
int a = 1
int* p
@p = @a
p = 1
mov eax, @a
add [eax], 10
print a
-
Hi Jumpandrun,
expressions like mov eax,@a are not cuurently supported but you can do lea eax,a if a is direct.
use a basic expression to resolve the address of a variable, direct or indirect. It always works
sys p=@a
function f(sys*a) as sys
sys p=@a
mov ecx,p
return [ecx+4]
end function
indexbase 1
sys aa[10]={1,2,3,4,5,6,7,8,9,10}
print f aa[2] 'result: 3
Charles
-
You can expose any part of a program to view the assembly code by using ### block markers . (using Scite F7)
###
function f(sys*a) as sys
sys p=@a
mov ecx,p
return [ecx+4]
end function
###
--->
#view
'_3
'FUNCTION F
jmp fwd _over_
o2 !10
.f#sys
(
push ebp
mov ebp,esp
add esp,-20
lea edi,[ebp-16]
xor eax,eax
mov [edi],eax
lea edi,[ebp-20]
xor eax,eax
mov [edi],eax
lea edi,[ebp+8]
mov eax,[edi]
mov [ebp-20],eax
'_5
mov ecx,[ebp-20]
'_6
mov eax,[ecx+4]
jmp fwd _return_
'_7
._exit_
mov eax,[ebp-16]
._return_
mov esp,ebp
pop ebp
ret 4
)
._over_
'_8
#endv
Charles
-
Christmas Present :)
I have created a pseudo-instruction: addr
Example:
sys a=42
addr ecx,a
print [ecx] 'result 42
It will work with byval and byref variables.
type tt
sys w,x,y,z
end type
tt a={1,2,3,4}
function fy(tt*v) as sys
addr ecx,v.y
return [ecx]
end function
print fy a 'result 3
X