Author Topic: asm code problem.  (Read 4819 times)

0 Members and 2 Guests are viewing this topic.

Emil_halim

  • Guest
asm code problem.
« on: March 20, 2013, 07:37:08 AM »

this was discussion in OXYEditor under tools section , but i see it is better to put it here.

Charles ,

this did not work as expect
Quote
$ filename "test2.exe"
#include "..\..\inc\RTL32.inc"

addr ecx,xx
[ecx] = 100
print hex [ecx]
end

.xx
dd  0
   

Peter

  • Guest
Re: asm code problem.
« Reply #1 on: March 20, 2013, 07:50:00 AM »
Hi Emil,

end means in OxygenBasic  "marks the end of a code block"
 
Isn't termination!

Emil_halim

  • Guest
Re: asm code problem.
« Reply #2 on: March 20, 2013, 07:54:16 AM »
Hi Peter ,

yes i know that end will tell the compiler to stop at that point and don't execute the following  instruction.

but how this help in this case?   

Emil_halim

  • Guest
Re: asm code problem.
« Reply #3 on: March 20, 2013, 07:57:22 AM »
i was playing with my old strcpy function in Ziron and start to compile it under Oxygen and......

it compiled ok with a Little changes , but it refused to run as the above problem.
Code: [Select]

$ filename "test3.exe"
#include "..\..\inc\RTL32.inc"

function  H_strcpy(Dword dst,src)
{
 ' uses edx ebx;
  push edx : push ebx
  Eax = dst;
  Edx = src;
  push Eax;
  BL =  char[Edx];
  while ( BL != 0)  
   {
      char[Eax] = BL;
      Eax++; Edx++;
      BL =  char[Edx];
   }  
  char[Eax] = 0;
  pop Eax;
  pop ebx : pop edx
}

dim as string * 1024 buf

H_strcpy(&buf,"Emil Halim")

print buf

Peter

  • Guest
Re: asm code problem.
« Reply #4 on: March 20, 2013, 09:39:39 AM »
Code: [Select]
indexbase 0
'$ filename "test3.exe"
'#include "..\..\inc\RTL32.inc"

string buf  

Sub H_strcpy(string dst, string src)
  pushad
  mov Eax,dst
  mov Edx,src
.w  
  
      mov CL, [Edx]
      mov [Eax], CL
      inc Eax
      inc Edx
      mov CL, [Edx]
    
  cmp CL,0
  jnz w
  popad
End Sub

H_strcpy(buf,"Emil Halim ")

print buf
« Last Edit: March 20, 2013, 09:47:08 AM by peter »

Emil_halim

  • Guest
Re: asm code problem.
« Reply #5 on: March 20, 2013, 10:24:30 AM »

ok ,Peter thanks for converting.

but i really want to know Oxygen compiled it with no error and what could be the op-code that came out?

Charles Pegge

  • Guest
Re: asm code problem.
« Reply #6 on: March 20, 2013, 11:14:54 AM »
Hi Emil, Peter,

the '=' operator usually translates to something like this

a=b

---->

mov eax,b
mov a,eax



copy is a built-in function and works on the var address or strpr for strings

'copying from b to a , n bytes:

copy @a,@b,n
or
copy &a,&b,n


Using Oxygen Asm with block feature:

zstring a[]="ABCDE"
zstring b[]="12345"
sys n=len a

mycopy:
addr esi,b
addr edi,a
mov ecx,n
(
  dec ecx
  jl exit
  mov al,[esi]
  mov [edi],al
  inc esi
  inc edi
  repeat
)
print b


NB: I noticed that addr does not handle bstrings and strings correctly, so I will add the mod to my next release.

zstrings / char is ok

Charles

Peter

  • Guest
Re: asm code problem.
« Reply #7 on: March 20, 2013, 12:13:14 PM »
I use Assembler in old style, I have no problems.

Emil_halim

  • Guest
Re: asm code problem.
« Reply #8 on: March 20, 2013, 12:18:01 PM »
Hi Peter ,

this is old style but still did not work

Code: [Select]
addr ecx,xx
mov [ecx] , 100
print hex [ecx]
end

.xx
dd  0

Peter

  • Guest
Re: asm code problem.
« Reply #9 on: March 20, 2013, 12:26:00 PM »
Hi Emil,



X

Emil_halim

  • Guest
Re: asm code problem.
« Reply #10 on: March 20, 2013, 12:29:57 PM »
this is very strange , it compiled okay but refused to run.

can Mr Charles give any hint here please!!!!!!!!!!  

Peter

  • Guest
Re: asm code problem.
« Reply #11 on: March 20, 2013, 12:37:31 PM »
Quote
can Mr Charles give any hint here please!!!!!!!!!! 

LOL  :D

Emil_halim

  • Guest
Re: asm code problem.
« Reply #12 on: March 21, 2013, 07:13:06 AM »

Hi Peter ,

i think Oxygen has some troubles with 32bit version of windows , to ensure that , want to test it with
other 32bit machine , do you have one ? 

JRS

  • Guest
Re: asm code problem.
« Reply #13 on: March 21, 2013, 07:20:22 AM »
I run 32 bit XP in a VirtualBox under Ubuntu 64. I have Win7 64 bit in a separate bootable partition. (64 bit Windows testing only)  For me this is a great way to test both 32 & 64 bit Windows and still use a sane OS for development. For quick tests without having to fire up the XP VirtiualBox, I use Wine.


Peter

  • Guest
Re: asm code problem.
« Reply #14 on: March 21, 2013, 07:27:59 AM »
No, I haven't.
But you can knock at Aurel. He drives ancient WinXP 32 Bit.