Re: [AD] About inp & outp |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Angelo Mottola <a.mottola@xxxxxxxxxx> writes:
> Now I'm open to all solutions: if it works for all as is now, let's
> stay as is; I don't want to force anyone to use my crappy solution;
> I'll just need to add a "#define inportb inp" and "#define outportb
> outp" to the sndscape.c file of my own Allegro distribuition, to
> ensure it works with my computer...
Could you try this patch. If it does not work, try adding my_delay
before inportb and outportb, if it still does not work, remove
my_delay and replace inportb/outportb defines with inp/outp. If the
last fix works, then we might just use it.
inp and inportb functions:
_inp:
jmp _inportb
_inportb:
pushl %ebp
movl %esp, %ebp
movl 0x8(%ebp), %edx
inb (%dx), %al
movzbl %al, %eax
movl %ebp, %esp
pop %ebp
ret
It might be slightly different for other libc versions.
--- allegro/src/dos/sndscape.c Mon May 15 02:17:00 2000
+++ allegro-3.9.32/src/dos/sndscape.c Wed Jun 28 09:09:30 2000
@@ -28,6 +28,47 @@
#endif
+#define LETS_ROCK 1
+
+#ifdef LETS_ROCK
+
+static void
+my_delay (void)
+{
+ volatile int i;
+ for (i = 0; i < 10; i++)
+ ;
+}
+
+static unsigned char
+my_inportb (unsigned short port)
+{
+ unsigned char data;
+ data = inportb (port);
+ my_delay ();
+ return data;
+}
+
+static void
+my_outportb (unsigned short port, unsigned char data)
+{
+ outportb (port, data);
+ my_delay ();
+}
+
+#ifdef inportb
+#undef inportb
+#endif
+#ifdef outportb
+#undef outportb
+#endif
+
+#define inportb(p) (my_inportb ((p)))
+#define outportb(p,v) (my_outportb ((p), (v)))
+
+#endif
+
+
#define ODIE 0 /* ODIE gate array */
#define OPUS 1 /* OPUS gate array */
--
Michael Bukin