-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavr_dispatch.inc
130 lines (115 loc) · 3.34 KB
/
avr_dispatch.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* Generated by kalos_idl_compiler - DO NOT MODIFY */
#define K__pstring kalos_string*
#define K__string kalos_string
#define K__pnumber kalos_int
#define K__number kalos_int
#define K__pbool kalos_int
#define K__bool kalos_int
#define K__pobject kalos_object_ref*
#define K__object kalos_object_ref
#define K__pany kalos_value*
#define K__any kalos_value
#define K__t_string KALOS_VALUE_STRING
#define K__t_number KALOS_VALUE_NUMBER
#define K__t_bool KALOS_VALUE_BOOL
#define K__t_object KALOS_VALUE_OBJECT
#define K__t_any KALOS_VALUE_ANY
#define K__clean_string(stack, x) kalos_string_release((kalos_state*)state, x);
#define K__clean_number(stack, x) ;
#define K__clean_bool (stack, x) ;
#define K__clean_object(stack, x) kalos_object_release((kalos_state*)state, &x);
#define K__clean_any (stack, x) kalos_clear((kalos_state*)state, x);
#define K__arg(n, x) peek(stack, (n)-(x))
#define K__arg_string(x) &((x)->value.string)
#define K__arg_number(x) (x)->value.number
#define K__arg_bool(x) (x)->value.number
#define K__arg_object(x) &((x)->value.object)
#define K__arg_any(x) (x)
// id=0000:0001 name=main
void avr_trigger_main(kalos_run_state* state) {
kalos_trigger(state, kalos_make_address(0x0, 0x1));
}
void avr(kalos_run_state* state, int function, int param_count, kalos_stack* stack, bool retval) {
switch (function) {
// id=1 name=delay10 arg_count=0 symbol=
case 1: {
LOG("Invoke %s", "delay10");
const int arg_count = 0;
kalos_stack_setup_0(state);
_delay_ms(10);
kalos_stack_cleanup(state, arg_count);
break;
}
// id=2 name=delay250 arg_count=0 symbol=
case 2: {
LOG("Invoke %s", "delay250");
const int arg_count = 0;
kalos_stack_setup_0(state);
_delay_ms(250);
kalos_stack_cleanup(state, arg_count);
break;
}
// id=3 name=delay500 arg_count=0 symbol=
case 3: {
LOG("Invoke %s", "delay500");
const int arg_count = 0;
kalos_stack_setup_0(state);
_delay_ms(500);
kalos_stack_cleanup(state, arg_count);
break;
}
// id=4 name=delay1000 arg_count=0 symbol=
case 4: {
LOG("Invoke %s", "delay1000");
const int arg_count = 0;
kalos_stack_setup_0(state);
_delay_ms(1000);
kalos_stack_cleanup(state, arg_count);
break;
}
// id=5 name=set_output arg_count=1 symbol=
case 5: {
LOG("Invoke %s", "set_output");
const int arg_count = 1;
kalos_stack_setup_1(state, K__t_number);
DDRB |= _BV((K__arg_number(K__arg(arg_count, 1))));
kalos_stack_cleanup(state, arg_count);
break;
}
// id=6 name=set_input arg_count=1 symbol=
case 6: {
LOG("Invoke %s", "set_input");
const int arg_count = 1;
kalos_stack_setup_1(state, K__t_number);
DDRB &= ~_BV((K__arg_number(K__arg(arg_count, 1))));
kalos_stack_cleanup(state, arg_count);
break;
}
// id=7 name=pin_high arg_count=1 symbol=
case 7: {
LOG("Invoke %s", "pin_high");
const int arg_count = 1;
kalos_stack_setup_1(state, K__t_number);
PORTB |= _BV((K__arg_number(K__arg(arg_count, 1))));
kalos_stack_cleanup(state, arg_count);
break;
}
// id=8 name=pin_low arg_count=1 symbol=
case 8: {
LOG("Invoke %s", "pin_low");
const int arg_count = 1;
kalos_stack_setup_1(state, K__t_number);
PORTB &= ~_BV((K__arg_number(K__arg(arg_count, 1))));
kalos_stack_cleanup(state, arg_count);
break;
}
}
}
kalos_dispatch_fn dispatch[] = {
avr,
};
#undef K__string
#undef K__number
#undef K__bool
#undef K__object
#undef K__any