GBDK 2020 Docs API Documentation for GBDK 2020

far_ptr.h
Go to the documentation of this file.
1
13 #ifndef __FAR_PTR_H_INCLUDE
14 #define __FAR_PTR_H_INCLUDE
15
22 #define TO_FAR_PTR(ofs, seg) (((FAR_PTR)seg << 16) | (FAR_PTR)ofs)
23
29 #define FAR_SEG(ptr) (((union __far_ptr *)&ptr)->segofs.seg)
30
36 #define FAR_OFS(ptr) (((union __far_ptr *)&ptr)->segofs.ofs)
37
38 #define FAR_FUNC(ptr, typ) ((typ)(((union __far_ptr *)&ptr)->segfn.fn))
39
62 #define FAR_CALL(ptr, typ, ...) (__call_banked_ptr=ptr,((typ)(&__call__banked))(__VA_ARGS__))
63
66 typedef unsigned long FAR_PTR;
67
70 union __far_ptr {
71 FAR_PTR ptr;
72 struct {
73 void * ofs;
74 unsigned int seg;
75 } segofs;
76 struct {
77 void (*fn)();
78 unsigned int seg;
79 } segfn;
80 };
81
82 extern volatile FAR_PTR __call_banked_ptr;
83 extern volatile void * __call_banked_addr;
84 extern volatile unsigned char __call_banked_bank;
85
86 void __call__banked();
87
94 long to_far_ptr(void* ofs, int seg);
95
96 #endif
__call_banked_ptr
volatile FAR_PTR __call_banked_ptr
__call_banked_bank
volatile unsigned char __call_banked_bank
__far_ptr::ofs
void * ofs
Definition: far_ptr.h:73
__far_ptr::segfn
struct __far_ptr::@1 segfn
__call_banked_addr
volatile void * __call_banked_addr
to_far_ptr
long to_far_ptr(void *ofs, int seg)
FAR_PTR
unsigned long FAR_PTR
Definition: far_ptr.h:66
__far_ptr::fn
void(* fn)()
Definition: far_ptr.h:77
__far_ptr
Definition: far_ptr.h:70
__far_ptr::ptr
FAR_PTR ptr
Definition: far_ptr.h:71
__far_ptr::segofs
struct __far_ptr::@0 segofs
__call__banked
void __call__banked()
__far_ptr::seg
unsigned int seg
Definition: far_ptr.h:74