>> On Mon, Oct 25, 2004 at 11:32:21AM -0400, Peter Johansson wrote: >>> Herbert Graf writes: >> >> proc clearbits(copy char count, copy char start) >> while (count) >> portb:start = 0 // Clear the bit in PORTB referenced by start. >> start = start+1 >> count = count-1 >> endwhile >> endproc >> >> The portb:start=0 line is a significant chunk of code because it >> represents >> a variable bit number. But the compiler gives a compact abstraction for >> the >> concept. > > Therefore I miss the EX assembly statement used in the IBM/360 (and > successors) architecture. Does know somebody similar on another > processors? > > Imre ;---- untested code ---- ;-- Assumptions: ;-- bit 0 is the LSBit ;-- 0 <= start <= 7 ;-- 0 <= start + count <= 8 clear_port_b_bits: call makemask xorlw B'11111111' andwf PORTB,F return set_port_b_bits: call makemask iorwf PORTB,F return toggle_port_b_bits: call makemask xorwf PORTB,F return makemask: movf start,w call bit_to_mask movwf temp movf start,W addwf count,W call bit_to_mask xorlw B'11111111' andwf temp,W return ;--- assumption : following table doesn't span a 256 ;--- instruction word boundary bit_to_mask: addwf PCL,f retlw B'11111111' retlw B'11111110' retlw B'11111100' retlw B'11111000' retlw B'11110000' retlw B'11100000' retlw B'11000000' retlw B'10000000' retlw B'00000000' Bob Ammerman RAm Systems _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist