Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
548 B
4
Indexable
Never
#include"xc.inc"
GLOBAL _is_square

PSECT mytest, local, class=CODE,reloc=1
 
_is_square:
    MOVFF 0x01, WREG
    MOVFF WREG, 0x00
    init:
    MOVLW 0x0F
    MOVFF WREG, 0x10
    start:
    MOVFF 0x10, WREG
    MULWF 0x10
    MOVFF PRODL, WREG
    CPFSEQ 0x00
	GOTO notthis
    GOTO found
    notthis:
	CPFSLT 0x00
	GOTO notFound
	DECFSZ 0x10
	GOTO start
	MOVLW 0x00
	CPFSEQ 0x00
	    GOTO notFound
	GOTO found
	found:
	MOVLW 0x01
	CLRF 0x00
	MOVWF 0x01
	RETURN
	notFound:
	MOVLW 0xFF
	MOVWF 0x01
	RETURN