01-30-2010, 09:26 PM
This should be fairly simple to implement for the most part. Certainly for 8 bits:
Of course I haven't worked out how to drop into asm mode well, because CALL and FASTCALL aren't documented as to where they put their parameters.
It looks like a standard call puts them on the stack, but Boriel's code then plays with the stack pointer, which totally confuses me.
Anyway, 8 bit binary NOT? - One line of asm
For 16 bit function code:
Code:
FUNCTION FASTCALL bNOT (sentIn as uByte) as uByte
asm
CPL
end asm
END FUNCTION
DIM a as uByte
FOR a=0 to 20
print a,bNOT(a)
next a
Of course I haven't worked out how to drop into asm mode well, because CALL and FASTCALL aren't documented as to where they put their parameters.
It looks like a standard call puts them on the stack, but Boriel's code then plays with the stack pointer, which totally confuses me.
Anyway, 8 bit binary NOT? - One line of asm

For 16 bit function code:
Code:
FUNCTION FASTCALL bNOT (sentIn as uInteger) as uInteger
asm
LD a,h
CPL
ld h,a
ld a,l
CPL
ld l,a
end ASM
END FUNCTION
DIM a as uByte
FOR a=0 to 20
print a,bNOT(a)
next a