maccasoft / propeller-vt100-terminal

ANSI / VT-100 Terminal emulator for Parallax Propeller microcontroller with VGA and USB support
47 stars 9 forks source link

Question about changing default text color #3

Open MorfeoMatrixx opened 4 years ago

MorfeoMatrixx commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Many thanks Marco for your fast response, I'll try it when I get home this afternoon. I managed to define and set as default a new layout for the Spanish (Latin American variant) keyboard, and I'm also investigating how to add an option to the config menu to change the serial port Baudrate. I think an option for setting the default text color could be added too.

If I succeed I'll let you know in case you want to add this features to your code. I'll be glad to collaborate with your project, but my knowledge on the spin language is very basic, but I'm learning.

Grazie e saluti ! (by the way, my wife is Italian ;-) José Luis.

On Thu, Oct 31, 2019 at 9:37 AM Marco Maccaferri notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/maccasoft/propeller-vt100-terminal/issues/3?email_source=notifications&email_token=ACCWCKH3SSWDYI45FGEVAK3QRLGR5A5CNFSM4JHCWLK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECXTGQQ#issuecomment-548352834, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCWCKGBG6KHMY3VUAHLRF3QRLGR5ANCNFSM4JHCWLKQ .

maccasoft commented 4 years ago

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 commented 4 years ago

Marco, with your help I was able to change the default colors, and I'm adding an option in the Settings Screen for this ! I'll appreciate if you could share the patch for baud-rate selection, since I can add it after deleting unused keyboard maps.

IMHO, regarding the keyboard selection code, once you have it working with your hardware, you don´t need it anymore. Maybe leaving only 2 options is enough, providing some short instructions on how to cut & paste the correct mapping file for the first compile.

Instead, the baud-rate selection functionality could be used more frequently, as you mention if one switches between SCM and ROMWBW in the SC126 Z180 board. Also the potential of your board been used as a stand-alone VT-100 with any retro-computer is huge, specially because it's the only option I know for using USB keyboards.

Grazie e Saluti, JL.

On Fri, Nov 1, 2019 at 6:43 AM Marco Maccaferri notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/maccasoft/propeller-vt100-terminal/issues/3?email_source=notifications&email_token=ACCWCKFOXA2JICMQY4FPNRDQRP23LA5CNFSM4JHCWLK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC2OS7A#issuecomment-548727164, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCWCKHRKJI4L2HWBB2HJPLQRP23LANCNFSM4JHCWLKQ .

MorfeoMatrixx commented 4 years ago

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 commented 4 years ago

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.

MorfeoMatrixx commented 4 years ago

Thanks a lot Marco ! I´ll try this approach, I feel I am so close to success... In the meantime I've learn a lot of the Propeller architecture (this is why I decided to modify your code); it´s a pity it hasn't got a wider user base. It´s a chip with a strong and weird "personality".

Saludos, José Luis.

On Thu, Nov 28, 2019 at 7:19 AM Marco Maccaferri notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/maccasoft/propeller-vt100-terminal/issues/3?email_source=notifications&email_token=ACCWCKGXNT2KGMAICBJHPDTQV6LJLA5CNFSM4JHCWLK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFMEJNQ#issuecomment-559432886, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCWCKAJ4F7F7O5DCBGSJLTQV6LJLANCNFSM4JHCWLKQ .

MorfeoMatrixx commented 4 years ago

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.