Hello Matthias and all,

I'd like to see this forum also offering code snippets, so here's my
first humble attempt of harnessing the atomic bit manipulation
instructions.

: port:hi ( portadr bitno -- )      \ SBI
    swap $20 - 3 lshift or $9A00 or code , end-code
;

: port:lo ( portadr bitno -- )      \ CBI
    swap $20 - 3 lshift or $9800 or code , end-code
; 

example:

PORTB 7 port:hi green.hi
PORTB 7 port:lo green.lo

Thanks, Enoch.




------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to