1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-09 08:54:40 +00:00
kickc/src/test/ref/struct-28.asm

30 lines
694 B
NASM

// Minimal struct with C-Standard behavior - member is array, copy assignment
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SIZEOF_STRUCT_POINT = 3
.const OFFSET_STRUCT_POINT_INITIALS = 1
.label SCREEN = $400
main: {
.label point1 = 2
// point1 = { 2, { 'j', 'g' } }
ldy #SIZEOF_STRUCT_POINT
!:
lda __0-1,y
sta point1-1,y
dey
bne !-
// SCREEN[0] = point1.x
lda.z point1
sta SCREEN
// SCREEN[1] = point1.initials[0]
lda point1+OFFSET_STRUCT_POINT_INITIALS
sta SCREEN+1
// SCREEN[2] = point1.initials[1]
lda point1+OFFSET_STRUCT_POINT_INITIALS+1
sta SCREEN+2
// }
rts
}
__0: .byte 2, 'j', 'g'