hello there, i study Industrial Informatics and i am begginer in programming with assembly languange. I want make a program wich calculates the sum of 256 numbers starting from 00 - FF . My problem is wich subroutine i have to use when the sum is over 256 wich means that i have to to add the Carry with the sum (i think) . I calculated the sum from 00 - FF and it is 32896 (dec) or 8080 (hex). I calculated also that the sum gets beyond 256 at number 23 so i thought to make a loop for the sum of the first 23 numbers (NOCARRY) and then a second loop from 24 - FF (CARRY)
From the code i wrote below the sum is 805D (hex) or 32861 (dec)
ORG $400400
SUM DS.L 1
ORG $400410
MOVE.W #221,D0
MOVE.B #35,D4
LEA $400700,A0
NOCARRY MOVE.B (A0)+,D1
ADD.L D1,D3
SUBQ.B #1,D4
BNE NOCARRY
CLR.L D1
CLR.L D2
CARRY MOVE.B (A0)+,D1
MOVE.B #1,D2
ADD.L D2,D3
ADD.L D1,D3
SUBQ #1,D0
BNE CARRY
MOVE.L D3,SUM
END $400410
the microprocessor that i'm working with is Motorola 68000
If anyone knows something, it would be very helpfull to me
From the code i wrote below the sum is 805D (hex) or 32861 (dec)
ORG $400400
SUM DS.L 1
ORG $400410
MOVE.W #221,D0
MOVE.B #35,D4
LEA $400700,A0
NOCARRY MOVE.B (A0)+,D1
ADD.L D1,D3
SUBQ.B #1,D4
BNE NOCARRY
CLR.L D1
CLR.L D2
CARRY MOVE.B (A0)+,D1
MOVE.B #1,D2
ADD.L D2,D3
ADD.L D1,D3
SUBQ #1,D0
BNE CARRY
MOVE.L D3,SUM
END $400410
the microprocessor that i'm working with is Motorola 68000
If anyone knows something, it would be very helpfull to me