Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!cvl!umd5!carl From: carl@umd5 (Carl Symborski) Newsgroups: comp.sys.amiga Subject: Beep Bug Fix For Dave Wecker's VT100 Program Message-ID: <1391@umd5> Date: Fri, 12-Dec-86 17:43:46 EST Article-I.D.: umd5.1391 Posted: Fri Dec 12 17:43:46 1986 Date-Received: Mon, 15-Dec-86 07:17:52 EST Reply-To: carl@umd5.umd.edu.UUCP (Carl Symborski) Organization: University of Maryland, College Park Lines: 57 Summary: This fixes Beep under LATTICE /* Well all this talk about bugs in Dave Wecker's VT100 program which don't happen under MANX and do happen under LATTICE has got me started. Darnit why dosn't the beep thing work when VT100 is compiled under LATTICE! I just had to look. Sure enough I found it.... I'll list the bug (?) fix first, compiler flames later.... Fix to Dave's VT100 program to allow audible beep is a modification to the include file VT100.H Edit this file and search for a line which looks like: extern UBYTE Audio_AllocMap[]; change this to: extern UBYTE Audio_AllocMap[4]; Recompile the file INIT.C and relink. End of fix! Now the real sweat is why does this fix work? I mean why does LATTICE need this and MANX dosn't. Well looking at the code, we have in VT100.H something of the form: $ifdef MODULE_MAIN . . UBYTE Audio_AllocMap[4] = {1, 8, 2, 4}; . . $else . . extern UBYTE Audio_AllocMap[]; . . OK so far. The problem is in file INIT.C where the I/O request block is initialized prior to opening the audio device. The address and length of Audio_AllocMap is passed to the audio device in the I/O block. The code is using the "sizeof()" compile-time unary operator. The symbol "MODULE_MAIN" is not defined in INIT.C so when you compile under LATTICE, (read C compiler), the "else" part in VT100.H is looked at and understood. So then; all that INIT.C should know about the symbol "Audio_AllocMap" is that it is an external array of type UBYTE. We DON'T know how long it is, so when we say "sizeof(Audio_AllocMap)" we should expect zero maby one... but not four!!!! Honestly folks, I just don't know how this works under MANX! It can only be that the MANX compiler is cheeting a bit by peeking into the "then" part of the conditional compile in VT100.H. To me this is really scary. It's like the old "do what i mean, not what i say" compiler option we all dreamed of back in school. I would go on but heck, I stopped watching MANX and Hawaii Five-0 a long time ago. - Carl