This program in not working, the number that needs to be diplayed on the leds in EA.

;program to count the number of odd bytes in memory from address 0xff00 to 0xffff.
;number is to be displayed on 8 leds

;set up for leds and hardware
prog    equ     $2000

PORTB   equ     $0001
DDRB    equ     $0003
PTP     equ     $0258
DDRP    equ     $025A
PTJ     equ     $0268
DDRJ    equ     $026A

        org     prog
        bset    DDRP,#$0F
        bset    PTP,#$0F
        bset    DDRJ,#$02
        bclr    PTJ,#$02
        bset    DDRB,#$FF
        


        ldx     $ff00  ; load contents of ff00 to x
	ldaa    0    ;initialize a to 0

check:  brset   1,x+,$01,loop;AND contents of X with $01, increment x,branch to loop if result = 0
        bra     check
loop:   inca         ;increment accumulator a
        cpx     $FFFF  ;compare contents of x w/ contents of address ffff
        beq     done ;end is reached
        bne     check; more to do
done:   staa    PORTB  ; store contents of a to PORTB
        swi

> brset 1,x+,$01,loop;AND contents of X with $01, increment x,branch to loop if result = 0
You're counting run-lengths of odd numbers then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.