n00b question on VideoMode80

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
JimmyDansbo
Posts: 39
Joined: Fri Feb 24, 2023 8:57 pm
Location: Denmark

n00b question on VideoMode80

Post by JimmyDansbo »

Hi.

I have been looking at videomodes 9 and 80 as I would like to do something with 80 column text.
It seem like it should be possible to change the color of the letters/tiles, but I can not figure out how it is done.

All I can find is the m80_rompal, m80_rampal, m80_bgclist & m80_fgclist, but they seem to work on individual scanlines.
In the forum post that is used as documentation for videomode 80, it seems it should at least be possible to change the forground color of the letters/tiles.

Any help on changing colors would be appreciated.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: n00b question on VideoMode80

Post by D3thAdd3r »

Hey Jimmy, try this out:

Code: Select all

#include <stdbool.h>
#include <avr/io.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
#include <uzebox.h>
#include <stdint.h>


extern m80_dlist_tdef*  m80_dlist;
m80_dlist_tdef dlist[1];

int main(){
	ClearVram();

	dlist[0].vramrow = 1U;
	dlist[0].tilerow = 1U;
	dlist[0].bgc = 0b00000000; /* Background color => black */
	dlist[0].fgc = 0b00101000; /* Foreground color => green */
	dlist[0].next = 0U;   /* End of Display List */

	m80_dlist = &dlist[0];//set the pointer to our new display list

	Print( 0,  1, PSTR("   <--------><--------><--------><--------><--------><--------><--------><-------->   "));
	Print( 0,  2, PSTR("  00        10        20        30        40        50        60        70        80  "));
	Print( 0, 12, PSTR("                                                                                      "));
	Print( 0, 13, PSTR("                              80 x 28 code tile display                               "));
	Print( 0, 14, PSTR("                                  (??? x 224 pixels)                                  "));
	Print( 0, 15, PSTR("                                                                                      "));
	Print( 0, 25, PSTR("  00        10        20        30        40        50        60        70        80  "));
	Print( 0, 26, PSTR("   <--------><--------><--------><--------><--------><--------><--------><-------->   "));

	while(1);
}
User avatar
JimmyDansbo
Posts: 39
Joined: Fri Feb 24, 2023 8:57 pm
Location: Denmark

Re: n00b question on VideoMode80

Post by JimmyDansbo »

Thanks.

I will have to play around with this a little to figure out how I can change the color of individual letters and lines...
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: n00b question on VideoMode80

Post by D3thAdd3r »

I don't know much about mode 80, except it's a code tile mode aiming at max resolution. The display lists seem very powerful though I haven't played with them. You can do it by individual scanline for sure, but as far as individual coloring of particular characters I'm not sure it's possible here without baking it into the tileset?

His response to the possibility of an "inversion bit":
Jubatian wrote:If you fill up the whole character set, half with the "straight" characters (0 - 127), next half with the inverted variants (128 - 255), then essentially you will have that! I attached a generated character set (21Kbytes) and a corresponding demo. Include the charset on Line 139 of videoMode80core.s instead of the cp437 one, compile, and you have it!

At this resolution I don't see it possible to do an algorithmic swap, or the size of that could end up being much worse (even if it can be done in 2 clocks, having an "rjmp" instead of that likely pays off in tail merging).
I know Mode 9 can do 60 characters wide at 8bpp, but I'm pretty sure the very high resolution code tiles is pretty much all rapid linear output versus looking up memory values and flags.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: n00b question on VideoMode80

Post by D3thAdd3r »

Also this though you'd have to ask Alec how that works and if it's even in the kernel currently
Image
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: n00b question on VideoMode80

Post by uze6666 »

I've added mode80 to the kernel recently. Pretty well documented. Concerning the above picture, its indeed using mode80 now. I'm about to add a basic uzenet lib to the kernel. Just testing it a bit more while developing the wifi setup tool.

But basically it a 80x25 characters mode. Tiles don't work the same way as other modes since their width is measured not in pixels but in cycles! So it's a bit tricky to make the tileset, some adjacent pixels rules must be respected etc. But I think all is documented.
Post Reply