2019-07-28 21:05:30 +00:00
|
|
|
// Demonstrates initializing an array of structs
|
|
|
|
// Array of structs containing words
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
.const OFFSET_STRUCT_POINT_Y = 1
|
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
|
|
|
.label _4 = 3
|
|
|
|
.label idx = 2
|
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z idx
|
2019-07-28 21:05:30 +00:00
|
|
|
tax
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
stx.z $ff
|
2019-07-28 21:05:30 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z $ff
|
|
|
|
sta.z _4
|
2019-07-28 21:05:30 +00:00
|
|
|
tay
|
|
|
|
lda points,y
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z idx
|
2019-07-28 21:05:30 +00:00
|
|
|
sta SCREEN,y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z idx
|
|
|
|
ldy.z _4
|
2019-07-28 21:05:30 +00:00
|
|
|
lda points+OFFSET_STRUCT_POINT_Y,y
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z idx
|
2019-07-28 21:05:30 +00:00
|
|
|
sta SCREEN,y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z idx
|
|
|
|
ldy.z _4
|
2019-07-28 21:05:30 +00:00
|
|
|
lda points+OFFSET_STRUCT_POINT_Y+1,y
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z idx
|
2019-07-28 21:05:30 +00:00
|
|
|
sta SCREEN,y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z idx
|
2019-07-28 21:05:30 +00:00
|
|
|
inx
|
|
|
|
cpx #3
|
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
points:
|
|
|
|
.byte 1
|
|
|
|
.word 2
|
|
|
|
.byte 3
|
|
|
|
.word 4
|
|
|
|
.byte 5
|
|
|
|
.word 6
|