I guess that to make it into Matthias recipe book I have to add input
testing and perhaps more...
: _bitio
dup $1F U> if &-9 throw then
over $7 U> if &-9 throw then
;
: port:hi ( portadr bitno -- ) \ SBI
swap $20 - _bitio
3 lshift or $9A00 or
code , end-code
;
: port:lo ( portadr bitno -- ) \ CBI
swap $20 - _bitio
3 lshift or $9800 or
code , end-code
;
Enoch <[email protected]> writes:
> 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
------------------------------------------------------------------------------
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/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel