VTUI library

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

VTUI library

Post by JimmyDansbo »


I have  started developing the VERA Text User Interface Library (vtuilib) and could use a little help for ideas and suggestions.

My plan is to create 3 different flavors of the library:


  • Include file for the ACME assembler


  • Include file for the CA65 assembler


  • Binary library file that can be loaded with any program


So far the library is still in very early development and there is no documentation yet, but I have implemented a few basic functions such as set_stride, set_decr, print_str and line drawing functions in the generic library.

There will of course be functions to draw boxes, filled and not filled as well as functions to save and restore a certain area of screen. 

The binary library is designed to function in any memory location so depending on the final size, it might be possible to load it to "golden" RAM at $0400 which is what I am doing so far. Another approach is to design it to live in banked memory.

What are your thoughts?

How important is it that the binary library can be located anywhere in RAM?

Which functions would you like to see?

Anything I have missed?

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: 1073
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »



  • I assume it will have text output in some form (to place text at specific position). It would be nice if it has routines for both screencode and  PETSCII encoding


  • box drawing/filling with or without a certain border (and optional "pane" title perhaps)


  • clear screen


  • setting background and foreground color


  • scrolling a rectangle up by 1 character 


  • perhaps also scrolling a rectangle down,left,right by 1 character ?


  • plotting a single character at x,y ?


  • getting a single character at x,y ?


  • reading a user inputted string from the keyboard (where the input is constrained by certain width to not clobber the screen outside of a certain rectangle/pane) ?


  • perhaps a bit of a stretch: word-wrapped text output within a rectangle


  • don't burden the library with things such as number to text conversion routines


(Prog8's textio library has some of these routines already but those operate full-screen)

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

VTUI library

Post by JimmyDansbo »


@desertfish Thank you very much for your suggestions.


29 minutes ago, desertfish said:




It would be nice if it has routines for both screencode and  PETSCII encoding



That is a very good idea, I had not thought of that ?


31 minutes ago, desertfish said:




scrolling a rectangle up by 1 character 



I am not sure I understand... Do you want to be able to move the entire rectangle or do you want to scroll inside a rectangle?

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: 1073
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »


The latter: scrolling inside the rectangle (to allow for text output inside a pane, so to speak)

m00dawg
Posts: 333
Joined: Wed Jul 08, 2020 12:41 am
Contact:

VTUI library

Post by m00dawg »



4 hours ago, desertfish said:





  • I don't burden the library with things such as number to text conversion routines




Curious about this one. I had to do that very thing yesterday and while it ended up being reasonably simple, for someone new to ASM having something ready made would avoid unnecessary speed bumps. I didn't get nearly as much done yesterday on my actual application due to having to write something like that.

The other suggestions make a lot of sense and are also things I've had to implement on my own where having something ready-made would have been useful. In fact should anyone want to peruse those, they are here:

https://gitlab.com/m00dawg/command-tracker/-/tree/master/library/graphics

I tried to make those reasonably generic (whereas my app specific stuff is under library/ui). If you want to use them, noting the license (GPLv3), feel free!

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

VTUI library

Post by JimmyDansbo »


I managed to create the initialization function that ensures the generic library can be loaded into any address and still function as expected.

Self-modifying code makes my brain hurt so I might not get much else done today.

If you want, feel free to take at look at https://github.com/jimmydansbo/vtuilib/

There is still no documentation other than comments in code and the vtuitest.asm shows how to load the generic library.

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: 1073
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »



1 hour ago, m00dawg said:




Curious about this one.



I was thinking: number to text conversion is very application specific (decimal? with or without prefix zeros or spacing?  hex/binary perhaps? with or without radix prefix $/% ?  left aligned/right aligned? signed or unsinged?  bytes or words or perhaps even bigger?) so just let the application do it and only deal with strings in this library. 

m00dawg
Posts: 333
Joined: Wed Jul 08, 2020 12:41 am
Contact:

VTUI library

Post by m00dawg »


Those are good points. Still, a sort of basic one (unsigned integer) with no formatting might be helpful for new folk. Having to write basic I/O before one can even write programs to experiment around is, to me, an unnecessary hurdle which could be scaring away otherwise awesome programmers that could make great games and things.

But yeah I think apart from something very simple, you bring up a good point. My code, for instance, often accounts for the color of the text as part of the routine. Often times I just use one of the ZP 'r' registers (like r0) to pass that through to the end procedure that ends up doing the actual output. But that could be quite different for various folks.

Maybe instead of full output, a helper function to convert to/from screencodes would be nice. Realizing screencodes != petscii codes was like stepping on a rake for me.

Author of Dreamtracker (https://www.dreamtracker.org/)
Check Out My Band: https://music.victimcache.com/
User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

VTUI library

Post by kliepatsch »


I agree, some basic number output should be included. Even if it's just one byte to a decimal number between 0 and 255. Everything else could be done by a user conversion function that turns data into strings.

@JimmyDansbo do you plan to make the UI work with the mouse? Or via keyboard? Or do you just want to provide drawing routines and let the user program handle the interactive part?

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

VTUI library

Post by BruceMcF »


@kliepatsch Yes, a /10 with remainder function, and then an unsigned integer to number string function built from that would be useful, as would scr2p and p2scr.

The second pair would be particularly helpful to experienced 6502 assembly programmers who are not used to the oddities of both PETSCII and Commodore screencodes.

Post Reply