1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00
kickc/src/test/ref/struct-23.asm

44 lines
898 B
NASM
Raw Normal View History

// Minimal struct with C-Standard behavior - call return value (not supported yet)
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const OFFSET_STRUCT_POINT_Y = 1
.label SCREEN = $400
main: {
.label point1 = 2
.label point2 = 4
2020-02-23 08:44:36 +00:00
// getPoint(2, 3)
lda #3
ldx #2
jsr getPoint
2020-02-23 08:44:36 +00:00
// getPoint(2, 3)
// point1 = getPoint(2, 3)
stx.z point1
sta point1+OFFSET_STRUCT_POINT_Y
2020-02-23 08:44:36 +00:00
// SCREEN[0] = point1.x
txa
sta SCREEN
2020-02-23 08:44:36 +00:00
// SCREEN[1] = point1.y
lda point1+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
2020-02-23 08:44:36 +00:00
// getPoint(4, 5)
lda #5
ldx #4
jsr getPoint
2020-02-23 08:44:36 +00:00
// getPoint(4, 5)
// point2 = getPoint(4, 5)
stx.z point2
sta point2+OFFSET_STRUCT_POINT_Y
2020-02-23 08:44:36 +00:00
// SCREEN[2] = point2.x
txa
sta SCREEN+2
2020-02-23 08:44:36 +00:00
// SCREEN[3] = point2.y
lda point2+OFFSET_STRUCT_POINT_Y
sta SCREEN+3
2020-02-23 08:44:36 +00:00
// }
rts
}
getPoint: {
rts
}