Line 2... |
Line 2... |
2 |
* a few functions for mode 12h programming (640x480 4bpp)
|
2 |
* a few functions for mode 12h programming (640x480 4bpp)
|
3 |
*
|
3 |
*
|
4 |
* This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
|
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.
|
5 |
* Published under the terms of the MIT License, as stated below.
|
6 |
*
|
6 |
*
|
7 |
* Copyright (C) 2022 Mateusz Viste
|
7 |
* Copyright (C) 2022-2023 Mateusz Viste
|
8 |
*
|
8 |
*
|
9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
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
|
10 |
* of this software and associated documentation files (the "Software"), to
|
11 |
* deal in the Software without restriction, including without limitation the
|
11 |
* deal in the Software without restriction, including without limitation the
|
12 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
12 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
Line 27... |
Line 27... |
27 |
|
27 |
|
28 |
#ifndef MDR_VID12_H
|
28 |
#ifndef MDR_VID12_H
|
29 |
|
29 |
|
30 |
#define MDR_VID12_H
|
30 |
#define MDR_VID12_H
|
31 |
|
31 |
|
32 |
/* init video mode 12h (640x480x16c) */
|
32 |
/* init video mode 12h (640x480x16c)
|
- |
|
33 |
* remember to call vid12_close() at exit time */
|
33 |
void vid12_init(void);
|
34 |
void vid12_init(void);
|
34 |
|
35 |
|
35 |
/* Wait until VBLANK */
|
36 |
/* wait until VBLANK */
|
36 |
void vid12_waitvblank(void);
|
37 |
void vid12_waitvblank(void);
|
37 |
|
38 |
|
- |
|
39 |
/* wait until ANY blank: either VBLANK or HBLANK */
|
- |
|
40 |
void vid12_waitblank(void);
|
- |
|
41 |
|
38 |
/* clear screen using color
|
42 |
/* clear screen using color
|
39 |
* this function is fastest when color is 0 or 15 */
|
43 |
* this function is fastest when color is 0 or 15 */
|
40 |
void vid12_cls(unsigned char color);
|
44 |
void vid12_cls(unsigned char color);
|
41 |
|
45 |
|
42 |
/* clear a single scanline (0..479) with a solid color (0..15)
|
46 |
/* clear a single scanline (0..479) with a solid color (0..15)
|
Line 46... |
Line 50... |
46 |
/* fill lines from linefirst to linelast with an 8 pixels pattern
|
50 |
/* fill lines from linefirst to linelast with an 8 pixels pattern
|
47 |
* linelast must be equal to or greater than linelast
|
51 |
* linelast must be equal to or greater than linelast
|
48 |
* pattern must be 8 bytes long */
|
52 |
* pattern must be 8 bytes long */
|
49 |
void vid12_linepat(unsigned short linefirst, unsigned short linelast, const unsigned char *pattern);
|
53 |
void vid12_linepat(unsigned short linefirst, unsigned short linelast, const unsigned char *pattern);
|
50 |
|
54 |
|
- |
|
55 |
/* deinit video mode 12h and resets to previous mode */
|
51 |
void vid12_close(void);
|
56 |
void vid12_close(void);
|
52 |
|
57 |
|
- |
|
58 |
/* puts a pixel on screen */
|
53 |
void vid12_putpixel(unsigned short x, unsigned short y, unsigned char col);
|
59 |
void vid12_putpixel(unsigned short x, unsigned short y, unsigned char col);
|
54 |
|
60 |
|
55 |
/* draws a horizonatal line from [x1,y] to [x2,y] */
|
61 |
/* 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);
|
62 |
void vid12_hline(unsigned short y, unsigned short x1, unsigned short x2, unsigned char color);
|
57 |
|
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] */
|
58 |
void vid12_putscanline(unsigned short scanline, const unsigned char *pixels);
|
66 |
void vid12_putscanline(unsigned short scanline, const unsigned char *pixels);
|
59 |
|
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 |
|
60 |
/* prepares VGA for a VRAM-to-VRAM copy operation */
|
76 |
/* prepares VGA for a VRAM-to-VRAM copy operation */
|
61 |
void vid12_vramcpy_prep(void);
|
77 |
void vid12_vramcpy_prep(void);
|
62 |
|
78 |
|
63 |
/* fast (VRAM-to-VRAM) copy of a scanline (0..479) to another scanline.
|
79 |
/* 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
|
80 |
* vid12_vramcpy_prep() must be called before and vid12_vramcpy_done must be
|
Line 66... |
Line 82... |
66 |
void vid12_vramcpy_scanline(unsigned short dst, unsigned short src);
|
82 |
void vid12_vramcpy_scanline(unsigned short dst, unsigned short src);
|
67 |
|
83 |
|
68 |
/* sets VGA back to its normal state after VRAM-to-VRAM operations */
|
84 |
/* sets VGA back to its normal state after VRAM-to-VRAM operations */
|
69 |
void vid12_vramcpy_done(void);
|
85 |
void vid12_vramcpy_done(void);
|
70 |
|
86 |
|
71 |
void vid12_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
|
- |
|
72 |
#endif
|
87 |
#endif
|