Fractions and negative numbers in assembly

Página 2/2
1 |

Por bore

Master (135)

Imagen del bore

18-08-2014, 16:22

While you are working with signed numbers it could be nice to have a method to sign-extend a byte.

	ld l, a       ; Lower byte is unchanged
	add a, a   ; Move sign to carry
	sbc a, a   ; Set all bits to carry
	ld h, a     ; Upper byte contains only sign
Página 2/2
1 |