1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-09 08:54:40 +00:00
kickc/src/test/ref/callconstparam.asm
2020-02-23 09:44:36 +01:00

49 lines
928 B
NASM

// Multiple calls with different (constant?) parameters should yield different values at runtime
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label screen = 3
main: {
// line(1,2)
lda #<$400
sta.z screen
lda #>$400
sta.z screen+1
lda #2
sta.z line.x1
ldx #1
jsr line
// line(3,5)
lda #5
sta.z line.x1
ldx #3
jsr line
// }
rts
}
// line(byte zp(2) x1)
line: {
.label x1 = 2
__b1:
// for(byte x = x0; x<x1; x++)
cpx.z x1
bcc __b2
// }
rts
__b2:
// *screen = x
txa
ldy #0
sta (screen),y
// screen++;
inc.z screen
bne !+
inc.z screen+1
!:
// for(byte x = x0; x<x1; x++)
inx
jmp __b1
}