Subversion Repositories SvarDOS

Rev

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

Rev Author Line No. Line
1661 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-2023 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
   * remember to call vid12_close() at exit time */
34
  void vid12_init(void);
35
 
36
  /* wait until VBLANK */
37
  void vid12_waitvblank(void);
38
 
39
  /* wait until ANY blank: either VBLANK or HBLANK */
40
  void vid12_waitblank(void);
41
 
42
  /* clear screen using color
43
   * this function is fastest when color is 0 or 15 */
44
  void vid12_cls(unsigned char color);
45
 
46
  /* clear a single scanline (0..479) with a solid color (0..15)
47
   * this function is fastest when color is 0 or 15 */
48
  void vid12_clrline(unsigned short line, unsigned char color);
49
 
50
  /* fill lines from linefirst to linelast with an 8 pixels pattern
51
   * linelast must be equal to or greater than linelast
52
   * pattern must be 8 bytes long */
53
  void vid12_linepat(unsigned short linefirst, unsigned short linelast, const unsigned char *pattern);
54
 
55
  /* deinit video mode 12h and resets to previous mode */
56
  void vid12_close(void);
57
 
58
  /* puts a pixel on screen */
59
  void vid12_putpixel(unsigned short x, unsigned short y, unsigned char col);
60
 
61
  /* draws a horizonatal line from [x1,y] to [x2,y] */
62
  void vid12_hline(unsigned short y, unsigned short x1, unsigned short x2, unsigned char color);
63
 
64
  /* write an entire scanline (640 pixels) to screen. the pixels data must be
65
   * a serie of 640 bytes having values in the range [0..15] */
66
  void vid12_putscanline(unsigned short scanline, const unsigned char *pixels);
67
 
68
  /* set index palette color to given R,G,B value. each R,G,B component must be
69
   * a 6 bit value in the range [0..63] (where 63 is the maximum luminosity) */
70
  void vid12_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
71
 
72
  /*****************************
73
   *  VRAM TO VRAM operations  *
74
   *****************************/
75
 
76
  /* prepares VGA for a VRAM-to-VRAM copy operation */
77
  void vid12_vramcpy_prep(void);
78
 
79
  /* fast (VRAM-to-VRAM) copy of a scanline (0..479) to another scanline.
80
   * vid12_vramcpy_prep() must be called before and vid12_vramcpy_done must be
81
   * called after one or more vid12_vramcpy_scanline() calls. */
82
  void vid12_vramcpy_scanline(unsigned short dst, unsigned short src);
83
 
84
  /* sets VGA back to its normal state after VRAM-to-VRAM operations */
85
  void vid12_vramcpy_done(void);
86
 
87
#endif