From: Matthias T. <mt...@we...> - 2012-05-14 17:25:33
|
Hi, > I whas reading the German "das Fort magazin, vierte Dimension" and > find two interesting commands for manupulating on a simple way > individual bits with bset and bclr. > > Why are these not implemented in amForth?. Is thebsource for these > two available? Within the core/words directory you can find three files: bm_set.asm bm_clear.asm and bm_toggle.asm which should do, what you expect (and they are compatible with the bitname.frt structures and are implemented in assembly for speed reasons). bm-set will set all bits at the specified RAM Address that are set in the bitmask. bm-clear will clear all thoses bit positions and bm-toggle, well you'll guess yourself ;) I prefer the bitmask over a bitnumber simply because it can deal with more bits in one operation. Expanding the bitmask to more than 8bits is a little bit dangerous since both the pure action of reading/writing and the order of the read/write operations may be important in some cases. The bclr and bset commands Michael mentioned are basically the same, but we could not (yet) agree on a common name.... HTH Matthias |