VTUI library

All aspects of programming on the Commander X16.
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »


I have come a bit further. The generic library is functional although it does not have too many functions yet.

I spent all of the evening yesterday trying to write some documentation and hopefully it is understandable.

Have a look at https://github.com/JimmyDansbo/vtuilib/blob/main/VTUIlib-generic.md

You can also look at the examples and download the binary here: https://github.com/JimmyDansbo/vtuilib/tree/main/VTUIlib-generic

The example shows off most of the functions currently implemented and should look like this:

image.thumb.png.0fd101480e19a3664aeb94f4c7a689ed.png

Let me know if anything is unclear ( there are probably things that needs to be rewritten or clarified)

Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
gavinhaslehurst
Posts: 47
Joined: Thu Jan 07, 2021 11:37 am

VTUI library

Post by gavinhaslehurst »



3 hours ago, JimmyDansbo said:




I have come a bit further. The generic library is functional although it does not have too many functions yet.



I spent all of the evening yesterday trying to write some documentation and hopefully it is understandable.



Have a look at https://github.com/JimmyDansbo/vtuilib/blob/main/VTUIlib-generic.md



You can also look at the examples and download the binary here: https://github.com/JimmyDansbo/vtuilib/tree/main/VTUIlib-generic



The example shows off most of the functions currently implemented and should look like this:



image.thumb.png.0fd101480e19a3664aeb94f4c7a689ed.png



Let me know if anything is unclear ( there are probably things that needs to be rewritten or clarified)



This is looking nice ? 

User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »


I think I have reached a point where I have the Generic VTUI light-library finished. I have managed to fit the functions I initially wanted into 1KB so it can be loaded into golden RAM.

The functions included are:


  • initialize - Initialize the jumptable at the beginning of the library to make it easy to call the rest of the functions


  • screen_set - Set the screen to 40x30 or 80x60 or toggle between the two


  • clear - Clear the screen with a specified color


  • set_stride - Set the VERA stride value


  • set_decr - Set or reset the VERA decrement bit


  • gotoxy - Point VERA memory to specific coordinates on screen


  • plot_char - Put a screencode character and color code on screen at the current VERA address


  • scan_char - Read a screencode character and color code from screen at current VERA address


  • hline - Draw a horizontal line


  • vline - Draw a vertical line


  • print_str - Convert and print a 0-terminated PETSCII string to screen at current VERA address


  • fill_box - Create a filled box


  • pet2scr - Convert a PETSCII code to screencode


  • scr2pet - Convert a screencode to PETSCII


  • border - Draw a non-filled box with a border


  • save_rect - Save an area from screen to memory


  • rest_rect - Restore screen from memory


I know that this is very basic, but hopefully it could, at least, help people get an understanding on how these things could work. I still have lots of work to do as I have not done anything on the ACME and CA65 include files. I also need to create another example and possibly a demo of how to use the library.

I think I will leave the light version with the above functions, and focus on getting the include files finished as well as create a demo on how to use the library.

I do plan on extending the library with scrolling, string input, hex/number to string conversion and more, but for now I will get this light version finished.

Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
m00dawg
Posts: 346
Joined: Wed Jul 08, 2020 12:41 am
Contact:

VTUI library

Post by m00dawg »


This is great yep! I have a lot my own routines that do the same thing in my program at moment, however, I would like to test your library against my current solution at some point soon since I think having a standard TUI library between apps would be great! (Maybe a suitable use of ROM in the future!?).

I noticed from your screenshots that your lines connected with the outer box border. Is that "automatic" or how did you end up doing that? My current routines draw all the boxes and lines and then I go back and add the connectors after, which has resulted in a few visual bugs when I switch to different panes on my app (as I intentionally don't want to redraw the whole screen when I switch). Hopefully that makes sense!

Author of Dreamtracker (https://www.dreamtracker.org/)
Check Out My Band: https://music.victimcache.com/
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »



1 hour ago, m00dawg said:




I noticed from your screenshots that your lines connected with the outer box border. Is that "automatic" or how did you end up doing that?



It is not automatic, neither is the header of a box.

I just draw a border and a fill_box, then I use plot_char to replace the border with T-pieces where necessary, use print_str to write the header and and hline to draw a horizontal line across my box.

In a more feature-rich library there would be the option to add headers to boxes and to divide a box with horizontal or vertical lines. As it is now, the user has to use the basic functions provided to create those advanced features.

Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

VTUI library

Post by kliepatsch »


Great effort, Jimmy! Thanks for the library. I wonder if it would be more visible to the community if you upload it with a nice screenshot in the "devtools" category?

I think the fact that you managed to squeeze it into golden RAM doubles the value of this library, because I guess many programs don't use it anyway. So you effectively get some nice functionality at almost zero cost ?

User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »



4 minutes ago, kliepatsch said:




Great effort, Jimmy! Thanks for the library. I wonder if it would be more visible to the community if you upload it with a nice screenshot in the "devtools" category?



Thanks for your kind words. I will definitely upload it in the devtools category when I have completed all 3 flavors and documentation.

Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

VTUI library

Post by kliepatsch »


I've ran my first test with it. Loaded the generic flavor with the kernal routines SETNAM, SETLFS and LOAD into golden RAM ($400). Really clever solution with the initialization, and only using relative jumps apart from the jump table at the start. I like it.

BTW the binary of the program itself (without VTUI) is 112 bytes. That includes setup of the library and the commands using the VTUI, and a "press any key" loop.

Screenshot from 2021-02-16 16-22-41.png

User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »


The library has been updated a bit and I have added it to the Dev Tools section


 

Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
User avatar
desertfish
Posts: 1092
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »


That's starting to look darn good @JimmyDansbo

Post Reply