Page 7 of 11

VTUI library

Posted: Wed Feb 24, 2021 6:20 am
by JimmyDansbo


8 hours ago, Greg King said:




You should change the "INPUTS" description to show the new meaning of .A .



I thought I had changed this. Can you point me to where I have missed it?


VTUI library

Posted: Fri Feb 26, 2021 9:06 am
by JimmyDansbo

A couple of revisions ago I removed the clear_screen function as the same can be achieved by the fill_box function, but I have been thinking about adding clear_screen back in as I believe there is room in the 1K and I can not think of any other function that could be added within the remaining ~100 bytes.

What do you guys think?


VTUI library

Posted: Fri Feb 26, 2021 9:35 am
by desertfish

yeah I think it's convenient to not have to specify the exact dimensions every time you just need to clear the screen, and instead let the routine figure out the active screen dimensions internally via SCREEN() or so.

what is convenient though is still being able to specify the character and colors just like fillbox


VTUI library

Posted: Fri Feb 26, 2021 9:54 am
by JimmyDansbo


17 minutes ago, desertfish said:




what is convenient though is still being able to specify the character and colors just like fillbox



How about having fill_box clear the screen if width is set to 0 ?

I think that requires less code in the library than having two separate functions


VTUI library

Posted: Fri Feb 26, 2021 10:08 am
by desertfish

up to you

but I personally prefer a separate function (you can call fill_box internally?) if the remaining bytes allow it.

hmm perhaps a good idea to leave a couple dozen bytes free in any case, to allow for future changes/bugfixes?


VTUI library

Posted: Fri Feb 26, 2021 1:01 pm
by JimmyDansbo

I have added it as a new function. That was actually a bit shorter than having fill_box check for the width ? 

For now, I have not bumped the version, but you can find the updated binary and source code on the github page.

 


VTUI library

Posted: Fri Feb 26, 2021 2:02 pm
by desertfish

0.5 is the new 0.5 ?

Great stuff.  I saw the "midnight commander" demo appliction. Is that one of the examples in the repo?   I'd like to try to port your examples to prog8 to see if I missed anything in the integration.


VTUI library

Posted: Fri Feb 26, 2021 2:06 pm
by JimmyDansbo


13 minutes ago, desertfish said:




I saw the "midnight commander" demo appliction. Is that one of the examples in the repo?



It is not one of the examples in the repo as the source was just thrown together to create interesting-looking images

I am going to and from changing print_str to enable it to write strings without touching the color of the chars. - I have a very hard time deciding... (this is why I have not updated to 0.6 yet)


VTUI library

Posted: Fri Feb 26, 2021 3:12 pm
by JimmyDansbo

Finally decided that I wanted print_str to support not setting the color.

Library updated to version 0.6


 


VTUI library

Posted: Sat Feb 27, 2021 2:27 am
by desertfish


11 hours ago, JimmyDansbo said:




Finally decided that I wanted print_str to support not setting the color.



I can't think of a reason why this is useful, do you have an example perhaps?

Also a tiny suggestion for any future version: add new routines (if any) at the end of the jump table, instead of inserting them in the middle.

That way existing code can keep running hopefully ?  Mostly asking this because I now had to renumber most of the routines' addresses in my prog8 interface. That looks like this:

vtui $1000 {

%asmbinary "VTUI0.6.BIN", 2 ; skip the 2 dummy load address bytes

; NOTE: base address $1000 here must be the same as the block's memory address, for obvious reasons!
romsub $1000 = initialize() clobbers(A, X, Y)
romsub $1002 = screen_set(ubyte mode @A) clobbers(A, X, Y)
romsub $1005 = set_bank(ubyte bank @Pc) clobbers(A)
romsub $1008 = set_stride(ubyte stride @A) clobbers(A)
romsub $100b = set_decr(ubyte incrdecr @Pc) clobbers(A)
romsub $100e = clr_scr(ubyte char @A, ubyte colors @X) clobbers(Y)
romsub $1011 = gotoxy(ubyte column @A, ubyte row @Y)
romsub $1014 = plot_char(ubyte char @A, ubyte colors @X)
romsub $1017 = scan_char() -> ubyte @A, ubyte @X
romsub $101a = hline(ubyte char @A, ubyte length @Y, ubyte colors @X) clobbers(A)
romsub $101d = vline(ubyte char @A, ubyte height @Y, ubyte colors @X) clobbers(A)
romsub $1020 = print_str(str string @R0, ubyte colors @X, ubyte convertchars @A) clobbers(A, Y)
romsub $1023 = fill_box(ubyte char @A, ubyte width @R1, ubyte height @R2, ubyte colors @X) clobbers(A, Y)
romsub $1026 = pet2scr(ubyte char @A) -> ubyte @A
romsub $1029 = scr2pet(ubyte char @A) -> ubyte @A
romsub $102c = border(ubyte mode @A, ubyte width @R1, ubyte height @R2, ubyte colors @X) clobbers(Y) ; NOTE: mode 6 means 'custom' characters taken from r3 - r6
romsub $102f = save_rect(ubyte ramtype @A, ubyte vbank @Pc, uword address @R0, ubyte width @R1, ubyte height @R2) clobbers(A, X, Y)
romsub $1032 = rest_rect(ubyte ramtype @A, ubyte vbank @Pc, uword address @R0, ubyte width @R1, ubyte height @R2) clobbers(A, X, Y)
}

as you can see, it uses its own language construct to interface to the routines - I can't include the vtui assembly source file and refer to the symbols defined in there.

It can include the pre-assembled binary library though. And that relocation trick of VTUI is pretty awesome, I can load it at any address I want that is amazing