[Ma-linux] perplexing hardware problem
DonJr
djr1952 at hotpop.com
Fri Feb 15 16:13:26 EST 2008
On Fri, 2008-02-15 at 13:31 -0500, Kevin Dwyer wrote:
> On Fri, Feb 15, 2008 at 10:39 AM, Alan McConnell <alan at patriot.net>
> wrote:
> On Fri, Feb 15, 2008 at 09:29:33AM -0500, Przemek Klosowski
> wrote:
> > A couple of short versions in C:
> >
> > int main(){ printf("\a")}
> >
> > or
> >
> > int main(){ asm volatile (".data\nA: byte 7\n.text\n mov
> $0x4,%eax\nmov $0x1,%ebx\nmov $A,%ecx\nmov $0x1,%edx\nint
> $0x80\nmov $0x1,%eax\nxor %ebx,%ebx\nint $0x80")}
> >
> > or even
> >
> > char main[] = {0xB8, 0x04, 0x00, 0x00, 0x00, 0xBB, 0x01,
> 0x00, 0x00, 0x00, 0xB9, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x01,
> 0x00, 0x00, 0x00, 0xCD, 0x80, 0xB8, 0x01, 0x00, 0x00, 0x00,
> 0x31, 0xDB, 0xCD, 0x80, 0xC3};
>
>
> Showoff!! (Where's the accompanying Makefile???)
>
> gcc -x c - <<<'int main(){printf("\a");}'
I had to laugh when I saw this, so I just had to try and see if it still
worked and I got the following:
<stdin>: In function ‘main’:
<stdin>:1: warning: incompatible implicit declaration of built-in
function ‘printf’
And YES the a.out still beeped.
Then I wondered how do you get rid of the warning and came up with the
following:
echo -e '#include<stdio.h>\n int main(){printf("\\a");}' | gcc -x c - ;\
./a.out ; rm a.out
Still seems like a lot of bother just to make the little speaker go
beep. <GRIN>
--
DonJr
More information about the Ma-linux
mailing list