Page 1 of 1

Register.Console.Echo still functional?

Posted: 15 February 2008, 15:38 PM
by Don_Kirby
I've been trying, unsuccessfully, to turn off the console echo. Can someone verify that this function is working correctly? Using the code below, I get an echo in Hyperterminal where I shouldn't. I have verified that the echo feature in Hyperterminal is off.

Code: Select all

Sub Main()
	Do
		Register.Console.Echo = False
		Dim x as byte
		Console.Write("Type Something ")
		x = Console.Read
		Console.WriteLine("")
		Console.WriteLine("You entered " & Chr(X))
	Loop
End Sub
-Don

Re: Register.Console.Echo still functional?

Posted: 15 February 2008, 16:49 PM
by dkinzer
Don_Kirby wrote:I've been trying, unsuccessfully, to turn off the console echo.
The code generated for setting Register.Console.Echo is incorrect. You can work around the problem by commenting out the existing code and adding the inline C code as follows:

Code: Select all

#c
    setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE);
#endc
'    Register.Console.Echo = False 
The code generated for reading Register.Console.Echo in also faulty. Replacement code for it, however, is a bit more complicated. Let me know if you need it, too.

Posted: 15 February 2008, 17:46 PM
by Don_Kirby
Is this a native mode specific problem?


-Don

Posted: 15 February 2008, 17:55 PM
by dkinzer
Don_Kirby wrote:Is this a native mode specific problem?
Yes. The code generated for VM mode is correct.

Posted: 15 February 2008, 17:57 PM
by dkinzer
Don_Kirby wrote:Is this a native mode specific problem?
Perhaps a better interim solution is this:

Code: Select all

#if Option.TargetCode = "Native"
#c 
    setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE); 
#endc
#else
    Register.Console.Echo = False
#endif

Posted: 16 February 2008, 0:06 AM
by mikep
dkinzer wrote:

Code: Select all

#c 
    setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE); 
#endc
Can you explain what some of these fields like ZX_FLAGS_OFST, ZX_FLAGS2_OFST, ZX_FLAGS3_OFST etc are for.

Posted: 16 February 2008, 4:08 AM
by Don_Kirby

Code: Select all

#if Option.TargetCode = "Native"
#c 
    setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE); 
#endc
#else
    Register.Console.Echo = False
#endif
This returns the following:
Compiler wrote:RunSetup.bas:1332: Error: end-of-file reached with one or more open conditionals
RunSetup.bas:1332: Error: expected C statements and #endC following #C
-Don

Posted: 16 February 2008, 7:17 AM
by mikep
Don_Kirby wrote:

Code: Select all

#if Option.TargetCode = "Native"
#c 
    setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE); 
#endc
#else
    Register.Console.Echo = False
#endif
This returns the following:
Compiler wrote:RunSetup.bas:1332: Error: end-of-file reached with one or more open conditionals
RunSetup.bas:1332: Error: expected C statements and #endC following #C
I just pasted the code into my test application and it compiles fine. I get your error messages if the #endc is not on a new line i.e.

Code: Select all

#if Option.TargetCode = "Native"
#c
setBits((uint8_t *)&zxd + ZX_IO_FLAGS_OFST, IOF_CONSOLE_ECHO, ZX_FALSE);#endc
#else
    Register.Console.Echo = False
#endif

Posted: 16 February 2008, 8:19 AM
by dkinzer
mikep wrote:Can you explain what some of these fields [...] are for.
Only in general terms. They are bit fields of an internal data structure that control various aspects of execution.

Posted: 16 February 2008, 10:26 AM
by Don_Kirby
Mike, try that test again using indentation and see if you get the error. I'm big on keeping my indentation neat and tidy, so I indented the code after I pasted it. Removing the indentation made the errors go away.

-Don

Posted: 16 February 2008, 10:33 AM
by dkinzer
Don_Kirby wrote:try that test again using indentation and see if you get the error.
Currently, the #c, #endc, #asm, and #asm directives must begin in column 1. In retrospect, I don't know why they should not be allowed to be indented given that #if, #else, etc. are.

Posted: 16 February 2008, 13:00 PM
by Don_Kirby
dkinzer wrote:... I don't know why they should not be allowed to be indented given that #if, #else, etc. are.
Perhaps the intention was to make the C and ASM code segments stand out more in the code (by not being indented).

-Don

Posted: 16 February 2008, 13:47 PM
by dkinzer
dkinzer wrote:Currently, the #c, #endc, #asm, and #asm directives must begin in column 1.
Actually, the #c and #asm are currently allowed to be indented. The compiler has now been modified to allow the #endc and #endasm to be indented, too.