2019-02-17 23:12:29 +00:00
|
|
|
// Illustrates symbolic array lengths
|
2018-07-21 09:13:32 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2018-07-23 07:27:30 +00:00
|
|
|
.const ITEM_COUNT = 3
|
2018-07-21 09:13:32 +00:00
|
|
|
.const ITEM_SIZE = 5
|
2019-02-17 23:12:29 +00:00
|
|
|
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
2018-07-21 09:13:32 +00:00
|
|
|
main: {
|
|
|
|
.label cur_item = 2
|
|
|
|
lda #<items
|
|
|
|
sta cur_item
|
|
|
|
lda #>items
|
|
|
|
sta cur_item+1
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
ldy #0
|
|
|
|
b2:
|
|
|
|
txa
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sty $ff
|
|
|
|
ora $ff
|
|
|
|
sta (cur_item),y
|
|
|
|
iny
|
|
|
|
cpy #ITEM_SIZE-1+1
|
|
|
|
bne b2
|
2019-03-18 01:23:29 +00:00
|
|
|
lda #ITEM_SIZE
|
2018-07-21 09:13:32 +00:00
|
|
|
clc
|
2019-03-18 01:23:29 +00:00
|
|
|
adc cur_item
|
2018-07-21 09:13:32 +00:00
|
|
|
sta cur_item
|
|
|
|
bcc !+
|
|
|
|
inc cur_item+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #ITEM_COUNT-1+1
|
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2018-07-23 07:27:30 +00:00
|
|
|
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|