Code: Select all
*= $600
array:
.DB "1", 0
.DB "1",0
.DB "4",1
.DB "3",1
Code: Select all
NUMBERS: .DW 34, 45, 56, 67, 75, 89appreciate any help.
Code: Select all
*= $600
array:
.DB "1", 0
.DB "1",0
.DB "4",1
.DB "3",1
Code: Select all
NUMBERS: .DW 34, 45, 56, 67, 75, 89Code: Select all
NUMBERS: .DW 34,45,56,67,75,89
Code: Select all
*= $600
LDY #4 ; load Y index with array size
loop LDA MTAB,X ; load accumulator with value of the array in index X
ADC TEMP ; sum the value in temp variable with accumulator value
INX ; increment index X
DEY ; decrements index Y
BNE loop ; loop until index Y = zero
*= $800
MTAB .DB 2,1,2,3 ; integer array
TEMP .DB 0
Code: Select all
ldx #0
ldy #5 ; loop count + 1, since we check with BNE
txa ; initialize sum
clc
loop:
adc mtab,x
inx
dey
bne loop
brk
mtab:
dcb 2,1,2,3
Code: Select all
*= $600
LDY #4 ; load Y index with array size
loop
LDA MTAB,X ; load accumulator with value of the array in index X
ADC TEMP ; sum the value in temp variable with accumulator value
;STA TEMP
INX ; increment index X
DEY ; decrements index Y
CPY FLAG
BCC loop
BNE loop ; loop until index Y = zero
LDA TEMP
*= $800
MTAB .DB 2,1,2,3 ; integer array
TEMP
FLAG .DB 0
