Jump to content

Programming:Reverse A: Difference between revisions

From CPCWiki - THE Amstrad CPC encyclopedia!
Octoate (talk | contribs)
added reverse A routine
 
Octoate (talk | contribs)
m layout
 
Line 5: Line 5:
;- Reverse a
;- Reverse a
;Input: A
;Input: A
;Output: Reversed A
;Output: Reversed A
;Destroys: B
;Destroys: B
;Length: 18 bytes
;Length: 18 bytes
;Author: calcmaniac84
;Author: calcmaniac84
;
;
ReverseA:
ReverseA:

Latest revision as of 20:56, 18 April 2011

This routine will return the reverse order of register A.

;
;- Reverse a
;Input:		A
;Output:	Reversed A
;Destroys:	B
;Length: 	18 bytes
;Author: 	calcmaniac84
;
ReverseA:
	ld b,a
	rrca
	rrca
	xor b
	and %10101010
	xor b
	ld b,a
	rrca
	rrca
	rrca
	rrca
	xor b
	and %01100110
	xor b
	rrca
	ret