Subversion Repositories SvarDOS

Rev

Rev 1360 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1360 mateusz.vi 1
/*
2
 * a few functions for mode 12h programming (640x480 4bpp)
3
 *
4
 * This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
5
 * Published under the terms of the MIT License, as stated below.
6
 *
7
 * Copyright (C) 2022 Mateusz Viste
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10
 * of this software and associated documentation files (the "Software"), to
11
 * deal in the Software without restriction, including without limitation the
12
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13
 * sell copies of the Software, and to permit persons to whom the Software is
14
 * furnished to do so, subject to the following conditions:
15
 *
16
 * The above copyright notice and this permission notice shall be included in
17
 * all copies or substantial portions of the Software.
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25
 * IN THE SOFTWARE.
26
 */
27
 
28
#ifndef MDR_VID12_H
29
 
30
  #define MDR_VID12_H
31
 
32
  /* init video mode 12h (640x480x16c) */
33
  void vid12_init(void);
34
 
35
  /* Wait until VBLANK */
36
  void vid12_waitvblank(void);
37
 
38
  /* clear screen using color
39
   * this function is fastest when color is 0 or 15 */
40
  void vid12_cls(unsigned char color);
41
 
42
  /* clear a single scanline (0..479) with a solid color (0..15)
43
   * this function is fastest when color is 0 or 15 */
44
  void vid12_clrline(unsigned short line, unsigned char color);
45
 
46
  /* fill lines from linefirst to linelast with an 8 pixels pattern
47
   * linelast must be equal to or greater than linelast
48
   * pattern must be 8 bytes long */
49
  void vid12_linepat(unsigned short linefirst, unsigned short linelast, const unsigned char *pattern);
50
 
51
  void vid12_close(void);
52
 
53
  void vid12_putpixel(unsigned short x, unsigned short y, unsigned char col);
54
 
55
  /* draws a horizonatal line from [x1,y] to [x2,y] */
56
  void vid12_hline(unsigned short y, unsigned short x1, unsigned short x2, unsigned char color);
57
 
58
  void vid12_putscanline(unsigned short scanline, const unsigned char *pixels);
59
 
60
  /* prepares VGA for a VRAM-to-VRAM copy operation */
61
  void vid12_vramcpy_prep(void);
62
 
63
  /* fast (VRAM-to-VRAM) copy of a scanline (0..479) to another scanline.
64
   * vid12_vramcpy_prep() must be called before and vid12_vramcpy_done must be
65
   * called after one or more vid12_vramcpy_scanline() calls. */
66
  void vid12_vramcpy_scanline(unsigned short dst, unsigned short src);
67
 
68
  /* sets VGA back to its normal state after VRAM-to-VRAM operations */
69
  void vid12_vramcpy_done(void);
70
 
71
  void vid12_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
72
#endif