1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-03 07:29:37 +00:00

Small test program to test parameters.

This commit is contained in:
Sven Van de Velde 2023-12-05 16:23:22 +01:00
parent 53a918025a
commit 5e6622b2a8
5 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,35 @@
// File Comments
/* compile with C64 */
// Library
.namespace lib {
// Upstart
.cpu _65c02
#if __asm_import__
#else
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
#endif
// Global Constants & labels
.segment Code
// plus
// __zp(2) char plus(__zp(2) char a, __zp(2) char b)
plus: {
.label a = 2
.label b = 2
.label return = 2
.label plus__0 = 2
// a+b
// [0] plus::$0 = plus::a + plus::b -- vbuz1=vbuz1_plus_vbuz1
lda.z plus__0
asl
sta.z plus__0
// return a+b;
// [1] plus::return = plus::$0
// plus::@return
// }
// [2] return
rts
}
// File Data
}

View File

@ -0,0 +1,11 @@
/* compile with C64 */
#pragma link("lib.ld")
#pragma encoding(screencode_mixed)
#pragma var_model(zp)
#pragma asm_library("lib")
#pragma asm_export("lib", __varcall, plus)
char plus(char a, char b) {
return a+b;
}

View File

@ -0,0 +1,6 @@
#if __asm_import__
#else
.segmentdef Code [start=%P]
.segmentdef Data [startAfter="Code"]
#endif

View File

@ -0,0 +1 @@
extern __varcall __asm_import(lib) __zp(2) char plus(__zp(2) char a, __zp(2) char b);

View File

@ -0,0 +1,9 @@
#include "lib_proto.h"
__export char r;
void main() {
r = plus(4,5);
}