Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about changing default text color #3

Open
MorfeoMatrixx opened this issue Oct 31, 2019 · 8 comments
Open

Question about changing default text color #3

MorfeoMatrixx opened this issue Oct 31, 2019 · 8 comments

Comments

@MorfeoMatrixx
Copy link

Hi Marco ! Congrats for your excellent work! Really enjoying your Terminal with an SC126 RC2014 board. Only one question, how do I change the source code in vt100.spin to set a different color for the Foreground attribute ? I successfully changed the CTRL-F10 setup screen to green using $20 and $A0 instead of $70 and $F0 for text attributes, but didn´t find where to change the default color for the terminal text and cursor.

I´ll really appreciate if you can point me to the correct section of the code so I can make the change.
Thanks in advance.

Regards,
Jose Luis.

@maccasoft
Copy link
Owner

The text color is defined in the txt_attr variable at line 363. It is reset with the ANSI escape sequence at line 564, you need to change that too if your application uses ANSI color sequences.
The screen is initially filled with the default color at line 110 (first byte is character, second is attribute).
The cursor color follows the attribute at the cursor position, so if you fill the screen with green on black the cursor is also green.

@MorfeoMatrixx
Copy link
Author

MorfeoMatrixx commented Oct 31, 2019 via email

@maccasoft
Copy link
Owner

I have a patch that adds the baud rate settings, if you want to try it. I'm not sure to add this option, there isn't much memory left (with another keyboard map there is even less available) and the only issue is with the Z180 / RomWBW variant that defaults to 38400. It is very easy to set the speed to 115200, rebuild the binary image and flash the rom.

@MorfeoMatrixx
Copy link
Author

MorfeoMatrixx commented Nov 1, 2019 via email

@MorfeoMatrixx
Copy link
Author

Hi Marco, everything went OK with my changes to the Settings screen, I can change the baudrate "live" but the color is still fixed (I can only change it recompiling), because I am incompetent with propeller machine language and I can´t figure out in your code how to pass a variable that is in Hub memory (VAR section) containing the new desired attribute (color) to the txt_attr variable in the machine code segment in the DAT section...

I looked thru some book examples but failed with RDBYTE, PAR, etc...
I'll really appreciate if you can guide me with this part so I can finish my modification and share it.

Thanks and regards, JL.

@maccasoft
Copy link
Owner

I can´t figure out in your code how to pass a variable that is in Hub memory (VAR section) containing the new desired attribute (color) to the txt_attr variable in the machine code segment in the DAT section...

Simply, you can't. The txt_attr variable is initialized when the terminal cog is started, then it is managed from within the cog and doesn't interact with the hub memory anymore.You can stop and restart the terminal cog to reinitialize the txt_attr value, however this also resets the terminal status so anything on screen will be out of sync. You'll need to save the cog id at vt100.spin:183 to issue the new coginit.

@maccasoft maccasoft changed the title SALUTI ! Question about changing default text color Question about changing default text color Nov 28, 2019
@MorfeoMatrixx
Copy link
Author

MorfeoMatrixx commented Nov 28, 2019 via email

@MorfeoMatrixx
Copy link
Author

I finally got everything working usin the PAR register and RDBYTE. I can now change the terminal foreground and background colors at will, and baud-rate also. When I detect a change in FG or BG colors, I simply issue the spin REBOOT method, so everything gets in-sync again. The serial connection get's restarted but it's fast enough that doesn't affect the HOST system.

Thanks Marco for all your support, I'm very happy with my mod to the code; I can share it if you like.

Cheers, JL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants