2 * $Source: s:/prj/tech/libsrc/dev2d/RCS/bank.h $
5 * $Date: 1996/04/10 16:41:23 $
7 * Declarations for bank-switching. Lots of gruesome stuff
8 * to make things efficient, but still allow drawing in interrupt.
10 * This file is part of the dev2d library.
24 extern volatile int gdd_bank
;
25 extern volatile int gdd_ignore_bank
;
26 extern volatile int gdd_save_bank
;
28 // a pointer to the function that actually sets the bank
29 #define gd_force_bank \
30 ((void (*)(int bank))grd_device_table[GDC_SET_BANK])
32 // gd_inc_bank sets the semaphore to indicate gdd_bank is unreliable,
33 // increments and sets the bank, and resets the unreliability semaphore.
34 #define gd_inc_bank() \
37 gd_force_bank(++gdd_bank); \
41 // gd_set_bank sets a semaphore to indicate that the bank must be
42 // restored by any primitive subsequently called (in interrupt,
44 // use exactly once per primitive. always use gd_restore_bank
47 #define gd_set_bank(b) \
50 if (gdd_ignore_bank!=0) { \
55 if (gdd_bank != b) { \
63 // gd_restore_bank decrements the save semaphore and resets
64 // the bank when necessary.
66 #define gd_restore_bank(sb) \
69 if ((gdd_save_bank!=0)&& \
72 gd_force_bank(gdd_bank); \
76 /* calculates a video memory pointer from offset p. */
77 #define gd_bank_p(p) \
78 ((uchar *) grd_cap->vbase+((p)&0xffff))
83 #endif /* !__BANK_H */