Register.Console.Echo still functional?

A private (members-only) forum for discussing all issues related to the Beta test of Native mode devices.
Locked
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Register.Console.Echo still functional?

Post 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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Register.Console.Echo still functional?

Post 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.
- Don Kinzer
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

Is this a native mode specific problem?


-Don
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

Don_Kirby wrote:Is this a native mode specific problem?
Yes. The code generated for VM mode is correct.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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
- Don Kinzer
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post 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.
Mike Perks
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post 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
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post 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
Mike Perks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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.
- Don Kinzer
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post 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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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.
- Don Kinzer
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post 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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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.
- Don Kinzer
Locked