VTUI Library

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

General - CX16 VTUI Library

Post by JimmyDansbo »

VTUI (Vera Text User Interface) library
Version 1.2

Can be used to create text user interfaces using VERA instead of relying on the KERNAL functions for writing to screen.

The library is less than 1KB which means it can be loaded into Golden RAM at $400. As an alternative, include files are provided for Acme and CA65 assemblers as well as CC65 compiler.

See https://github.com/JimmyDansbo/VTUIlib for documentation, examples and include files.
vtui-logo.jpg
vtui-logo.jpg (59.9 KiB) Viewed 11791 times
vtui-mc.jpg
vtui-mc.jpg (176 KiB) Viewed 11791 times
v0.8.scrennshot.jpg
v0.8.scrennshot.jpg (377.8 KiB) Viewed 11889 times
The latest binary of the library can be downloaded here:
VTUI1.2.BIN
(976 Bytes) Downloaded 216 times
Below is a program that demo's some of the functionality of the VTUI library, VTUI1.1.BIN must be placed in the same directory as DEMO.PRG
DEMO.PRG
(8.58 KiB) Downloaded 149 times

Try It Now!

#r45
Attachments
vtui.zip
(4.71 KiB) Downloaded 153 times
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
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: VTUI Library

Post by TomXP411 »

This looks great, Jimmy! It reminds me of Borland's text based GUI that they used for Turbo C++ and Turbo Pascal.
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: VTUI Library

Post by JimmyDansbo »

I am happy to announce that I have released version 1.0 of the VTUI library.
Now with even more functions as well as support for inclusion in CC65 C projects.
All images, downloads and links in top post are edited to correspond to version 1.0

As always, please let me know if you find any bugs or errors, or if you have questions or comments.
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
codewar65
Posts: 67
Joined: Mon Aug 03, 2020 8:01 pm

Re: VTUI Library

Post by codewar65 »

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

Re: VTUI Library

Post by JimmyDansbo »

ncurses and the old Pascal Crt library were both inspirations.
The VTUI library is not at all as capable as one of the main goals I set was that it should fit in a single KB of memory.
Feel free to play around with the library and don't hesitate to let me know if you have questions, comments or have found a bug.
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
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: VTUI Library

Post by Martin Schmalenbach »

Quick question on using fill_box, border, save_rect, load_rect

If I first use gotoxy and then any of the above will that effectively mean I will get a filled box, a border box, save & restore of a rectangle of specified height and width with the top left corner providing the effective zero datum for these functions?

I don't want to be working with rectangles etc that are only referenced to the 0,0 location in the text screen!

Many thanks in advance.
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: VTUI Library

Post by JimmyDansbo »

Correct, the fill_box, border, save_rect and load_rect functions have their top left corner at the current VERA address which can be set with the gotoxy function.

I will try to update the documentation to make this more clear.
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
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: VTUI Library

Post by oodler »

I have started playing with this to do a vi-inspired modal editor in prog8 - don't get excited, still learning. But I had a question that is not related and I figured I'd just keep things in this thread.

This example in the prog8 repo has a "bug", it is an adaptation of the DEMO.PRG:

Image

Should be more like,

Image

In learning vtui and prog8 (and everything else basically), and I trying to figure out how to "fix" it. I've located the initial copy of the logo before the screen is cleared and redrawn, and basically just copied to a new subroutine that will take the same area and save it into memory without clobbering the saved logo in memory. I have not quite worked out how to do this but can break it in informative ways. I am missing some pieces of insight:

Image

The new subroutine results in partially overwriting the original save rectangular area.

Image

I need a patient person to explain to me how the memory addresses can be adjusted, and maybe point to some resource that can give me something to read more about it. I have tracked down the prog8 binding to VTUI1.0.BIN and its source, https://github.com/JimmyDansbo/VTUIlib/ ... eneric.asm.

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

Re: VTUI Library

Post by JimmyDansbo »

I am not exactly sure what it is you are asking.

What I can tell you is that the original DEMO.PRG starts out by creating a 7x7 character area filled with spaces, it then saves the logo to another point in memory.

When arrowkeys are pressed, the logo is first overwritten with the area created with spaces and the logo is then drawn at the new coordinates from the saved version.

I am not sure why the store_logo and store_where_logo_was functions are using vtui.save_rect twice ?
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
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: VTUI Library

Post by oodler »

JimmyDansbo wrote: Tue Dec 19, 2023 6:10 pm ...
I am not sure why the store_logo and store_where_logo_was functions are using vtui.save_rect twice ?
Sorry that was kind of incoherent. This helps a lot. It's a prog8 example, so I think I'll play around more with it to see what I learn. With your implication that it should be only called once, can you tell me what $80 is for and what $0000 is pointing to? (still super n00b here). Thanks!
Post Reply