]> git.sur5r.net Git - cc65/blob - libsrc/telestrat/tgi/telestrat-240-200-2.s
Correction : authors
[cc65] / libsrc / telestrat / tgi / telestrat-240-200-2.s
1 ;
2 ; Graphics driver for the 240x200x2 monochrome mode on the Atmos
3 ;
4 ; Jede (jede@oric.org), 2017-10-15
5
6
7         .include        "zeropage.inc"
8
9         .include        "tgi-kernel.inc"
10         .include        "tgi-error.inc"
11         .include        "telestrat.inc"
12
13         .macpack        generic
14         .macpack        module
15
16 XSIZE   =       6                       ; System font width
17 YSIZE   =       8                       ; System font height
18
19 ; ------------------------------------------------------------------------
20 ; Header. Includes jump table and constants.
21
22         module_header   _telestrat_240_200_2_tgi
23
24 ; First part of the header is a structure that has a magic and defines the
25 ; capabilities of the driver
26
27         .byte   $74, $67, $69           ; "tgi"
28         .byte   TGI_API_VERSION         ; TGI API version number
29         .addr   $0000                   ; Library reference
30         .word   240                     ; X resolution
31         .word   200                     ; Y resolution
32         .byte   2                       ; Number of drawing colors
33         .byte   1                       ; Number of screens available
34         .byte   XSIZE                   ; System font X size
35         .byte   YSIZE                   ; System font Y size
36         .word   $011C                   ; Aspect ratio (based on 4/3 display)
37         .byte   0                       ; TGI driver flags
38
39 ; Next comes the jump table. Currently all entries must be valid and may point
40 ; to an RTS for test versions (function not implemented).
41
42         .addr   INSTALL
43         .addr   UNINSTALL
44         .addr   INIT
45         .addr   DONE
46         .addr   GETERROR
47         .addr   CONTROL
48         .addr   CLEAR
49         .addr   SETVIEWPAGE
50         .addr   SETDRAWPAGE
51         .addr   SETCOLOR
52         .addr   SETPALETTE
53         .addr   GETPALETTE
54         .addr   GETDEFPALETTE
55         .addr   SETPIXEL
56         .addr   GETPIXEL
57         .addr   LINE
58         .addr   BAR
59         .addr   TEXTSTYLE
60         .addr   OUTTEXT
61         .addr   0                       ; IRQ entry is unused
62
63 ; ------------------------------------------------------------------------
64 ; Data.
65
66 ; Variables mapped to the zero page segment variables. Some of these are
67 ; used for passing parameters to the driver.
68
69 X1              := ptr1
70 Y1              := ptr2
71 X2              := ptr3
72 Y2              := ptr4
73
74 ; Absolute variables used in the code
75
76 .bss
77
78 ERROR:          .res    1       ; Error code
79 MODE:           .res    1       ; Graphics mode
80
81 ; Constant table
82
83 .rodata
84
85 DEFPALETTE:     .byte   0, 1
86
87 .code
88
89 ; ------------------------------------------------------------------------
90 ; INSTALL routine. Is called after the driver is loaded into memory. May
91 ; initialize anything that has to be done just once. Is probably empty
92 ; most of the time.
93 ;
94 ; Must set an error code: NO
95 ;
96
97 INSTALL:
98
99 ; ------------------------------------------------------------------------
100 ; UNINSTALL routine. Is called before the driver is removed from memory. May
101 ; clean up anything done by INSTALL but is probably empty most of the time.
102 ;
103 ; Must set an error code: NO
104 ;
105
106 UNINSTALL:
107         rts
108
109 ; ------------------------------------------------------------------------
110 ; INIT: Changes an already installed device from text mode to graphics
111 ; mode.
112 ; Note that INIT/DONE may be called multiple times while the driver
113 ; is loaded, while INSTALL is only called once, so any code that is needed
114 ; to initializes variables and so on must go here. Setting palette and
115 ; clearing the screen is not needed because this is called by the graphics
116 ; kernel later.
117 ; The graphics kernel will never call INIT when a graphics mode is already
118 ; active, so there is no need to protect against that.
119 ;
120 ; Must set an error code: YES
121 ;
122
123 INIT:
124
125 ; Switch into graphics mode
126
127         BRK_TELEMON(XHIRES)
128         rts
129 ; Done, reset the error code
130
131         lda     #TGI_ERR_OK
132         sta     ERROR
133         rts
134
135 ; ------------------------------------------------------------------------
136 ; DONE: Will be called to switch the graphics device back into text mode.
137 ; The graphics kernel will never call DONE when no graphics mode is active,
138 ; so there is no need to protect against that.
139 ;
140 ; Must set an error code: NO
141 ;
142
143 DONE:
144         BRK_TELEMON(XTEXT)
145         rts
146
147 ; ------------------------------------------------------------------------
148 ; GETERROR: Return the error code in A and clear it.
149
150 GETERROR:
151         ldx     #TGI_ERR_OK
152         lda     ERROR
153         stx     ERROR
154         rts
155
156 ; ------------------------------------------------------------------------
157 ; CONTROL: Platform/driver specific entry point.
158 ;
159 ; Must set an error code: YES
160 ;
161
162 CONTROL:
163         ; not done yet
164         rts
165
166 ; ------------------------------------------------------------------------
167 ; CLEAR: Clears the screen.
168 ;
169 ; Must set an error code: NO
170 ;
171
172 CLEAR:
173         ; not done yet
174         rts
175
176 ; ------------------------------------------------------------------------
177 ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n).
178 ; The page number is already checked to be valid by the graphics kernel.
179 ;
180 ; Must set an error code: NO (will only be called if page ok)
181 ;
182
183 SETVIEWPAGE:
184
185 ; ------------------------------------------------------------------------
186 ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n).
187 ; The page number is already checked to be valid by the graphics kernel.
188 ;
189 ; Must set an error code: NO (will only be called if page ok)
190 ;
191
192 SETDRAWPAGE:
193         rts
194
195 ; ------------------------------------------------------------------------
196 ; SETCOLOR: Set the drawing color (in A). The new color is already checked
197 ; to be in a valid range (0..maxcolor-1).
198 ;
199 ; Must set an error code: NO (will only be called if color ok)
200 ;
201
202 SETCOLOR:
203         ;not done yet
204         rts
205
206 ; ------------------------------------------------------------------------
207 ; SETPALETTE: Set the palette (not available with all drivers/hardware).
208 ; A pointer to the palette is passed in ptr1. Must set an error if palettes
209 ; are not supported
210 ;
211 ; Must set an error code: YES
212 ;
213
214 SETPALETTE:
215         lda     #TGI_ERR_INV_FUNC       ; This resolution has no palette
216         sta     ERROR
217         rts
218
219 ; ------------------------------------------------------------------------
220 ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
221 ; set the palette should return the default palette here, so there's no
222 ; way for this function to fail.
223 ;
224 ; Must set an error code: NO
225 ;
226
227 GETPALETTE:
228
229 ; ------------------------------------------------------------------------
230 ; GETDEFPALETTE: Return the default palette for the driver in A/X. All
231 ; drivers should return something reasonable here, even drivers that don't
232 ; support palettes, otherwise the caller has no way to determine the colors
233 ; of the (not changeable) palette.
234 ;
235 ; Must set an error code: NO (all drivers must have a default palette)
236 ;
237
238 GETDEFPALETTE:
239         ; not done yet
240         rts
241
242 ; ------------------------------------------------------------------------
243 ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing
244 ; color. The coordinates passed to this function are never outside the
245 ; visible screen area, so there is no need for clipping inside this function.
246 ;
247 ; Must set an error code: NO
248 ;
249
250 SETPIXEL:
251         ; not done yet
252         rts
253
254 ; ------------------------------------------------------------------------
255 ; GETPIXEL: Read the color value of a pixel and return it in A/X. The
256 ; coordinates passed to this function are never outside the visible screen
257 ; area, so there is no need for clipping inside this function.
258
259 GETPIXEL:
260         ; not done yet
261         rts
262
263 ; ------------------------------------------------------------------------
264 ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and
265 ; X2/Y2 = ptr3/ptr4 using the current drawing color.
266 ;
267 ; Must set an error code: NO
268 ;
269
270 LINE:
271       ; not done yet
272       rts
273 ; ------------------------------------------------------------------------
274 ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
275 ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color.
276 ; Contrary to most other functions, the graphics kernel will sort and clip
277 ; the coordinates before calling the driver, so on entry the following
278 ; conditions are valid:
279 ;       X1 <= X2
280 ;       Y1 <= Y2
281 ;       (X1 >= 0) && (X1 < XRES)
282 ;       (X2 >= 0) && (X2 < XRES)
283 ;       (Y1 >= 0) && (Y1 < YRES)
284 ;       (Y2 >= 0) && (Y2 < YRES)
285 ;
286 ; Must set an error code: NO
287 ;
288
289 BAR:
290         ; not done yet
291         rts
292
293 ; ------------------------------------------------------------------------
294 ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
295 ; direction is passend in X/Y, the text direction is passed in A.
296 ;
297 ; Must set an error code: NO
298 ;
299
300 TEXTSTYLE:
301         rts
302
303
304 ; ------------------------------------------------------------------------
305 ; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the
306 ; current text style. The text to output is given as a zero terminated
307 ; string with address in ptr3.
308 ;
309 ; Must set an error code: NO
310 ;
311
312 OUTTEXT:
313         ; Not done yet
314         rts