Oxygen Basic

Programming => Problems & Solutions => Topic started by: Emil_halim on March 22, 2013, 05:21:27 AM

Title: asm 'mov BL , byte [Edx]' problem
Post by: Emil_halim on March 22, 2013, 05:21:27 AM

Hi Charles ,

this line give that error
Code: [Select]
mov  BL , byte [Edx]

Quote
>"D:\OxygenBasic\gxo2" " -c test3_.O2bas"

   mov bl,byte [Edx]!!  label offsets only valid with 32 or 64 bit regs
 ; AFTER:     .h_strcpy#dword#dword
 ; LINE:       17
 ; FILE:       main source



>Exit code: 0

Title: Re: asm 'mov BL , byte [Edx]' problem
Post by: Charles Pegge on March 22, 2013, 05:59:42 AM
It thinks you are referencing a label called 'byte'

You don't need byte here but it should come immediately after the op instruction

push ebx
...
mov byte BL , [Edx]
...
pop ebx
Title: Re: asm 'mov BL , byte [Edx]' problem
Post by: Charles Pegge on March 22, 2013, 07:13:42 AM
The hazards of assembly code, Peter

You have defined variables in global/static memory space, which are always referenced by the ebx register

The cure is to put this into a procedure and use local variables, which are referenced by ebp.

function f()
dword a=256
byte  c1,c2
push ebx
lea edi,a
mov  bl,[edi]
mov  c1,bl
mov  bh,[edi+1]
mov  c2,bh
pop  ebx
print c1   '0
print c2   '1
end function