IonicWind Software

IWBasic => Console Corner => Topic started by: Techno on October 27, 2008, 02:04:59 PM

Title: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Techno on October 27, 2008, 02:04:59 PM
Dear programmers

My program compiles fine and runs fine but there are two problems:

When a pressed an key there doesn't response on the pressed key
If I try to quit the application with the escape key it doesn't response



DECLARE EXTERN _sscanf(STRING buf, STRING format,...),INT
DECLARE EXTERN sprintf(POINTER p, POINTER p, ...), INT
DECLARE "kernel32", Sleep(time:int)

CONST BASE_ADDRESS = 0x3F8
CONST DTR = 1

OPENCONSOLE
DEF wTime AS WORD
DEF cKey  AS CHAR
DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
UNTIL INKEY$ <> ""
/* Until Keypressed */
UNTIL INKEY$ = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
CLOSECONSOLE

SUB Generator(wImpulstijd AS WORD)
Out32((BASE_ADDRESS + 4), DTR)
Sleep(wImpulstijd)
Out32((BASE_ADDRESS + 4), NOT(DTR))
Sleep(wImpulstijd)
ENDSUB



Can someone help me.
I want no C++ code only EBASIC statements please
Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Ionic Wind Support Team on October 27, 2008, 02:39:58 PM
See users guide on INKEY$(1)

Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Techno on October 27, 2008, 02:57:50 PM
Paul

I try this but doesn't work:


DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
    Generator(wTime)
UNTIL INKEY$(1) <> ""

/* Until Keypressed */
UNTIL INKEY$ = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Ionic Wind Support Team on October 27, 2008, 03:01:18 PM
I guess you didn't read it or understand it.

UNTIL INKEY$(1) = CHR$(27)

The RAW parameter returns virtual key codes, in otherwords the non printable characters.
Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Techno on October 27, 2008, 03:28:25 PM
Paul

I try this but the loop is endless the outside or the inside loop.
I can quit the program with escape key



OPENCONSOLE
DEF wTime AS WORD
DEF cKey  AS CHAR
DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
UNTIL INKEY$ <> " "
/* Until Keypressed */
UNTIL INKEY$(1) = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
END
CLOSECONSOLE

Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Ionic Wind Support Team on October 27, 2008, 04:46:33 PM
Because you don't need two loops. 


OPENCONSOLE
DEF wTime AS WORD
DEF cKey  AS CHAR
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
/* Until Keypressed */
UNTIL INKEY$(1) = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
END
CLOSECONSOLE
Title: Re: it's compiles fine and runs fine but it doesn't what I have programmed
Post by: Techno on October 28, 2008, 01:53:57 AM
Paul,
Thanks for your solution

I have an other question:

How can I create an function Keypressed() and ReadKey in Ebasic because I have need this in my project or are this replacements in ebasic how can I do this

Thanks