Annotation of researchv9/jerq/include/CC/jerq.h, revision 1.1

1.1     ! root        1: /*
        !             2:  *  Model 5620 DMD
        !             3:  */
        !             4: #ifndef JERQ_H
        !             5: #define JERQ_H
        !             6: #include <sys/2681.h>
        !             7: #line 31416
        !             8: 
        !             9: #define        DUART           ((struct duart *)0x200000)
        !            10: #define        TVIDEO          (DUART->scc_sopbc = 0x02)
        !            11: #define        RVIDEO          (DUART->scc_ropbc = 0x02)
        !            12: #define        BonW()          RVIDEO
        !            13: #define        WonB()          TVIDEO
        !            14: #define        DADDR           ((unsigned short *)(0x500000))  /* display base address/4 */
        !            15: #define        YMOUSE          ((short *)(0x400000))
        !            16: #define        XMOUSE          ((short *)(0x400002))
        !            17: #define        WORDSHIFT       5
        !            18: #define        WORDSIZE        32
        !            19: #define        WORDMASK        (WORDSIZE-1)
        !            20: #define        ONES            0xFFFFFFFF
        !            21: #define        FIRSTBIT        ((unsigned)0x80000000)
        !            22: #define        LASTBIT         ((unsigned)0x1)
        !            23: #define        XMAX            800
        !            24: #define        YMAX            1024
        !            25: 
        !            26: /*
        !            27:  *     Graphics definitions
        !            28:  */
        !            29: 
        !            30: typedef int    Word;           /* 32 bits */
        !            31: 
        !            32: typedef unsigned int   UWord;  /* 32 bits */
        !            33: 
        !            34: class Rectangle;
        !            35: 
        !            36: class Point {
        !            37: public:
        !            38:        short x,y;
        !            39:        Point(){}
        !            40:        Point(int u, int v)     {x=u; y=v;}
        !            41:        Point operator-()               {return Point(-x,-y);}
        !            42:        Point operator+(Point p)        {return Point(x+p.x,y+p.y);}
        !            43:        Point operator-(Point p)        {return Point(x-p.x,y-p.y);}
        !            44:        Point operator*(int i)  {return Point(x*i,y*i);}
        !            45:        Point operator/(int i)  {return Point(x/i,y/i);}
        !            46:        Point operator%(int i)  {return Point(x%i,y%i);}
        !            47:        Point operator&(int i)  {return Point(x&i,y&i);}
        !            48:        Point operator+=(Point p)       {return Point(x+=p.x,y+=p.y);}
        !            49:        Point operator-=(Point p)       {return Point(x-=p.x,y-=p.y);}
        !            50:        int operator==(Point p) {return x==p.x && y==p.y;}
        !            51:        int operator!=(Point p) {return x!=p.x || y!=p.y;}
        !            52:        int operator>=(Point p) {return x>=p.x && y>=p.y;}
        !            53:        int operator<=(Point p) {return x<=p.x && y<=p.y;}
        !            54:        int operator>(Point p)  {return x>p.x && y>p.y;}
        !            55:        int operator<(Point p)  {return x<p.x && y<p.y;}
        !            56:        inline int operator<(Rectangle);
        !            57:        inline int operator<=(Rectangle);
        !            58:        inline int operator>(Rectangle);
        !            59: };
        !            60: 
        !            61: class Rectangle {
        !            62: public:
        !            63:        Point o,c;      /* origin, corner */
        !            64:        Rectangle(){}
        !            65:        Rectangle(Point p, Point q)     {o=p; c=q;}
        !            66:        Rectangle(int x, int y, int u, int v)   {o.x=x; o.y=y; c.x=u; c.y=v;}
        !            67:        Rectangle operator+(Point p)    {return Rectangle(o+p,c+p);}
        !            68:        Rectangle operator-(Point p)    {return Rectangle(o-p,c-p);}
        !            69:        Rectangle translate(Point p)    {return Rectangle(p,c+(p-o));}
        !            70:        int operator<(Rectangle);
        !            71:        int operator<=(Rectangle);
        !            72:        Point center()          {return (o+c)/2;}
        !            73:        Rectangle mbb(Point);           /* assumes a sorted Rectangle */
        !            74:        Rectangle mbb(Rectangle);       /* ditto for argument */
        !            75: };
        !            76: inline int Point.operator<(Rectangle r) {return *this>r.o && *this<r.c;}
        !            77: inline int Point.operator<=(Rectangle r) {return *this>=r.o && *this<=r.c;}
        !            78: inline int Point.operator>(Rectangle r) {return !(*this<=r);}
        !            79: inline int Rectangle.operator<(Rectangle r)    {return o<r && c<r;}
        !            80: inline int Rectangle.operator<=(Rectangle r)   {return o<=r && c<=r;}
        !            81: 
        !            82: class Bitmap {
        !            83: public:
        !            84:        Word    *base;          /* Pointer to start of data */
        !            85:        unsigned width;         /* width in 32 bit words of total data area */
        !            86:        Rectangle rect;         /* Rectangle in data area, local coords */
        !            87:        char    *_null;         /* unused, always zero */
        !            88:        Bitmap(Word *b, int w, Rectangle r)     {base=b; width=w; rect=r;}
        !            89:        Bitmap(Rectangle r)     {rect = r;}
        !            90: };
        !            91: 
        !            92: class Menu {
        !            93: public:
        !            94:        char    **item;                 /* string array, ending with 0 */
        !            95:        char    *(*generator)(int);     /* used if item == 0 */
        !            96:        short   prevhit;                /* private to menuhit() */
        !            97:        short   prevtop;                /* private to menuhit() */
        !            98: };
        !            99: 
        !           100: class Texture32 {
        !           101: public:
        !           102:        short bits[64];
        !           103: };
        !           104: 
        !           105: class Texture {
        !           106: public:
        !           107:        short   bits[16];
        !           108: };
        !           109: 
        !           110: class Layer;
        !           111: class Font;
        !           112: 
        !           113: extern struct Mouse {
        !           114:        Mouse() {}
        !           115:        Point   xy;
        !           116:        short   buttons;
        !           117: } mouse;
        !           118: 
        !           119: #define button(i)              (mouse.buttons&(8>>i))
        !           120: #define button1()              (mouse.buttons&4)
        !           121: #define button2()              (mouse.buttons&2)
        !           122: #define button3()              (mouse.buttons&1)
        !           123: #define button12()             (mouse.buttons&6)
        !           124: #define button13()             (mouse.buttons&5)
        !           125: #define button23()             (mouse.buttons&3)
        !           126: #define button123()            (mouse.buttons&7)
        !           127: 
        !           128: Rectangle getrectb(), getrect();
        !           129: #define getrect1()             getrectb(4)
        !           130: #define getrect2()             getrectb(2)
        !           131: #define getrect3()             getrectb(1)
        !           132: #define getrect12()            getrectb(6)
        !           133: #define getrect13()            getrectb(5)
        !           134: #define getrect23()            getrectb(3)
        !           135: #define getrect123()           getrectb(7)
        !           136: 
        !           137: #define Pt(x,y)                Point(x,y)
        !           138: #define Rect(x,y,u,v)  Rectangle(x,y,u,v)
        !           139: #define Rpt(p,q)       Rectangle(p,q)
        !           140: #define        muldiv(a,b,c)   ((long)((a)*((long)b)/(c)))
        !           141: 
        !           142: extern Word topbits[], botbits[];      /* now full 32 bit words */
        !           143: extern Rectangle Jrect;
        !           144: extern Bitmap display;
        !           145: 
        !           146: /*
        !           147:  * Function Codes
        !           148:  */
        !           149: typedef int    Code;
        !           150: #define        F_STORE ((Code) 0)      /* target = source */
        !           151: #define        F_OR    ((Code) 1)      /* target |= source */
        !           152: #define        F_CLR   ((Code) 2)      /* target &= ~source */
        !           153: #define        F_XOR   ((Code) 3)      /* target ^= source */
        !           154: #define        NULL    ((char *)0)
        !           155: #define        KBD     1
        !           156: #define        SEND    2
        !           157: #define        MOUSE   4
        !           158: #define        RCV     8
        !           159: #define        CPU     16
        !           160: #define ALARM  32
        !           161: 
        !           162: #define ringbell()     DUART->b_data=0x08,nap(3),DUART->b_data=0
        !           163: 
        !           164: #ifdef MUX
        !           165: #include <CC/mux.h>
        !           166: extern Rectangle Drect;
        !           167: #endif
        !           168: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.