Lines: 64 X-Admin: news AT aol DOT com From: sterten AT aol DOT com (Sterten) Newsgroups: comp.os.msdos.djgpp Date: 10 Aug 2003 10:10:07 GMT References: Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com Subject: Re: ATT assembler question Message-ID: <20030810061007.03017.00001081@mb-m19.aol.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >> (it's a pity, that C doesn't let me test what key is pressed !) someone in comp.lang.c++ told me this >Yes, it does. DJGPP has a few functions to do that: _bios_keybrd, >bioskey, getkey, getxkey. One of them should do what you want, I >hope. I'm afraid not. getkey and getxkey interrupt the program and wait until the user presses a key. bioskey and _bios_keybrd don't flush the keyboard buffer, so only the first pressed key is recognized. If e.g. someone presses and 5 minutes later , then won't be recognized by bioskey. In assembly I'm usually do: mov ah,1 \ int 16h \ push ax \ mov ax,0c00h \ int 21h \ pop ax I want the user to be able to interrupt the program with , so I'm checking for the key every millisecond. I don't want to code the whole program in assembly, because mathematical computations in assembly are _tedious_ without variable names , mov,add,sub.. instead of =+- , etc. >> First, I don't know what COFF is, nor how to link. > >COFF is the object file format used by DJGPP. If NASM generates COFF >*.o object files, you can link them into your programs as if they >were compiled by GCC: > > gcc -o myprogram.exe foo.o bar.o baz.o ... > >where the various *.o are object files. OK >> Second , when I give my source to others, I don't want to >> require that they do get NASM, do the COFF and link, >> just when they only want to implement a small change, >> like changing a parameter. > >NASM is free software, available from the net, so requiring it is no >different from requiring the rest of DJGPP development tools. they might already have a C-compiler and I'm trying to use standard C-commands only, which compile on various platforms. Few people already have NASM _and_ DJGPP installed. >That said, I do think that using the standard development tools is >slightly better. NASM was mentioned only to make the life easier for >you, as you obviously know the Intel assembly format better. yes, I want to code and debug in NASM but the user shall only see the inline-assembly (with comments, maybe) , ready to compile. I think I'll go back to the method in old days with homecomputers: create a big string in your program and poke the machine-code instructions directly into it, then jump to that address. Although, I'm not sure whether that's still possible with protected mode. And then, how do I get the actual address within the program and jump to there ? And does it work for other compilers too ? Guenter