Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Instrucciones para operar a nivel de bit
#5
This should be fairly simple to implement for the most part. Certainly for 8 bits:

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 Smile


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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)