• R/O
  • SSH
  • HTTPS

mdr: Commit


Commit MetaInfo

Revision50 (tree)
Time2022-11-12 18:12:32
Authormateuszviste

Log Message

headers moved to a subdirectory to avoid mdr clashing with default libc headers

Change Summary

Incremental Difference

--- trunk/inc/vid12.h (revision 49)
+++ trunk/inc/vid12.h (nonexistent)
@@ -1,72 +0,0 @@
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
--- trunk/inc/mouse.h (revision 49)
+++ trunk/inc/mouse.h (nonexistent)
@@ -1,48 +0,0 @@
1-/*
2- * Mouse routines
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) 2014-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_MOUSE_H
29- #define MDR_MOUSE_H
30-
31- /* init the mouse driver (and checks for presence of mouse support at same time)
32- * returns 0 if no mouse is present, and the number of buttons otherwise */
33- int mouse_init(void);
34-
35- /* shows the mouse pointer */
36- void mouse_show(void);
37-
38- /* hides the mouse pointer */
39- void mouse_hide(void);
40-
41- /* get x/y coordinates of the mouse, and returns a bitfield with state of buttons */
42- int mouse_getstate(int *x, int *y);
43-
44- /* get x/y coordinates of the mouse when the last button release occured since last check.
45- returns the id of the button pressed (1 or 2), or 0 if no event occured. */
46- int mouse_fetchrelease(int *x, int *y);
47-
48-#endif
--- trunk/inc/timer.h (revision 49)
+++ trunk/inc/timer.h (nonexistent)
@@ -1,52 +0,0 @@
1-/*
2- * High-resolution timing routines (PIT reprogramming)
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) 2014-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_TIMER_H
29-#define MDR_TIMER_H
30-
31-/* reset the timer value, this can be used by the application to make sure
32- * no timer wrap occurs during critical parts of the code flow */
33-void timer_reset(void);
34-
35-/* This routine will stop the fast clock if it is going. It has void return
36- * value so that it can be an exit procedure. */
37-void timer_stop(void);
38-
39-/* This routine will start the fast clock rate by installing the
40- * handle_clock routine as the interrupt service routine for the clock
41- * interrupt and then setting the interrupt rate up to its higher speed
42- * by programming the 8253 timer chip.
43- * This routine does nothing if the clock rate is already set to
44- * its higher rate, but then it returns -1 to indicate the error. */
45-void timer_init(void);
46-
47-/* This routine will return the present value of the time, which is
48- * read from the nowtime structure. Interrupts are disabled during this
49- * time to prevent the clock from changing while it is being read. */
50-void timer_read(unsigned long *res);
51-
52-#endif
--- trunk/inc/rs232.h (revision 49)
+++ trunk/inc/rs232.h (nonexistent)
@@ -1,47 +0,0 @@
1-/*
2- * Reading from and writing to an RS-232 port
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) 2015-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_RS232_H
29-#define MDR_RS232_H
30-
31-/* get the I/O port for COMx (1..4) */
32-unsigned short rs232_getport(int x);
33-
34-/* check if the COM port is ready for write. loops for some time waiting.
35- * returns 0 if port seems ready eventually, non-zero otherwise. can be used
36- * to verify the rs232 presence */
37-int rs232_check(unsigned short port);
38-
39-/* write a byte to the COM port at 'port'. this function will block if the
40- * UART is not ready to transmit yet. */
41-void rs232_write(unsigned short port, int data);
42-
43-/* read a byte from COM port at 'port'. returns the read byte, or -1 if
44- * nothing was available to read. */
45-int rs232_read(unsigned short port);
46-
47-#endif
--- trunk/inc/sbdigi.h (revision 49)
+++ trunk/inc/sbdigi.h (nonexistent)
@@ -1,57 +0,0 @@
1-/*
2- * SoundBlaster routines for DSP driving
3- *
4- * Copyright (C) 2022 Mateusz Viste
5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to
8- * deal in the Software without restriction, including without limitation the
9- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10- * sell copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in
14- * all copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22- * IN THE SOFTWARE.
23- */
24-
25-#ifndef MDR_SBDIGI_H
26-#define MDR_SBDIGI_H
27-
28-struct sbdigi_ctx;
29-
30-/* initializes the SoundBlaster DSP chip
31- * blaster must point to a BLASTER environment string (like "A220 I5 D1")
32- * returns a pointer to a context, NULL on error
33- * NOTE: DSP's state after initialization may or may not be muted, depending
34- * on the exact hardware revision. use sbdigi_spkoff() to make sure it is
35- * unmuted */
36-struct sbdigi_ctx *sbdigi_init(const char *blaster);
37-
38-/* unmutes the SoundBlaster DSP */
39-void sbdigi_spkon(struct sbdigi_ctx *ctx);
40-
41-/* mutes the SoundBlaster DSP */
42-void sbdigi_spkoff(struct sbdigi_ctx *ctx);
43-
44-/* plays a short sample
45- * ctx - DSP context, as returned by sbdigi_init()
46- * buf - pointer to sample data (must be PCM, 8000 Hz, mono, 8-bit unsigned
47- * len - length of the sample, in bytes
48- * NOTES: this routine uses DMA to transfer memory. This has two implications:
49- * 1. the routine will return almost immediately, while the sound is playing
50- * 2. sample data must be contained in a buffer that does NOT cross a 64K page
51- * because DMA transfers are unable to cross 64K boundaries */
52-void sbdigi_playsample(struct sbdigi_ctx *ctx, void *buf, unsigned short len);
53-
54-/* shuts down the DSP and frees context memory */
55-void sbdigi_quit(struct sbdigi_ctx *ctx);
56-
57-#endif
--- trunk/inc/trigint.h (revision 49)
+++ trunk/inc/trigint.h (nonexistent)
@@ -1,46 +0,0 @@
1-/*
2- * Routines for computation of basic transcendental functions sin and cos.
3- * These routines use only integers, hence they do not require an FPU nor any
4- * kind of FPU emulation. Works reasonably fast even on an 8086 CPU.
5- *
6- * The results are computed using polynomial approximations. Their precision
7- * is not expected to be ideal, but "good enough" for common usage.
8- *
9- * This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
10- * Published under the terms of the MIT License, as stated below.
11- *
12- * Copyright (C) 2022 Mateusz Viste
13- *
14- * Permission is hereby granted, free of charge, to any person obtaining a copy
15- * of this software and associated documentation files (the "Software"), to
16- * deal in the Software without restriction, including without limitation the
17- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18- * sell copies of the Software, and to permit persons to whom the Software is
19- * furnished to do so, subject to the following conditions:
20- *
21- * The above copyright notice and this permission notice shall be included in
22- * all copies or substantial portions of the Software.
23- *
24- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30- * IN THE SOFTWARE.
31- */
32-
33-#ifndef MDR_TRIGINT_H
34-#define MDR_TRIGINT_H
35-
36-/* Computes the cosine value for the given radian.
37- * The radian argument must be provided multiplied by 1000.
38- * Returns the cosine value multiplied by 1000. */
39-short trigint_cos(short rad1000);
40-
41-/* Computes the sine value for the given radian angle.
42- * The radian argument must be provided multiplied by 1000.
43- * Returns the cosine value multiplied by 1000. */
44-short trigint_sin(short rad1000);
45-
46-#endif
--- trunk/inc/pcx.h (revision 49)
+++ trunk/inc/pcx.h (nonexistent)
@@ -1,50 +0,0 @@
1-/*
2- * PCX-loading routines
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_PCX_H
29-#define MDR_PCX_H
30-
31-struct pcx_hdr {
32- unsigned char rle;
33- unsigned char bpp;
34- unsigned short max_x;
35- unsigned short max_y;
36- unsigned short bytes_per_scanline;
37- struct {
38- unsigned char r;
39- unsigned char g;
40- unsigned char b;
41- } pal[256];
42-};
43-
44-int pcx_anal(struct pcx_hdr *h, FILE *fd, unsigned long offset, unsigned short len);
45-int pcx_load(void *ptr, size_t ptrsz, const struct pcx_hdr *h, FILE *fd, unsigned long offset);
46-
47-/* convert img to 8bpp if needed (ie unpack 2 and 4bpp data to 8bpp) */
48-int pcx_convto8bpp(void *img, const struct pcx_hdr *h);
49-
50-#endif
--- trunk/inc/wave.h (revision 49)
+++ trunk/inc/wave.h (nonexistent)
@@ -1,42 +0,0 @@
1-/*
2- * WAVE-loading routines
3- *
4- * Copyright (C) 2022 Mateusz Viste
5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to
8- * deal in the Software without restriction, including without limitation the
9- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10- * sell copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in
14- * all copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22- * IN THE SOFTWARE.
23- */
24-
25-#ifndef MDR_WAVE_H
26-#define MDR_WAVE_H
27-
28-struct wave_t {
29- unsigned short format;
30- unsigned short channels;
31- unsigned short rate;
32- unsigned short bitdepth;
33- unsigned long dataoffset;
34- unsigned long len;
35-};
36-
37-/* looks at an open WAVE file and fills the wav structure with related
38- * information (format, number of channels, bit depth, data rate, etc)
39- * returns 0 on success */
40-int wave_anal(struct wave_t *wav, FILE *fd);
41-
42-#endif
--- trunk/inc/xms.h (revision 49)
+++ trunk/inc/xms.h (nonexistent)
@@ -1,51 +0,0 @@
1-/*
2- * XMS driver
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) 2014-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_XMS_H
29-#define MDR_XMS_H
30-
31-struct xms_struct {
32- unsigned int handle;
33- long memsize; /* allocated memory size, in bytes */
34-};
35-
36-/* checks if a XMS driver is installed, inits it and allocates a memory block of memsize K-bytes.
37- * if memsize is 0, then the maximum possible block will be allocated.
38- * returns the amount of allocated memory (in K-bytes) on success, 0 otherwise. */
39-unsigned int xms_init(struct xms_struct *xms, unsigned int memsize);
40-
41-/* free XMS memory */
42-void xms_close(struct xms_struct *xms);
43-
44-/* copies a chunk of memory from conventional memory into the XMS block.
45- returns 0 on sucess, non-zero otherwise. */
46-int xms_push(struct xms_struct *xms, void far *src, unsigned int len, long xmsoffset);
47-
48-/* copies a chunk of memory from the XMS block into conventional memory */
49-int xms_pull(struct xms_struct *xms, long xmsoffset, void far *dst, unsigned int len);
50-
51-#endif
--- trunk/inc/keyb.h (revision 49)
+++ trunk/inc/keyb.h (nonexistent)
@@ -1,41 +0,0 @@
1-/*
2- * Keyboard routines
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) 2014-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 KEYB_MDR_H
29- #define KEYB_MDR_H
30-
31- /* wait for a keypress and return it. Returns 0 for extended keystroke,
32- * then function must be called again to return scan code. */
33- int keyb_getkey(void);
34-
35- /* poll the keyboard, and return the next input key if any, or -1 */
36- int keyb_getkey_ifany(void);
37-
38- /* flush the keyboard buffer */
39- void keyb_flush(void);
40-
41-#endif
--- trunk/inc/video.h (revision 49)
+++ trunk/inc/video.h (nonexistent)
@@ -1,91 +0,0 @@
1-/*
2- * video library - provides a few functions for mode 4 and 13h programming.
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) 2014-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_VIDEO_H
29-
30- #define MDR_VIDEO_H
31-
32- #define VIDEO_DBUF 1
33-
34- struct video_handler {
35- unsigned char far *dbuf;
36- int flags;
37- int mode;
38- unsigned char lastmode;
39- };
40-
41- /* returns 0 if no VGA has been detected, non-zero otherwise */
42- int video_detectvga(void);
43-
44- /* init video mode. either 0x04 for CGA or 0x13 for VGA */
45- struct video_handler *video_open(int mode, int flags);
46-
47- /* reads a screen dump from file and puts it to the screen buffer */
48- void video_file2screen(struct video_handler *handler, char *file);
49-
50- /* load count colors of palette from array of rgb triplets */
51- void video_loadpal(const unsigned char *pal, int count, int offset);
52-
53- /* Wait until VBLANK */
54- void video_waitvblank(void);
55-
56- void video_flip(struct video_handler *handler);
57-
58- /* copies line ysrc over ydst in CGA mode memory */
59- void video_cgalinecopy(struct video_handler *handler, int ydst, int ysrc);
60-
61- /* clear screen using color */
62- void video_cls(struct video_handler *handler, unsigned char color);
63-
64- /* renders a sprite of width and height dimensions onscreen, starting at specified x/y location
65- coloffset is an offset to add to color indexes, while transp is the index of the transparent color (set to -1 if none) */
66- void video_putsprite(struct video_handler *handler, unsigned char *sprite, int x, int y, int width, int height, int coloffset, int transp, int maxcol);
67-
68- /* same as video_putsprite(), but reads the sprite from a file */
69- void video_putspritefromfile(struct video_handler *handler, char *file, long foffset, int x, int y, int width, int height, int coloffset, int transp, int maxcol);
70-
71- void video_close(struct video_handler *handler);
72-
73- void video_rputpixel(struct video_handler *handler, int x, int y, unsigned char col, int repeat);
74-
75- /* render a horizontal line of length len starting at x/y */
76- void video_hline(struct video_handler *handler, int x, int y, int len, unsigned char color);
77-
78- /* render a vertical line of length len starting at x/y */
79- void video_vline(struct video_handler *handler, int x, int y, int len, unsigned char color);
80-
81- void video_line(struct video_handler *handler, int x1, int y1, int x2, int y2, unsigned char color);
82-
83- void video_rect(struct video_handler *handler, int x, int y, int width, int height, unsigned char color);
84-
85- /* renders a rectangle on screen, at position x/y, filled with color */
86- void video_rectfill(struct video_handler *handler, int x, int y, int width, int height, unsigned char color);
87-
88- void video_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
89-
90- void video_getpalette(unsigned char index, unsigned char *r, unsigned char *g, unsigned char *b);
91-#endif
--- trunk/inc/mdr/keyb.h (nonexistent)
+++ trunk/inc/mdr/keyb.h (revision 50)
@@ -0,0 +1,41 @@
1+/*
2+ * Keyboard routines
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) 2014-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 KEYB_MDR_H
29+ #define KEYB_MDR_H
30+
31+ /* wait for a keypress and return it. Returns 0 for extended keystroke,
32+ * then function must be called again to return scan code. */
33+ int keyb_getkey(void);
34+
35+ /* poll the keyboard, and return the next input key if any, or -1 */
36+ int keyb_getkey_ifany(void);
37+
38+ /* flush the keyboard buffer */
39+ void keyb_flush(void);
40+
41+#endif
--- trunk/inc/mdr/mouse.h (nonexistent)
+++ trunk/inc/mdr/mouse.h (revision 50)
@@ -0,0 +1,48 @@
1+/*
2+ * Mouse routines
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) 2014-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_MOUSE_H
29+ #define MDR_MOUSE_H
30+
31+ /* init the mouse driver (and checks for presence of mouse support at same time)
32+ * returns 0 if no mouse is present, and the number of buttons otherwise */
33+ int mouse_init(void);
34+
35+ /* shows the mouse pointer */
36+ void mouse_show(void);
37+
38+ /* hides the mouse pointer */
39+ void mouse_hide(void);
40+
41+ /* get x/y coordinates of the mouse, and returns a bitfield with state of buttons */
42+ int mouse_getstate(int *x, int *y);
43+
44+ /* get x/y coordinates of the mouse when the last button release occured since last check.
45+ returns the id of the button pressed (1 or 2), or 0 if no event occured. */
46+ int mouse_fetchrelease(int *x, int *y);
47+
48+#endif
--- trunk/inc/mdr/pcx.h (nonexistent)
+++ trunk/inc/mdr/pcx.h (revision 50)
@@ -0,0 +1,50 @@
1+/*
2+ * PCX-loading routines
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_PCX_H
29+#define MDR_PCX_H
30+
31+struct pcx_hdr {
32+ unsigned char rle;
33+ unsigned char bpp;
34+ unsigned short max_x;
35+ unsigned short max_y;
36+ unsigned short bytes_per_scanline;
37+ struct {
38+ unsigned char r;
39+ unsigned char g;
40+ unsigned char b;
41+ } pal[256];
42+};
43+
44+int pcx_anal(struct pcx_hdr *h, FILE *fd, unsigned long offset, unsigned short len);
45+int pcx_load(void *ptr, size_t ptrsz, const struct pcx_hdr *h, FILE *fd, unsigned long offset);
46+
47+/* convert img to 8bpp if needed (ie unpack 2 and 4bpp data to 8bpp) */
48+int pcx_convto8bpp(void *img, const struct pcx_hdr *h);
49+
50+#endif
--- trunk/inc/mdr/rs232.h (nonexistent)
+++ trunk/inc/mdr/rs232.h (revision 50)
@@ -0,0 +1,47 @@
1+/*
2+ * Reading from and writing to an RS-232 port
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) 2015-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_RS232_H
29+#define MDR_RS232_H
30+
31+/* get the I/O port for COMx (1..4) */
32+unsigned short rs232_getport(int x);
33+
34+/* check if the COM port is ready for write. loops for some time waiting.
35+ * returns 0 if port seems ready eventually, non-zero otherwise. can be used
36+ * to verify the rs232 presence */
37+int rs232_check(unsigned short port);
38+
39+/* write a byte to the COM port at 'port'. this function will block if the
40+ * UART is not ready to transmit yet. */
41+void rs232_write(unsigned short port, int data);
42+
43+/* read a byte from COM port at 'port'. returns the read byte, or -1 if
44+ * nothing was available to read. */
45+int rs232_read(unsigned short port);
46+
47+#endif
--- trunk/inc/mdr/sbdigi.h (nonexistent)
+++ trunk/inc/mdr/sbdigi.h (revision 50)
@@ -0,0 +1,57 @@
1+/*
2+ * SoundBlaster routines for DSP driving
3+ *
4+ * Copyright (C) 2022 Mateusz Viste
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to
8+ * deal in the Software without restriction, including without limitation the
9+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+ * sell copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+ * IN THE SOFTWARE.
23+ */
24+
25+#ifndef MDR_SBDIGI_H
26+#define MDR_SBDIGI_H
27+
28+struct sbdigi_ctx;
29+
30+/* initializes the SoundBlaster DSP chip
31+ * blaster must point to a BLASTER environment string (like "A220 I5 D1")
32+ * returns a pointer to a context, NULL on error
33+ * NOTE: DSP's state after initialization may or may not be muted, depending
34+ * on the exact hardware revision. use sbdigi_spkoff() to make sure it is
35+ * unmuted */
36+struct sbdigi_ctx *sbdigi_init(const char *blaster);
37+
38+/* unmutes the SoundBlaster DSP */
39+void sbdigi_spkon(struct sbdigi_ctx *ctx);
40+
41+/* mutes the SoundBlaster DSP */
42+void sbdigi_spkoff(struct sbdigi_ctx *ctx);
43+
44+/* plays a short sample
45+ * ctx - DSP context, as returned by sbdigi_init()
46+ * buf - pointer to sample data (must be PCM, 8000 Hz, mono, 8-bit unsigned
47+ * len - length of the sample, in bytes
48+ * NOTES: this routine uses DMA to transfer memory. This has two implications:
49+ * 1. the routine will return almost immediately, while the sound is playing
50+ * 2. sample data must be contained in a buffer that does NOT cross a 64K page
51+ * because DMA transfers are unable to cross 64K boundaries */
52+void sbdigi_playsample(struct sbdigi_ctx *ctx, void *buf, unsigned short len);
53+
54+/* shuts down the DSP and frees context memory */
55+void sbdigi_quit(struct sbdigi_ctx *ctx);
56+
57+#endif
--- trunk/inc/mdr/timer.h (nonexistent)
+++ trunk/inc/mdr/timer.h (revision 50)
@@ -0,0 +1,52 @@
1+/*
2+ * High-resolution timing routines (PIT reprogramming)
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) 2014-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_TIMER_H
29+#define MDR_TIMER_H
30+
31+/* reset the timer value, this can be used by the application to make sure
32+ * no timer wrap occurs during critical parts of the code flow */
33+void timer_reset(void);
34+
35+/* This routine will stop the fast clock if it is going. It has void return
36+ * value so that it can be an exit procedure. */
37+void timer_stop(void);
38+
39+/* This routine will start the fast clock rate by installing the
40+ * handle_clock routine as the interrupt service routine for the clock
41+ * interrupt and then setting the interrupt rate up to its higher speed
42+ * by programming the 8253 timer chip.
43+ * This routine does nothing if the clock rate is already set to
44+ * its higher rate, but then it returns -1 to indicate the error. */
45+void timer_init(void);
46+
47+/* This routine will return the present value of the time, which is
48+ * read from the nowtime structure. Interrupts are disabled during this
49+ * time to prevent the clock from changing while it is being read. */
50+void timer_read(unsigned long *res);
51+
52+#endif
--- trunk/inc/mdr/trigint.h (nonexistent)
+++ trunk/inc/mdr/trigint.h (revision 50)
@@ -0,0 +1,46 @@
1+/*
2+ * Routines for computation of basic transcendental functions sin and cos.
3+ * These routines use only integers, hence they do not require an FPU nor any
4+ * kind of FPU emulation. Works reasonably fast even on an 8086 CPU.
5+ *
6+ * The results are computed using polynomial approximations. Their precision
7+ * is not expected to be ideal, but "good enough" for common usage.
8+ *
9+ * This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
10+ * Published under the terms of the MIT License, as stated below.
11+ *
12+ * Copyright (C) 2022 Mateusz Viste
13+ *
14+ * Permission is hereby granted, free of charge, to any person obtaining a copy
15+ * of this software and associated documentation files (the "Software"), to
16+ * deal in the Software without restriction, including without limitation the
17+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18+ * sell copies of the Software, and to permit persons to whom the Software is
19+ * furnished to do so, subject to the following conditions:
20+ *
21+ * The above copyright notice and this permission notice shall be included in
22+ * all copies or substantial portions of the Software.
23+ *
24+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30+ * IN THE SOFTWARE.
31+ */
32+
33+#ifndef MDR_TRIGINT_H
34+#define MDR_TRIGINT_H
35+
36+/* Computes the cosine value for the given radian.
37+ * The radian argument must be provided multiplied by 1000.
38+ * Returns the cosine value multiplied by 1000. */
39+short trigint_cos(short rad1000);
40+
41+/* Computes the sine value for the given radian angle.
42+ * The radian argument must be provided multiplied by 1000.
43+ * Returns the cosine value multiplied by 1000. */
44+short trigint_sin(short rad1000);
45+
46+#endif
--- trunk/inc/mdr/vid12.h (nonexistent)
+++ trunk/inc/mdr/vid12.h (revision 50)
@@ -0,0 +1,72 @@
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
--- trunk/inc/mdr/video.h (nonexistent)
+++ trunk/inc/mdr/video.h (revision 50)
@@ -0,0 +1,91 @@
1+/*
2+ * video library - provides a few functions for mode 4 and 13h programming.
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) 2014-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_VIDEO_H
29+
30+ #define MDR_VIDEO_H
31+
32+ #define VIDEO_DBUF 1
33+
34+ struct video_handler {
35+ unsigned char far *dbuf;
36+ int flags;
37+ int mode;
38+ unsigned char lastmode;
39+ };
40+
41+ /* returns 0 if no VGA has been detected, non-zero otherwise */
42+ int video_detectvga(void);
43+
44+ /* init video mode. either 0x04 for CGA or 0x13 for VGA */
45+ struct video_handler *video_open(int mode, int flags);
46+
47+ /* reads a screen dump from file and puts it to the screen buffer */
48+ void video_file2screen(struct video_handler *handler, char *file);
49+
50+ /* load count colors of palette from array of rgb triplets */
51+ void video_loadpal(const unsigned char *pal, int count, int offset);
52+
53+ /* Wait until VBLANK */
54+ void video_waitvblank(void);
55+
56+ void video_flip(struct video_handler *handler);
57+
58+ /* copies line ysrc over ydst in CGA mode memory */
59+ void video_cgalinecopy(struct video_handler *handler, int ydst, int ysrc);
60+
61+ /* clear screen using color */
62+ void video_cls(struct video_handler *handler, unsigned char color);
63+
64+ /* renders a sprite of width and height dimensions onscreen, starting at specified x/y location
65+ coloffset is an offset to add to color indexes, while transp is the index of the transparent color (set to -1 if none) */
66+ void video_putsprite(struct video_handler *handler, unsigned char *sprite, int x, int y, int width, int height, int coloffset, int transp, int maxcol);
67+
68+ /* same as video_putsprite(), but reads the sprite from a file */
69+ void video_putspritefromfile(struct video_handler *handler, char *file, long foffset, int x, int y, int width, int height, int coloffset, int transp, int maxcol);
70+
71+ void video_close(struct video_handler *handler);
72+
73+ void video_rputpixel(struct video_handler *handler, int x, int y, unsigned char col, int repeat);
74+
75+ /* render a horizontal line of length len starting at x/y */
76+ void video_hline(struct video_handler *handler, int x, int y, int len, unsigned char color);
77+
78+ /* render a vertical line of length len starting at x/y */
79+ void video_vline(struct video_handler *handler, int x, int y, int len, unsigned char color);
80+
81+ void video_line(struct video_handler *handler, int x1, int y1, int x2, int y2, unsigned char color);
82+
83+ void video_rect(struct video_handler *handler, int x, int y, int width, int height, unsigned char color);
84+
85+ /* renders a rectangle on screen, at position x/y, filled with color */
86+ void video_rectfill(struct video_handler *handler, int x, int y, int width, int height, unsigned char color);
87+
88+ void video_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
89+
90+ void video_getpalette(unsigned char index, unsigned char *r, unsigned char *g, unsigned char *b);
91+#endif
--- trunk/inc/mdr/wave.h (nonexistent)
+++ trunk/inc/mdr/wave.h (revision 50)
@@ -0,0 +1,42 @@
1+/*
2+ * WAVE-loading routines
3+ *
4+ * Copyright (C) 2022 Mateusz Viste
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to
8+ * deal in the Software without restriction, including without limitation the
9+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+ * sell copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+ * IN THE SOFTWARE.
23+ */
24+
25+#ifndef MDR_WAVE_H
26+#define MDR_WAVE_H
27+
28+struct wave_t {
29+ unsigned short format;
30+ unsigned short channels;
31+ unsigned short rate;
32+ unsigned short bitdepth;
33+ unsigned long dataoffset;
34+ unsigned long len;
35+};
36+
37+/* looks at an open WAVE file and fills the wav structure with related
38+ * information (format, number of channels, bit depth, data rate, etc)
39+ * returns 0 on success */
40+int wave_anal(struct wave_t *wav, FILE *fd);
41+
42+#endif
--- trunk/inc/mdr/xms.h (nonexistent)
+++ trunk/inc/mdr/xms.h (revision 50)
@@ -0,0 +1,51 @@
1+/*
2+ * XMS driver
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) 2014-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_XMS_H
29+#define MDR_XMS_H
30+
31+struct xms_struct {
32+ unsigned int handle;
33+ long memsize; /* allocated memory size, in bytes */
34+};
35+
36+/* checks if a XMS driver is installed, inits it and allocates a memory block of memsize K-bytes.
37+ * if memsize is 0, then the maximum possible block will be allocated.
38+ * returns the amount of allocated memory (in K-bytes) on success, 0 otherwise. */
39+unsigned int xms_init(struct xms_struct *xms, unsigned int memsize);
40+
41+/* free XMS memory */
42+void xms_close(struct xms_struct *xms);
43+
44+/* copies a chunk of memory from conventional memory into the XMS block.
45+ returns 0 on sucess, non-zero otherwise. */
46+int xms_push(struct xms_struct *xms, void far *src, unsigned int len, long xmsoffset);
47+
48+/* copies a chunk of memory from the XMS block into conventional memory */
49+int xms_pull(struct xms_struct *xms, long xmsoffset, void far *dst, unsigned int len);
50+
51+#endif
--- trunk/keyb/keyb.c (revision 49)
+++ trunk/keyb/keyb.c (revision 50)
@@ -27,7 +27,7 @@
2727
2828 #include <dos.h>
2929
30-#include "keyb.h" /* include self for control */
30+#include <mdr\keyb.h> /* include self for control */
3131
3232
3333 /* waits for a keypress and return it. Returns 0 for extended keystroke, then
--- trunk/mouse/mouse.c (revision 49)
+++ trunk/mouse/mouse.c (revision 50)
@@ -27,7 +27,7 @@
2727
2828 #include <dos.h>
2929
30-#include "mouse.h" /* include self for control */
30+#include <mdr\mouse.h> /* include self for control */
3131
3232 /* init the mouse driver (and checks for presence of mouse support at same time)
3333 * returns 0 if no mouse is present, and the number of buttons otherwise */
--- trunk/pcx/pcx.c (revision 49)
+++ trunk/pcx/pcx.c (revision 50)
@@ -28,7 +28,7 @@
2828 #include <stdio.h>
2929 #include <string.h>
3030
31-#include "pcx.h"
31+#include <mdr\pcx.h>
3232
3333
3434 int pcx_anal(struct pcx_hdr *h, FILE *fd, unsigned long offset, unsigned short len) {
--- trunk/rs232/rs232.c (revision 49)
+++ trunk/rs232/rs232.c (revision 50)
@@ -28,7 +28,7 @@
2828 #include <conio.h>
2929 #include <dos.h>
3030
31-#include "rs232.h"
31+#include <mdr\rs232.h>
3232
3333 /* get the I/O port for COMx (1..4) */
3434 unsigned short rs232_getport(int x) {
--- trunk/sbdigi/sbdigi.c (revision 49)
+++ trunk/sbdigi/sbdigi.c (revision 50)
@@ -25,7 +25,7 @@
2525 #include <conio.h> /* inp() and outp() */
2626 #include <stdlib.h> /* NULL, free(), ... */
2727
28-#include "sbdigi.h"
28+#include <mdr\sbdigi.h>
2929
3030
3131 struct sbdigi_ctx {
--- trunk/timer/timer.c (revision 49)
+++ trunk/timer/timer.c (revision 50)
@@ -28,8 +28,9 @@
2828 #include <stdlib.h>
2929 #include <dos.h>
3030 #include <conio.h> /* outp() */
31-#include "timer.h" /* include self for control */
3231
32+#include <mdr\timer.h> /* include self for control */
33+
3334 /* selects timer's resolution */
3435 #define TIMER_1165_HZ
3536 /*#define TIMER_582_HZ*/
--- trunk/trigint/trigint.c (revision 49)
+++ trunk/trigint/trigint.c (revision 50)
@@ -30,7 +30,7 @@
3030 * IN THE SOFTWARE.
3131 */
3232
33-#include "trigint.h"
33+#include <mdr\trigint.h>
3434
3535 /* helper definitions for common "angle to rad*1000" values */
3636 #define ANGLE_360 6283
--- trunk/video/320x200/viddetvg.c (revision 49)
+++ trunk/video/320x200/viddetvg.c (revision 50)
@@ -26,9 +26,10 @@
2626 */
2727
2828 #include <dos.h> /* provides int86() along with the union REGS type */
29-#include "video.h" /* include self for control */
3029
30+#include <mdr\video.h> /* include self for control */
3131
32+
3233 /* returns 1 if VGA has been detected, zero otherwise */
3334 int video_detectvga(void) {
3435 union REGS regs;
--- trunk/video/320x200/video.c (revision 49)
+++ trunk/video/320x200/video.c (revision 50)
@@ -29,9 +29,10 @@
2929 #include <malloc.h> /* _fcalloc() and friends */
3030 #include <stdlib.h>
3131 #include <string.h> /* memcpy() */
32-#include "video.h" /* include self for control */
3332
33+#include <mdr\video.h> /* include self for control */
3434
35+
3536 /* init video mode */
3637 struct video_handler *video_open(int mode, int flags) {
3738 union REGS regs;
--- trunk/video/320x200/vidflip.c (revision 49)
+++ trunk/video/320x200/vidflip.c (revision 50)
@@ -26,8 +26,10 @@
2626 */
2727
2828 #include <string.h> /* memcpy() */
29-#include "video.h" /* include self for control */
3029
30+#include <mdr\video.h> /* include self for control */
31+
32+
3133 /* update the screen (if double-buffered) */
3234 void video_flip(struct video_handler *handler) {
3335 unsigned char far *vram;
--- trunk/video/320x200/vidgetpa.c (revision 49)
+++ trunk/video/320x200/vidgetpa.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "video.h" /* include self for control */
28+#include <mdr\video.h> /* include self for control */
2929
3030 void video_getpalette(unsigned char index, unsigned char *r, unsigned char *g, unsigned char *b) {
3131 unsigned char rr = 0, gg = 0, bb = 0;
--- trunk/video/320x200/vidlodpa.c (revision 49)
+++ trunk/video/320x200/vidlodpa.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "video.h" /* include self for control */
28+#include <mdr\video.h> /* include self for control */
2929
3030 /* load count colors of palette from array of rgb triplets */
3131 void video_loadpal(const unsigned char *pal, int count, int offset) {
--- trunk/video/320x200/vidputsp.c (revision 49)
+++ trunk/video/320x200/vidputsp.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "video.h" /* include self for control */
28+#include <mdr\video.h> /* include self for control */
2929
3030 /* renders a sprite of width and height dimensions onscreen, starting at specified x/y location
3131 coloffset is an offset to add to color indexes, while transp is the index of the transparent color (set to -1 if none) */
--- trunk/video/320x200/vidrectf.c (revision 49)
+++ trunk/video/320x200/vidrectf.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "video.h" /* include self for control */
28+#include <mdr\video.h> /* include self for control */
2929
3030 /* renders a rectangle on screen, at position x/y, filled with color */
3131 void video_rectfill(struct video_handler *handler, int x, int y, int width, int height, unsigned char color) {
--- trunk/video/320x200/vidrle.c (revision 49)
+++ trunk/video/320x200/vidrle.c (revision 50)
@@ -28,7 +28,7 @@
2828 #include <stdio.h> /* FILE */
2929 #include <stdlib.h> /* malloc() */
3030
31-#include "video.h" /* include self for control */
31+#include <mdr\video.h> /* include self for control */
3232
3333
3434 /* uncompress a RLE stream from a file into a buffer */
--- trunk/video/320x200/vidsetpa.c (revision 49)
+++ trunk/video/320x200/vidsetpa.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "video.h" /* include self for control */
28+#include <mdr\video.h> /* include self for control */
2929
3030
3131 void video_setpalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b) {
--- trunk/video/640x480/test.c (revision 49)
+++ trunk/video/640x480/test.c (revision 50)
@@ -1,6 +1,6 @@
11 #include <stdio.h>
22
3-#include "vid12.h"
3+#include <mdr\vid12.h>
44
55
66 /* get number of ticks from the BIOS 18.2 Hz timer */
--- trunk/video/640x480/v12ramcp.c (revision 49)
+++ trunk/video/640x480/v12ramcp.c (revision 50)
@@ -25,7 +25,7 @@
2525 * IN THE SOFTWARE.
2626 */
2727
28-#include "vid12.h"
28+#include <mdr\vid12.h>
2929
3030 #define VGA ((unsigned char far *)(0xA0000000l))
3131
--- trunk/video/640x480/vid12.c (revision 49)
+++ trunk/video/640x480/vid12.c (revision 50)
@@ -48,7 +48,7 @@
4848
4949 #include <string.h> /* _fmemset() */
5050
51-#include "vid12.h" /* include self for control */
51+#include <mdr\vid12.h> /* include self for control */
5252
5353 #define VGA ((unsigned char far *)(0xA0000000l))
5454 //static unsigned char far *VGA = (void far *)0xA0000000l; /* MK_FP(0xA000, 0); */
--- trunk/wave/wave.c (revision 49)
+++ trunk/wave/wave.c (revision 50)
@@ -25,7 +25,7 @@
2525 #include <stdio.h> /* FILE and friends */
2626 #include <string.h> /* bzero(), bcmp() */
2727
28-#include "wave.h"
28+#include <mdr\wave.h>
2929
3030
3131 int wave_anal(struct wave_t *wav, FILE *fd) {
--- trunk/xms/xms.c (revision 49)
+++ trunk/xms/xms.c (revision 50)
@@ -28,7 +28,7 @@
2828 #include <dos.h>
2929 #include <stdlib.h>
3030
31-#include "xms.h" /* include self for control */
31+#include <mdr\xms.h> /* include self for control */
3232
3333 /* a function pointer to save the XMS driver address */
3434 void far (*xmsdrv)(void);
Show on old repository browser