1257 lines
39 KiB
C
1257 lines
39 KiB
C
/*
|
|
* osbind.h bindings for OS traps
|
|
*
|
|
* ++jrb bammi@cadence.com
|
|
*/
|
|
|
|
/*
|
|
* majorly re-hacked for gcc-1.36 and probably beyond
|
|
* all inlines changed to #defines, beacuse gcc is not
|
|
* handling clobbered reggies correctly when -mshort.
|
|
* We now use the Statement Exprs feature of GnuC
|
|
*
|
|
* 10/12/89
|
|
* changed all "g" constraints to "r" that will force
|
|
* all operands to be evaluated (or lea calculated)
|
|
* before the __asm__. This is necessary because
|
|
* if we had the (looser) "g" constraint, then sometimes
|
|
* we are in the situation where stuff is in the stack,
|
|
* and we are modifying the stack under Gcc (but eventually
|
|
* restoring it before the end of the __asm__), and it does
|
|
* not know about it (i believe there is no way to tell it
|
|
* this either, but you can hardly expect that). by forcing
|
|
* the stricter "r" constraint, we force the eval before using
|
|
* the val (or lea as the case may be) and we dont get into
|
|
* trouble.
|
|
* (thanks to ers for finding this problem!)
|
|
* [one side effect of this is that we may(depending on the
|
|
* situation) actually end up with better code when the
|
|
* values are already in reggies, or that value is used
|
|
* later on (note that Gnu's reggie allocation notices the
|
|
* clobbered reggie, and does'nt put the value/or uses
|
|
* them from those reggies, nice huh!)
|
|
*
|
|
* 28/2/90
|
|
* another major re-hack:
|
|
* -- the basic reason: there was just no reliable
|
|
* way to get the definitions (inline or not does'nt matter) to
|
|
* fully evaluate the args before we changed the sp from under it.
|
|
* (if -fomit-frame-pointer is *not* used, then most of the time
|
|
* we dont need to do this, as things will just reference off of
|
|
* a6, but this is not true all of the time).
|
|
* my solution was to use local vars in the body of the statement
|
|
* exprs, and initialize them from the args of the statement expr block.
|
|
* to force the evaluation of the args before we change sp from
|
|
* under gcc's feet, we make the local vars volatile. we use a
|
|
* slight code optimization heuristic: if there are more than 4
|
|
* args, only then we make the local volatile, and relax
|
|
* the "r" constraint to "g". otherwise, we dont put the volatile
|
|
* and force the evaluation by putting the "r" constaint. this
|
|
* produces better code in most sitiations (when !__NO_INLINE__
|
|
* especially), as either the args are already in a register or
|
|
* there is good chance they will soon be reused, and in that
|
|
* case it will already be in a register.
|
|
* it may (the local vars, especially when no volatile)
|
|
* look like overhead, but in 99% of the situations gcc will just
|
|
* optimize that assignment right out. besides, this makes
|
|
* these defines totally safe (from re-evaluation of the macro args).
|
|
*
|
|
* -- as suggested by andreas schwab (thanks!)
|
|
* (schwab@ls5.informatik.uni-dortmund.de) all the retvalues are now
|
|
* local register vals (see the extentions section in the info file)
|
|
* this really worked out great as all the silly "movl d0,%0" at
|
|
* the end of each def can now be removed, and the value of
|
|
* retvalue ends up in the correct register. it avoids all the
|
|
* silly "mov d0,[d|a]n" type sequences from being generated. a real win.
|
|
* (note in the outputs "=r"(retvalue) still has to be specified,
|
|
* otherwise in certain situations you end up loosing the return
|
|
* value in d0, as gcc sees no output, and correctly assumes that the
|
|
* asm returns no value).
|
|
*
|
|
* -- all the n's (the function #'s for the traps) are now given
|
|
* the more relaxed "g". This again results in better code, as
|
|
* it is always a constant, and gcc turns the movw %1,sp@- into
|
|
* a movw #n,sp@-. we could have given them a "i" constraint too,
|
|
* but "g" gives gcc more breathing room, and it does the right
|
|
* thing. note: the n's still need to have "r" constraints in the
|
|
* non-inline form (function form), as they are no longer constants
|
|
* in the function, but a normal arg on the stack frame, and hence
|
|
* we need to force evaluation before we change sp. (see osbind.c)
|
|
*
|
|
* -- straps.cpp and traps.c are history. we dont need no stinking
|
|
* non-reentrant bindings (straps) or incorrect ones (traps.c :-)
|
|
*
|
|
* 03/15/92 ++jrb
|
|
* -- another re-hack needed for gcc-2.0: the optimization that we
|
|
* used earlier for traps with more than 4 args, making them volatile
|
|
* and using "g" constraints no longer works, because gcc has become
|
|
* so smart! we now remove the volatile, and give "r" constraints
|
|
* (just like traps with <= 4 args). that way the args are evaled
|
|
* before we change the stack under gcc, and at appropriate times
|
|
* put into reggies and pushed (or as in most cases, they are evaled
|
|
* straight into reggies and pushed -- and in even more common cases
|
|
* they are already in reggies, and they are just pushed). not doing
|
|
* this with -fomit-frame-pointer was causing the temps (from evaluing
|
|
* the args) to be created on the stack, but when we changed sp
|
|
* from under gccs feet, the offsets to the temps ended up being wrong.
|
|
*
|
|
* 10/28/93 ++jrb
|
|
* relax the constraints on the inputs of trap_14_wwwwwww (only
|
|
* Rsconf maps to this) to "g" from "r", as these many "r" 's
|
|
* give gcc 2.>3.X heartaches (understandably). note this is ok
|
|
* since these args will never be expressions, and we never
|
|
* have to constrain hard enough to force eval before we change
|
|
* sp from underneath gcc.
|
|
*
|
|
*/
|
|
|
|
#ifndef _MINT_OSBIND_H
|
|
#define _MINT_OSBIND_H 1
|
|
|
|
#ifndef _FEATURES_H
|
|
# include <features.h>
|
|
#endif
|
|
|
|
#ifndef _MINT_OSTRUCT_H
|
|
# include <mint/ostruct.h>
|
|
#endif
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
/*
|
|
* GNU C (pseudo inline) Statement Exprs for traps
|
|
*
|
|
*/
|
|
|
|
#if __GNUC__ > 2 || __GNUC_MINOR__ > 5
|
|
#define AND_MEMORY , "memory"
|
|
#else
|
|
#define AND_MEMORY
|
|
#define __extension__
|
|
#endif
|
|
|
|
#define trap_1_w(n) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
addqw #2,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_ww(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
addqw #4,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wl(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wlw(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
short _b = (short)(b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
addqw #8,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wwll(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
long _c = (long) (c); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(12),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wlww(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
short _b = (short)(b); \
|
|
short _c = (short)(c); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(10),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wlwww(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (long)(b); \
|
|
long _c = (short) (c); \
|
|
long _d = (short) (d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(12),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_www(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wll(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(10),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wwlll(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
long _c = (long) (c); \
|
|
long _d = (long) (d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %5,sp@-; \
|
|
movl %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(16),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_1_wwwll(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
long _c = (long) (c); \
|
|
long _d = (long) (d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %5,sp@-; \
|
|
movl %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #1; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_wl(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_w(n) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
addqw #2,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_ww(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
addqw #4,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_www(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_wwlwww(n, a, b, c, d, e) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
short _e = (short)(e); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %6,sp@-; \
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), \
|
|
"r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_13_wwl(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #13; \
|
|
addqw #8,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wwl(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
addqw #8,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wwll(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
long _b = (long) (b); \
|
|
long _c = (long) (c); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(12),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_ww(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
addqw #4,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_w(n) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
addqw #2,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wllw(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(12),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wl(n, a) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_www(n, a, b) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
addqw #6,sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wllwwwww(n, a, b, c, d, e, f, g) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
short _e = (short)(e); \
|
|
short _f = (short)(f); \
|
|
short _g = (short)(g); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %8,sp@-; \
|
|
movw %7,sp@-; \
|
|
movw %6,sp@-; \
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(20),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), \
|
|
"r"(_c), "r"(_d), "r"(_e), "r"(_f), "r"(_g) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wllwwwwlw(n, a, b, c, d, e, f, g, h) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
short _e = (short)(e); \
|
|
short _f = (short)(f); \
|
|
long _g = (long) (g); \
|
|
short _h = (short)(h); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %9,sp@-; \
|
|
movl %8,sp@-; \
|
|
movw %7,sp@-; \
|
|
movw %6,sp@-; \
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(24),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c), \
|
|
"r"(_d), "r"(_e), "r"(_f), "r"(_g), "r"(_h) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wllwwwwwlw(n, a, b, c, d, e, f, g, h, i) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
short _e = (short)(e); \
|
|
short _f = (short)(f); \
|
|
short _g = (short)(g); \
|
|
long _h = (long) (h); \
|
|
short _i = (short)(i); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %9,sp@-; \
|
|
movl %8,sp@-; \
|
|
movw %7,sp@-; \
|
|
movw %6,sp@-; \
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movl %1,sp@-; \
|
|
movw %0,sp@- " \
|
|
: /* outputs */ \
|
|
: "g"(n), "g"(_a), "g"(_b), "g"(_c), "g"(_d), \
|
|
"g"(_e), "g"(_f), "g"(_g), "g"(_h), "g"(_i) /* inputs */ \
|
|
); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
trap #14; \
|
|
lea sp@(26),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
|
|
#define trap_14_wwwwwww(n, a, b, c, d, e, f) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
short _e = (short)(e); \
|
|
short _f = (short)(f); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %7,sp@-; \
|
|
movw %6,sp@-; \
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "g"(_a), \
|
|
"g"(_b), "g"(_c), "g"(_d), "g"(_e), "g"(_f) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wlll(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
long _c = (long) (c); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wllww(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
long _b = (long) (b); \
|
|
short _c = (short)(c); \
|
|
short _d = (short)(d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movl %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), \
|
|
"r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wwwwl(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
short _c = (short)(c); \
|
|
long _d = (long) (d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movl %5,sp@-; \
|
|
movw %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(12),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), \
|
|
"r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wwwl(n, a, b, c) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
short _a = (short)(a); \
|
|
short _b = (short)(b); \
|
|
long _c = (long)(c); \
|
|
\
|
|
__asm__ volatile \
|
|
(" \
|
|
movl %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movw %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(10),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), "r"(_a), "r"(_b), "r"(_c) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2" /* clobbered regs */ \
|
|
AND_MEMORY \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
#define trap_14_wlwlw(n, a, b, c, d) \
|
|
__extension__ \
|
|
({ \
|
|
register long retvalue __asm__("d0"); \
|
|
long _a = (long) (a); \
|
|
short _b = (short)(b); \
|
|
long _c = (long) (c); \
|
|
short _d = (short)(d); \
|
|
\
|
|
__asm__ volatile \
|
|
("\
|
|
movw %5,sp@-; \
|
|
movl %4,sp@-; \
|
|
movw %3,sp@-; \
|
|
movl %2,sp@-; \
|
|
movw %1,sp@-; \
|
|
trap #14; \
|
|
lea sp@(14),sp " \
|
|
: "=r"(retvalue) /* outputs */ \
|
|
: "g"(n), \
|
|
"r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs */ \
|
|
: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "memory" \
|
|
); \
|
|
retvalue; \
|
|
})
|
|
|
|
|
|
/* DEFINITIONS FOR OS FUNCTIONS */
|
|
|
|
/*
|
|
* GEMDOS (trap1)
|
|
*/
|
|
#define Pterm0() \
|
|
(void)trap_1_w((short)(0x00))
|
|
#define Cconin() \
|
|
(long)trap_1_w((short)(0x01))
|
|
#define Cconout(c) \
|
|
(void)trap_1_ww((short)(0x02),(short)(c))
|
|
#define Cauxin() \
|
|
(long)trap_1_w((short)(0x03))
|
|
#define Cauxout(c) \
|
|
(void)trap_1_ww((short)(0x04),(short)(c))
|
|
#define Cprnout(c) \
|
|
(void)trap_1_ww((short)(0x05),(short)(c))
|
|
#define Crawio(data) \
|
|
(long)trap_1_ww((short)(0x06),(short)(data))
|
|
#define Crawcin() \
|
|
(long)trap_1_w((short)(0x07))
|
|
#define Cnecin() \
|
|
(long)trap_1_w((short)(0x08))
|
|
#define Cconws(s) \
|
|
(void)trap_1_wl((short)(0x09),(long)(s))
|
|
#define Cconrs(buf) \
|
|
(void)trap_1_wl((short)(0x0A),(long)(buf))
|
|
#define Cconis() \
|
|
(short)trap_1_w((short)(0x0B))
|
|
#define Dsetdrv(d) \
|
|
(long)trap_1_ww((short)(0x0E),(short)(d))
|
|
#define Cconos() \
|
|
(short)trap_1_w((short)(0x10))
|
|
#define Cprnos() \
|
|
(short)trap_1_w((short)(0x11))
|
|
#define Cauxis() \
|
|
(short)trap_1_w((short)(0x12))
|
|
#define Cauxos() \
|
|
(short)trap_1_w((short)(0x13))
|
|
#define Dgetdrv() \
|
|
(short)trap_1_w((short)(0x19))
|
|
#define Fsetdta(dta) \
|
|
(void)trap_1_wl((short)(0x1A),(long)(dta))
|
|
|
|
/*
|
|
* The next binding is not quite right if used in another than the usual ways:
|
|
* 1. Super(1L) from either user or supervisor mode
|
|
* 2. ret = Super(0L) from user mode and after this Super(ret) from
|
|
* supervisor mode
|
|
* We get the following situations (usp, ssp relative to the start of Super):
|
|
* Parameter Userstack Superstack Calling Mode ret
|
|
* 1L usp ssp user 0L
|
|
* 1L usp ssp supervisor -1L
|
|
* 0L usp-6 usp user ssp
|
|
* 0L ssp ssp-6 supervisor ssp-6
|
|
* ptr usp-6 ptr+6 user ssp
|
|
* ptr usp+6 ptr supervisor sr
|
|
* The usual C-bindings are safe only because the "unlk a6" is compensating
|
|
* the errors when you invoke this function. In this binding the "unlk a6" at
|
|
* the end of the calling function compensates the error made in sequence 2
|
|
* above (the usp is 6 to low after the first call which is not corrected by
|
|
* the second call).
|
|
*/
|
|
#define Super(ptr) \
|
|
(long)trap_1_wl((short)(0x20),(long)(ptr))
|
|
/* Tos 1.4: Super(1L) : rets -1L if in super mode, 0L otherwise */
|
|
#define Tgetdate() \
|
|
(short)trap_1_w((short)(0x2A))
|
|
#define Tsetdate(date) \
|
|
(long)trap_1_ww((short)(0x2B),(short)(date))
|
|
#define Tgettime() \
|
|
(short)trap_1_w((short)(0x2C))
|
|
#define Tsettime(time) \
|
|
(long)trap_1_ww((short)(0x2D),(short)(time))
|
|
#define Fgetdta() \
|
|
(_DTA *)trap_1_w((short)(0x2F))
|
|
#define Sversion() \
|
|
(short)trap_1_w((short)(0x30))
|
|
#define Ptermres(save,rv) \
|
|
(void)trap_1_wlw((short)(0x31),(long)(save),(short)(rv))
|
|
#define Dfree(buf,d) \
|
|
(long)trap_1_wlw((short)(0x36),(long)(buf),(short)(d))
|
|
#define Dcreate(path) \
|
|
(short)trap_1_wl((short)(0x39),(long)(path))
|
|
#define Ddelete(path) \
|
|
(long)trap_1_wl((short)(0x3A),(long)(path))
|
|
#define Dsetpath(path) \
|
|
(long)trap_1_wl((short)(0x3B),(long)(path))
|
|
#define Fcreate(fn,mode) \
|
|
(long)trap_1_wlw((short)(0x3C),(long)(fn),(short)(mode))
|
|
#define Fopen(fn,mode) \
|
|
(long)trap_1_wlw((short)(0x3D),(long)(fn),(short)(mode))
|
|
#define Fclose(handle) \
|
|
(long)trap_1_ww((short)(0x3E),(short)(handle))
|
|
#define Fread(handle,cnt,buf) \
|
|
(long)trap_1_wwll((short)(0x3F),(short)(handle), \
|
|
(long)(cnt),(long)(buf))
|
|
#define Fwrite(handle,cnt,buf) \
|
|
(long)trap_1_wwll((short)(0x40),(short)(handle), \
|
|
(long)(cnt),(long)(buf))
|
|
#define Fdelete(fn) \
|
|
(long)trap_1_wl((short)(0x41),(long)(fn))
|
|
#define Fseek(where,handle,how) \
|
|
(long)trap_1_wlww((short)(0x42),(long)(where), \
|
|
(short)(handle),(short)(how))
|
|
#define Fattrib(fn,rwflag,attr) \
|
|
(short)trap_1_wlww((short)(0x43),(long)(fn), \
|
|
(short)(rwflag),(short)(attr))
|
|
#define Fdup(handle) \
|
|
(long)trap_1_ww((short)(0x45),(short)(handle))
|
|
#define Fforce(Hstd,Hnew) \
|
|
(long)trap_1_www((short)(0x46),(short)(Hstd),(short)(Hnew))
|
|
#define Dgetpath(buf,d) \
|
|
(long)trap_1_wlw((short)(0x47),(long)(buf),(short)(d))
|
|
#define Malloc(size) \
|
|
(long)trap_1_wl((short)(0x48),(long)(size))
|
|
#define Mfree(ptr) \
|
|
(long)trap_1_wl((short)(0x49),(long)(ptr))
|
|
#define Mshrink(ptr,size) \
|
|
(long)trap_1_wwll((short)(0x4A),(short)0,(long)(ptr),(long)(size))
|
|
#define Pexec(mode,prog,tail,env) \
|
|
(long)trap_1_wwlll((short)(0x4B),(short)(mode),(long)(prog), \
|
|
(long)(tail),(long)(env))
|
|
#define Pterm(rv) \
|
|
(void)trap_1_ww((short)(0x4C),(short)(rv))
|
|
#define Fsfirst(filespec,attr) \
|
|
(long)trap_1_wlw((short)(0x4E),(long)(filespec),(short)(attr))
|
|
#define Fsnext() \
|
|
(long)trap_1_w((short)(0x4F))
|
|
#define Frename(zero,old,new) \
|
|
(short)trap_1_wwll((short)(0x56),(short)(zero), \
|
|
(long)(old),(long)(new))
|
|
#define Fdatime(timeptr,handle,rwflag) \
|
|
(long)trap_1_wlww((short)(0x57),(long)(timeptr), \
|
|
(short)(handle),(short)(rwflag))
|
|
#define Flock(handle,mode,start,length) \
|
|
(long)trap_1_wwwll((short)(0x5C),(short)(handle), \
|
|
(short)(mode),(long)(start),(long)(length))
|
|
|
|
/*
|
|
* BIOS (trap13)
|
|
*/
|
|
#define Getmpb(ptr) \
|
|
(void)trap_13_wl((short)(0x00),(long)(ptr))
|
|
#define Bconstat(dev) \
|
|
(short)trap_13_ww((short)(0x01),(short)(dev))
|
|
#define Bconin(dev) \
|
|
(long)trap_13_ww((short)(0x02),(short)(dev))
|
|
#define Bconout(dev,c) \
|
|
(long)trap_13_www((short)(0x03),(short)(dev),(short)((c) & 0xFF))
|
|
/* since AHDI 3.1 there is a new call to Rwabs with one more parameter */
|
|
#define Rwabs(rwflag,buf,n,sector,d) \
|
|
(long)trap_13_wwlwww((short)(0x04),(short)(rwflag),(long)(buf), \
|
|
(short)(n),(short)(sector),(short)(d))
|
|
#define Setexc(vnum,vptr) \
|
|
(void (*) __PROTO((void)))trap_13_wwl((short)(0x05),(short)(vnum),(long)(vptr))
|
|
#define Tickcal() \
|
|
(long)trap_13_w((short)(0x06))
|
|
#define Getbpb(d) \
|
|
(void *)trap_13_ww((short)(0x07),(short)(d))
|
|
#define Bcostat(dev) \
|
|
(short)trap_13_ww((short)(0x08),(short)(dev))
|
|
#define Mediach(dev) \
|
|
(short)trap_13_ww((short)(0x09),(short)(dev))
|
|
#define Drvmap() \
|
|
(long)trap_13_w((short)(0x0A))
|
|
#define Kbshift(data) \
|
|
(long)trap_13_ww((short)(0x0B),(short)(data))
|
|
#define Getshift() \
|
|
Kbshift(-1)
|
|
|
|
|
|
/*
|
|
* XBIOS (trap14)
|
|
*/
|
|
|
|
#define Initmous(type,param,vptr) \
|
|
(void)trap_14_wwll((short)(0x00),(short)(type), \
|
|
(long)(param),(long)(vptr))
|
|
#define Ssbrk(size) \
|
|
(void *)trap_14_ww((short)(0x01),(short)(size))
|
|
#define Physbase() \
|
|
(void *)trap_14_w((short)(0x02))
|
|
#define Logbase() \
|
|
(void *)trap_14_w((short)(0x03))
|
|
#define Getrez() \
|
|
(short)trap_14_w((short)(0x04))
|
|
#define Setscreen(lscrn,pscrn,rez) \
|
|
(void)trap_14_wllw((short)(0x05),(long)(lscrn),(long)(pscrn), \
|
|
(short)(rez))
|
|
#define Setpalette(palptr) \
|
|
(void)trap_14_wl((short)(0x06),(long)(palptr))
|
|
#define Setcolor(colornum,mixture) \
|
|
(short)trap_14_www((short)(0x07),(short)(colornum),(short)(mixture))
|
|
#define Floprd(buf,x,d,sect,trk,side,n) \
|
|
(short)trap_14_wllwwwww((short)(0x08),(long)(buf),(long)(x), \
|
|
(short)(d),(short)(sect),(short)(trk),(short)(side),(short)(n))
|
|
#define Flopwr(buf,x,d,sect,trk,side,n) \
|
|
(short)trap_14_wllwwwww((short)(0x09),(long)(buf),(long)(x), \
|
|
(short)(d),(short)(sect),(short)(trk),(short)(side),(short)(n))
|
|
#define Flopfmt(buf,x,d,spt,t,sd,i,m,v) \
|
|
(short)trap_14_wllwwwwwlw((short)(0x0A),(long)(buf),(long)(x), \
|
|
(short)(d),(short)(spt),(short)(t),(short)(sd),(short)(i), \
|
|
(long)(m),(short)(v))
|
|
#define Midiws(cnt,ptr) \
|
|
(void)trap_14_wwl((short)(0x0C),(short)(cnt),(long)(ptr))
|
|
#define Mfpint(vnum,vptr) \
|
|
(void)trap_14_wwl((short)(0x0D),(short)(vnum),(long)(vptr))
|
|
#define Iorec(ioDEV) \
|
|
(void *)trap_14_ww((short)(0x0E),(short)(ioDEV))
|
|
#define Rsconf(baud,flow,uc,rs,ts,sc) \
|
|
(long)trap_14_wwwwwww((short)(0x0F),(short)(baud),(short)(flow), \
|
|
(short)(uc),(short)(rs),(short)(ts),(short)(sc))
|
|
/* ret old val: MSB -> ucr:8, rsr:8, tsr:8, scr:8 <- LSB */
|
|
#define Keytbl(nrml,shft,caps) \
|
|
(void *)trap_14_wlll((short)(0x10),(long)(nrml), \
|
|
(long)(shft),(long)(caps))
|
|
#define Random() \
|
|
(long)trap_14_w((short)(0x11))
|
|
#define Protobt(buf,serial,dsktyp,exec) \
|
|
(void)trap_14_wllww((short)(0x12),(long)(buf),(long)(serial), \
|
|
(short)(dsktyp),(short)(exec))
|
|
#define Flopver(buf,x,d,sect,trk,sd,n) \
|
|
(short)trap_14_wllwwwww((short)(0x13),(long)(buf),(long)(x),(short)(d),\
|
|
(short)(sect),(short)(trk),(short)(sd),(short)(n))
|
|
#define Scrdmp() \
|
|
(void)trap_14_w((short)(0x14))
|
|
#define Cursconf(rate,attr) \
|
|
(short)trap_14_www((short)(0x15),(short)(rate),(short)(attr))
|
|
#define Settime(time) \
|
|
(void)trap_14_wl((short)(0x16),(long)(time))
|
|
#define Gettime() \
|
|
(long)trap_14_w((short)(0x17))
|
|
#define Bioskeys() \
|
|
(void)trap_14_w((short)(0x18))
|
|
#define Ikbdws(len_minus1,ptr) \
|
|
(void)trap_14_wwl((short)(0x19),(short)(len_minus1),(long)(ptr))
|
|
#define Jdisint(vnum) \
|
|
(void)trap_14_ww((short)(0x1A),(short)(vnum))
|
|
#define Jenabint(vnum) \
|
|
(void)trap_14_ww((short)(0x1B),(short)(vnum))
|
|
#define Giaccess(data,reg) \
|
|
(short)trap_14_www((short)(0x1C),(short)(data),(short)(reg))
|
|
#define Offgibit(ormask) \
|
|
(void)trap_14_ww((short)(0x1D),(short)(ormask))
|
|
#define Ongibit(andmask) \
|
|
(void)trap_14_ww((short)(0x1E),(short)(andmask))
|
|
#define Xbtimer(timer,ctrl,data,vptr) \
|
|
(void)trap_14_wwwwl((short)(0x1F),(short)(timer),(short)(ctrl), \
|
|
(short)(data),(long)(vptr))
|
|
#define Dosound(ptr) \
|
|
(void)trap_14_wl((short)(0x20),(long)(ptr))
|
|
#define Setprt(config) \
|
|
(short)trap_14_ww((short)(0x21),(short)(config))
|
|
#define Kbdvbase() \
|
|
(_KBDVECS*)trap_14_w((short)(0x22))
|
|
#define Kbrate(delay,reprate) \
|
|
(short)trap_14_www((short)(0x23),(short)(delay),(short)(reprate))
|
|
#define Prtblk(pblkptr) \
|
|
(void)trap_14_wl((short)(0x24),(long)(pblkptr)) /* obsolete ? */
|
|
#define Vsync() \
|
|
(void)trap_14_w((short)(0x25))
|
|
#define Supexec(funcptr) \
|
|
(long)trap_14_wl((short)(0x26),(long)(funcptr))
|
|
#define Puntaes() \
|
|
(void)trap_14_w((short)(0x27))
|
|
#define Floprate(drive,rate) \
|
|
(short)trap_14_www((short)(0x29),(short)(drive),(short)(rate))
|
|
#define Blitmode(flag) \
|
|
(short)trap_14_ww((short)(0x40),(short)(flag))
|
|
/*
|
|
* Flag:
|
|
* -1: get config
|
|
* !-1: set config previous config returned
|
|
* bit
|
|
* 0 0 blit mode soft 1 blit mode hardware
|
|
* 1 0 no blitter 1 blitter present
|
|
* 2..14 reserved
|
|
* 15 must be zero on set/returned as zero
|
|
* blitmode (bit 0) forced to soft if no blitter(bit 1 == 0).
|
|
*/
|
|
|
|
/*
|
|
* extensions for TT TOS
|
|
*/
|
|
|
|
#define Mxalloc(amt,flag) \
|
|
(long)trap_1_wlw((short)(0x44),(long)(amt),(short)(flag))
|
|
#define Maddalt(start,size) \
|
|
(long)trap_1_wll((short)(0x14),(long)(start),(long)(size))
|
|
|
|
#define EsetShift(mode) \
|
|
(void)trap_14_ww((short)(80),(short)mode)
|
|
#define EgetShift() \
|
|
(short)trap_14_w((short)(81))
|
|
#define EsetBank(bank) \
|
|
(short)trap_14_ww((short)(82),(short)bank)
|
|
#define EsetColor(num,val) \
|
|
(short)trap_14_www((short)(83),(short)num,(short)val)
|
|
#define EsetPalette(start,count,ptr) \
|
|
(void)trap_14_wwwl((short)(84),(short)start,(short)count,(long)ptr)
|
|
#define EgetPalette(start,count,ptr) \
|
|
(void)trap_14_wwwl((short)(85),(short)start,(short)count,(long)ptr)
|
|
#define EsetGray(mode) \
|
|
(short)trap_14_ww((short)(86),(short)mode)
|
|
#define EsetSmear(mode) \
|
|
(short)trap_14_ww((short)(87),(short)mode)
|
|
|
|
#define DMAread(sector,count,buffer,devno) \
|
|
(long)trap_14_wlwlw((short)0x2a,(long)sector,(short)count,(long)buffer, \
|
|
(short)devno)
|
|
#define DMAwrite(sector,count,buffer,devno) \
|
|
(long)trap_14_wlwlw((short)0x2b,(long)sector,(short)count,(long)buffer, \
|
|
(short)devno)
|
|
#define Bconmap(dev) \
|
|
(long)trap_14_ww((short)0x2c,(short)(dev))
|
|
#define NVMaccess(op,start,count,buf) \
|
|
(short)trap_14_wwwwl((short)0x2e,(short)op,(short)start,(short)count, \
|
|
(long)buf)
|
|
|
|
/* Wake-up call for ST BOOK -- takes date/time pair in DOS format. */
|
|
|
|
#define Waketime(w_date, w_time) \
|
|
(void)trap_14_www((short)(0x2f),(unsigned short)(w_date), \
|
|
(unsigned short)(w_time))
|
|
|
|
__END_DECLS
|
|
|
|
|
|
#endif /* _MINT_OSBIND_H */
|