April 19, 2024, 04:31:21 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


it's compiles fine and runs fine but it doesn't what I have programmed

Started by Techno, October 27, 2008, 02:04:59 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Techno

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

Ionic Wind Support Team

Ionic Wind Support Team

Techno

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) */

Ionic Wind Support Team

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.
Ionic Wind Support Team

Techno

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


Ionic Wind Support Team

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
Ionic Wind Support Team

Techno

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