]> 4ch.mooo.com Git - 16.git/blob - 16/xlib/xlib.inc
cleaned up the repo from debugging watcom2 ^^
[16.git] / 16 / xlib / xlib.inc
1 ;-----------------------------------------------------------------------\r
2 ;\r
3 ; XLIB - Include file\r
4 ;\r
5 ; Global equates and variables\r
6 ;\r
7 ;\r
8 ; ****** XLIB - Mode X graphics library                ****************\r
9 ; ******                                               ****************\r
10 ; ****** Written By Themie Gouthas                     ****************\r
11 ;\r
12 ; egg@dstos3.dsto.gov.au\r
13 ; teg@bart.dsto.gov.au\r
14 ;\r
15 ; MODIFICATIONS:\r
16 ;  26-9-92 :       Pel panning code added\r
17 ;  23-10-92:       Added clip rectangle code\r
18 ;-----------------------------------------------------------------------\r
19 \r
20 ;\r
21 \r
22 ;.global\r
23 ;.8086\r
24 \r
25 ; First lets find out what memory model to use\r
26 ;.model huge\r
27 ;include model.inc\r
28 \r
29 \r
30 AC_INDEX        equ  03c0h   ;Attribute controller index register\r
31 MISC_OUTPUT     equ  03c2h   ;Miscellaneous Output register\r
32 SC_INDEX        equ  03c4h   ;Sequence Controller Index\r
33 GC_INDEX        equ  03ceh   ; Graphics controller Index\r
34 CRTC_INDEX      equ  03d4h   ;CRT Controller Index\r
35 DAC_READ_INDEX  equ  03c7h   ;\r
36 DAC_WRITE_INDEX equ  03c8h   ;\r
37 DAC_DATA        equ  03c9h   ;\r
38 INPUT_STATUS_0 equ   03dah   ;Input status 0 register\r
39 \r
40 \r
41 SCREEN_SEG    equ    0a000h  ;segment of display memory in mode X\r
42 \r
43 MAP_MASK      equ    02h     ;index in SC of Map Mask register\r
44 READ_MAP      equ    04h     ;index in GC of the Read Map register\r
45 BIT_MASK      equ    08h     ;index in GC of Bit Mask register\r
46 \r
47 OVERFLOW      equ    07h     ; CRTC overflow register index\r
48 MAX_SCAN_LINE equ    09h     ; CRTC maximum scan line register index\r
49 ADDR_HIGH     equ    0ch     ;Index of Start Address High reg in CRTC\r
50 ADDR_LOW      equ    0dh     ;                       Low\r
51 CRTC_OFFSET   equ    13h     ; CRTC offset register index\r
52 UNDERLINE     equ    14h     ; CRTC underline location register index\r
53 MODE_CONTROL  equ    17h     ; CRTC mode control register index\r
54 LINE_COMPARE  equ    18h     ; CRTC line compare reg. index (bits 0-7 of\r
55                              ; split screen scan line\r
56 \r
57 AC_MODE_CONTROL equ    10h   ; Index of Mode COntrol register in AC\r
58 PEL_PANNING     equ    13h   ; Pel panning register index in AC\r
59 \r
60 PATTERN_BUFFER equ 0fffch    ;offset in screen memory of pattern buffer\r
61 \r
62 TRUE    equ 1\r
63 FALSE   equ 0\r
64 \r
65 \r
66 OK             equ 0\r
67 ERROR          equ 1\r
68 \r
69 \r
70 ;-----------------------------------------------------------------------\r
71 ; Macro to wait for the vertical retrace leading edge\r
72 \r
73 WaitVsyncStart   macro\r
74         LOCAL WaitNotVsync,WaitVsync\r
75         mov     dx,INPUT_STATUS_0\r
76 WaitNotVsync:\r
77         in      al,dx\r
78         test    al,08h\r
79         jnz     WaitNotVsync\r
80 WaitVsync:\r
81         in      al,dx\r
82         test    al,08h\r
83         jz      WaitVsync\r
84         endm\r
85 \r
86 ;-----------------------------------------------------------------------\r
87 ; Macro to wait for the vertical retrace trailing edge\r
88 \r
89 WaitVsyncEnd    macro\r
90         LOCAL WaitNotVsync,WaitVsync\r
91         mov     dx,INPUT_STATUS_0\r
92 WaitVsync2:\r
93         in      al,dx\r
94         test    al,08h\r
95         jz      WaitVsync2\r
96 WaitNotVsync2:\r
97         in      al,dx\r
98         test    al,08h\r
99         jnz     WaitNotVsync2\r
100         endm\r
101 \r
102 ;--- Word out macro ------------------------------------------\r
103 \r
104      WORDOUT  macro\r
105      IFDEF nw\r
106        out  dx,al\r
107        inc  dx\r
108        xchg al,ah\r
109        out  dx,al\r
110        xchg al,ah\r
111        dec  dx\r
112      ELSE\r
113        out  dx,al\r
114      ENDIF\r
115      endm\r
116 \r
117 ;------------------------------------------------------------------------\r
118 ; Global variables - XMAIN exports\r
119 ;\r
120         global _InGraphics              :byte\r
121         global _CurrXMode               :word\r
122         global _ScrnPhysicalByteWidth   :word\r
123         global _ScrnPhysicalPixelWidth  :word\r
124         global _ScrnPhysicalHeight      :word\r
125         global _ErrorValue              :byte\r
126 \r
127         global _SplitScrnOffs           :word\r
128         global _SplitScrnScanLine       :word\r
129         global _SplitScrnVisibleHeight  :word\r
130         global _Page0_Offs              :word\r
131         global _Page1_Offs              :word\r
132         global _Page2_Offs              :word\r
133         global _ScrnLogicalByteWidth    :word\r
134         global _ScrnLogicalPixelWidth   :word\r
135         global _ScrnLogicalHeight       :word\r
136 \r
137         global _MaxScrollX              :word\r
138         global _MaxScrollY              :word\r
139         global _DoubleBufferActive      :word\r
140         global _TrippleBufferActive     :word\r
141         global _VisiblePageIdx          :word\r
142         global _VisiblePageOffs         :word\r
143         global _HiddenPageOffs          :word\r
144         global _WaitingPageOffs         :word\r
145         global _NonVisual_Offs          :word\r
146         global _TopClip                 :word\r
147         global _BottomClip              :word\r
148         global _LeftClip                :word\r
149         global _RightClip               :word\r
150 \r
151         global _PhysicalStartByteX      :word\r
152         global _PhysicalStartPixelX     :word\r
153         global _PhysicalStartY          :word\r
154 \r
155         global _VsyncHandlerActive      :word\r
156         global _MouseRefreshFlag        :word\r
157         global _MouseVsyncHandler       :dword\r
158         global _StartAddressFlag        :word\r
159         global _WaitingStartLow         :word\r
160         global _WaitingStartHigh        :word\r
161         global _WaitingPelPan           :word\r
162         global _VsyncPaletteStart       :word\r
163         global _VsyncPaletteCount       :word\r
164         global _VsyncPaletteBuffer      :byte\r