Author Topic: asm 'mov BL , byte [Edx]' problem  (Read 1936 times)

0 Members and 2 Guests are viewing this topic.

Emil_halim

  • Guest
asm 'mov BL , byte [Edx]' problem
« 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


Charles Pegge

  • Guest
Re: asm 'mov BL , byte [Edx]' problem
« Reply #1 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

Charles Pegge

  • Guest
Re: asm 'mov BL , byte [Edx]' problem
« Reply #2 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