1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-07-03 20:29:34 +00:00
kickc/src/test/ref/initializer-3.asm

47 lines
737 B
NASM

// 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
sta.z idx
tax
__b1:
txa
asl
stx.z $ff
clc
adc.z $ff
sta.z __4
tay
lda points,y
ldy.z idx
sta SCREEN,y
inc.z idx
ldy.z __4
lda points+OFFSET_STRUCT_POINT_Y,y
ldy.z idx
sta SCREEN,y
inc.z idx
ldy.z __4
lda points+OFFSET_STRUCT_POINT_Y+1,y
ldy.z idx
sta SCREEN,y
inc.z idx
inx
cpx #3
bne __b1
rts
}
points: .byte 1
.word 2
.byte 3
.word 4
.byte 5
.word 6