02-15-2005, 09:19 PM
FB Inline assembly. Head scratching time...
The first instruction will always return zero.
The register eax will always be loaded with 0 not 0ffh as expected.
The reason is the compiler changes '0ffh' to '0 ffh'.
Using '&hff' works. How would you do binary in FB? However, using
FB syntax inside an asm block may lead to existing code conversion
problems.
Is this a bug or, am i doing something wrong?
mov eax,0ffh ' <- Changes to: '0 ffh' returns 0
mov eax,01b ' <- Changes to: '01 b' returns 1
mov eax,011b ' <- Changes to: '011 b' returns 9 octal
mov eax,11d ' <- Changes to: '11e' junk 'e' error
mov eax,011 ' <- Unchanged returns 9 octal
mov eax,11 ' <- Unchanged returns 11
mov eax,012 ' <- Unchanged returns 10 octal
mov eax,12 ' <- Unchanged returns 12
' Test code
dim r1 as integer, r2 as integer
dim r3 as integer, r4 as integer
asm
mov eax,0ffh
mov [r1],eax
mov eax,011b
mov [r2],eax
mov eax,011
mov [r3],eax
mov eax,012
mov [r4],eax
end asm
print "mov eax,0ffh =";r1
print "mov eax,011b =";r2
print "mov eax,011 =";r3
print "mov eax,012 =";r4
The first instruction will always return zero.
The register eax will always be loaded with 0 not 0ffh as expected.
The reason is the compiler changes '0ffh' to '0 ffh'.
Using '&hff' works. How would you do binary in FB? However, using
FB syntax inside an asm block may lead to existing code conversion
problems.
Is this a bug or, am i doing something wrong?
mov eax,0ffh ' <- Changes to: '0 ffh' returns 0
mov eax,01b ' <- Changes to: '01 b' returns 1
mov eax,011b ' <- Changes to: '011 b' returns 9 octal
mov eax,11d ' <- Changes to: '11e' junk 'e' error
mov eax,011 ' <- Unchanged returns 9 octal
mov eax,11 ' <- Unchanged returns 11
mov eax,012 ' <- Unchanged returns 10 octal
mov eax,12 ' <- Unchanged returns 12
' Test code
dim r1 as integer, r2 as integer
dim r3 as integer, r4 as integer
asm
mov eax,0ffh
mov [r1],eax
mov eax,011b
mov [r2],eax
mov eax,011
mov [r3],eax
mov eax,012
mov [r4],eax
end asm
print "mov eax,0ffh =";r1
print "mov eax,011b =";r2
print "mov eax,011 =";r3
print "mov eax,012 =";r4