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: 2023/12/7 16:39,
|©2023 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?|
<A HREF="http://www.sxlist.com/techref/scenix/lib/math/incdec/32bitwz_sx.htm"> SX Math Increment / Decrement 32 Bit and detect zero</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!