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 »


Now there is an input_str function...

That took up a lot of space. Library size went from 900 bytes in 0.7 to 1008 now in 0.8


 

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 »


Whohoo you did it! Now VTUI Library seems almost maxed out. Really impressive. Thanks!

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »


the input_str() routine, does it return the input string in petscii or in screencodes?

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

VTUI library

Post by JimmyDansbo »



2 minutes ago, desertfish said:




the input_str() routine, does it return the input string in petscii or in screencodes?



The string is returned in PETSCII. I will update the documentation to make that 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
User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

VTUI library

Post by desertfish »


Playing some more with input_str.... :


  • entered string in buffer seems to be terminated by a zero byte (I like this!)


  • ... this probably means you want to allocate 1 byte more in your input buffer to have room for this.  Maybe good to document this too


  • after pressing enter, the cursor remains visible. I expected it to disappear


  • i cannot enter petscii symbols (or capitals when in lowercase character mode) ?


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

VTUI library

Post by JimmyDansbo »


@desertfish


  • String in buffer is NOT zero terminated. If you type a string an press backspace before return, you will see


  • I actually meant to document my way out of the cursor not disappearing, but I may have to just use the 8 extra bytes and hide it before return


  • input_str supports the same characters as print_str


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

VTUI library

Post by desertfish »


About zero termination, I'm a bit confused then, because I see this :

image.thumb.png.4d4122a4de4f4cc203e09ec0d564cb98.png

my input buffer at $0920 was fully filled with 20 question marks $3f,  I typed my name (and some garbage that I  backspaced), and those zeros really did appear ?

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

VTUI library

Post by JimmyDansbo »



12 minutes ago, desertfish said:




About zero termination, I'm a bit confused



I share your confusion. I am currently looking into why those 0's are added to the buffer.

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
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »


@desertfish, I figured it out. 

I store anything that is returned by the GETIN Kernal function in the buffer, but only if the character is within the allowed range is the length incremented. 

This means that so long as the user has not used all allowed characters, you will essentially have a zero-terminated string, but if the user uses the full allowed length, there is no zero added to the end of the buffer.

 

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
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

VTUI library

Post by JimmyDansbo »


I have been toying with the notion that maybe I could use a kernal function to do the conversion between petscii and screencodes. Unfortunately it seems that the only place the kernal converts from petscii to screencodes is in a function that also prints the character to the screen.

My next thought is that I could possible make use of kernal functions in the VTUI library instead of writing directly to VERA. I am fairly sure that if I change the library to use kernal routines, the size will be decreased a fair bit and it would most likely be better at converting between petscii and screencodes.

What are your thoughts? Would there be any problems in using kernal routines instead of writing directly to VERA?

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
Post Reply