Skip to content

Commit e5a114b

Browse files
authored
Merge pull request #1 from tssva/master
Changes to allow compilation with Open Watcom
2 parents 72f9da9 + c23e762 commit e5a114b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

resetopl.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@
2121
* IN THE SOFTWARE.
2222
*/
2323

24+
#include <stdlib.h>
2425
#include <stdio.h>
25-
#include <io.h>
26+
#include <conio.h>
27+
#include <dos.h>
2628

2729
void write_opl(unsigned int base, int opl3, unsigned char reg, unsigned char v) {
2830
unsigned int oplbase = base;
2931

3032
if (opl3) {
3133
oplbase += 2;
3234
}
33-
outportb(oplbase, reg);
34-
inportb(base);
35-
outportb(oplbase+1, v);
36-
inportb(base);
35+
outp(oplbase, reg);
36+
inp(base);
37+
outp(oplbase+1, v);
38+
inp(base);
3739
}
3840

3941
void set_registers(unsigned int base, unsigned char low, unsigned char high, unsigned char val, int opl3) {
@@ -77,7 +79,7 @@ int main(int argc, char **argv) {
7779
write_opl(base, 0, 0x4, 0x80);
7880

7981
/* Read status */
80-
val1 = inportb(base);
82+
val1 = inp(base);
8183

8284
/* Set timer 1 to 0xff */
8385
write_opl(base, 0, 0x2, 0xff);
@@ -89,7 +91,7 @@ int main(int argc, char **argv) {
8991
delay(10);
9092

9193
/* Read status */
92-
val2 = inportb(base);
94+
val2 = inp(base);
9395

9496
/* Reset timer 1 and 2 */
9597
write_opl(base, 0, 0x4, 0x60);
@@ -103,7 +105,7 @@ int main(int argc, char **argv) {
103105
}
104106

105107
/* Read status */
106-
val1 = inportb(base);
108+
val1 = inp(base);
107109

108110
if ((val1 & 0x06) == 0x00) {
109111
opl3 = 1;
@@ -145,4 +147,4 @@ int main(int argc, char **argv) {
145147
}
146148

147149
return 0;
148-
}
150+
}

0 commit comments

Comments
 (0)