please dont rip this site

SX Microcontroller Math Method

Increment / Decrement

Increment / Decrement 32 bit address and detect zero

Translated and optimized for the Scenix SX by James Newton

; given address of 32 bit little-endian counter in W,
; increment or decrement the counter and return Z set if zero

;Inc32z
;From Dmitry Kiryashov
inc32z:
	mov	FSR, W
	clrb	Z

	incsz	IND
	ret

	incsz	FSR
	incsz	IND
	ret

	incsz	FSR
	incsz	IND
	ret

	incsz	FSR
	inc	IND
	ret
;Dec32z
;From Rich Leggitt, Andrew Warren, and Dmitry Kiryashov
; 99.2% of the time, this takes 10 cycles w/call
dec32z:
	mov	FSR, W
	decsz	IND
	jmp	dec32nz

	inc	FSR
	mov	W, IND

	inc	FSR
	or	W, IND

	inc	FSR
	or	W, IND	;get _Z finally
	ret

dec32nz:
	clrb	Z	;set _Z=0
	movsz	W, ++IND
	ret

	incsz	FSR	;doesn't corrupt _Z
	decsz	IND
	movsz	W, ++IND
	ret

	incsz	FSR	;...
	decsz	IND
	movsz	W, ++IND
	ret

	incsz	FSR	;...
	decsz	IND
	ret
	ret



file: /Techref/scenix/lib/math/incdec/32bitwz_sx.htm, 1KB, , updated: 2004/6/10 13:40, local time: 2024/12/7 20:03,
TOP NEW HELP FIND: 
18.97.9.168:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.piclist.com/techref/scenix/lib/math/incdec/32bitwz_sx.htm"> SX Math Increment / Decrement 32 Bit and detect zero</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .