-
Notifications
You must be signed in to change notification settings - Fork 171
/
im2.h
107 lines (77 loc) · 3.37 KB
/
im2.h
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
// automatically generated by m4 from headers in proto subdir
#ifndef __IM2_H__
#define __IM2_H__
#include <stdint.h>
extern void im2_init(void *im2_table_address) __preserves_regs(b,c,d,e,iyl,iyh);
extern void im2_init_fastcall(void *im2_table_address) __preserves_regs(b,c,d,e,h,l,iyl,iyh) __z88dk_fastcall;
#define im2_init(a) im2_init_fastcall(a)
extern void *im2_install_isr(uint8_t vector,void *isr) __preserves_regs(b,c,iyl,iyh);
extern void *im2_install_isr_callee(uint8_t vector,void *isr) __preserves_regs(b,c,iyl,iyh) __z88dk_callee;
#define im2_install_isr(a,b) im2_install_isr_callee(a,b)
extern void *im2_create_generic_isr(uint8_t num_callbacks,void *address) __preserves_regs(iyl,iyh);
extern void *im2_create_generic_isr_callee(uint8_t num_callbacks,void *address) __preserves_regs(iyl,iyh) __z88dk_callee;
#define im2_create_generic_isr(a,b) im2_create_generic_isr_callee(a,b)
extern void *im2_create_generic_isr_8080(uint8_t num_callbacks,void *address) __preserves_regs(iyl,iyh);
extern void *im2_create_generic_isr_8080_callee(uint8_t num_callbacks,void *address) __preserves_regs(iyl,iyh) __z88dk_callee;
#define im2_create_generic_isr_8080(a,b) im2_create_generic_isr_8080_callee(a,b)
extern void im2_append_generic_callback(uint8_t vector,void *callback) __preserves_regs(iyl,iyh);
extern void im2_append_generic_callback_callee(uint8_t vector,void *callback) __preserves_regs(iyl,iyh) __z88dk_callee;
#define im2_append_generic_callback(a,b) im2_append_generic_callback_callee(a,b)
extern void im2_prepend_generic_callback(uint8_t vector,void *callback) __preserves_regs(iyl,iyh);
extern void im2_prepend_generic_callback_callee(uint8_t vector,void *callback) __preserves_regs(iyl,iyh) __z88dk_callee;
#define im2_prepend_generic_callback(a,b) im2_prepend_generic_callback_callee(a,b)
extern int im2_remove_generic_callback(uint8_t vector,void *callback) __preserves_regs(iyl,iyh);
extern int im2_remove_generic_callback_callee(uint8_t vector,void *callback) __preserves_regs(iyl,iyh) __z88dk_callee;
#define im2_remove_generic_callback(a,b) im2_remove_generic_callback_callee(a,b)
#ifdef __CLANG
#define IM2_DEFINE_ISR(name) error clang does not support IM2_DEFINE_ISR;
#define IM2_DEFINE_ISR_8080(name) error clang does not support IM2_DEFINE_ISR_8080;
#endif
#define IM2_DEFINE_ISR(name) void name(void) __naked \
{ \
__asm__("\tEXTERN\tasm_im2_push_registers\n" \
"\tEXTERN\tasm_im2_pop_registers\n" \
"\n" \
"\tcall\tasm_im2_push_registers\n" \
"\tcall\t__im2_isr_" #name "\n" \
"\tcall\tasm_im2_pop_registers\n" \
"\n" \
"\tei\n" \
"\treti\n" \
); \
} \
void _im2_isr_##name(void)
#define IM2_DEFINE_ISR_8080(name) void name(void) __naked \
{ \
__asm__("\tEXTERN\tasm_im2_push_registers_8080\n" \
"\tEXTERN\tasm_im2_pop_registers_8080\n" \
"\n" \
"\tcall\tasm_im2_push_registers_8080\n" \
"\tcall\t__im2_isr_8080_" #name "\n" \
"\tcall\tasm_im2_pop_registers_8080\n" \
"\n" \
"\tei\n" \
"\treti\n" \
); \
} \
void _im2_isr_8080_##name(void)
#if __SPECTRUM || __ZXNEXT
#define IM2_DEFINE_ISR_WITH_BASIC(name) void name(void) __naked \
{ \
__asm__("\tEXTERN\tasm_im2_push_registers\n" \
"\tEXTERN\tasm_im2_pop_registers\n" \
"\n" \
"\tcall\tasm_im2_push_registers\n" \
"\tcall\t__im2_isr_" #name "\n" \
"\tcall\tasm_im2_pop_registers\n" \
"\n" \
"\tpush iy\n" \
"\tld iy,0x5c3a\n" \
"\tcall 0x0038\n" \
"\tpop iy\n" \
"\treti\n" \
); \
} \
void _im2_isr_##name(void)
#endif
#endif