Small LUT question

Description of your first forum.
Post Reply
bzuidgeest
Posts: 43
Joined: Wed May 01, 2019 6:51 pm

Small LUT question

Post by bzuidgeest » Mon Feb 03, 2020 11:01 pm

I've been toying with the emulator to see how vicky works and I have the following questions/notes. Hope someone can answer them for me

From the Revc4 published memory map I get the following:

$AF:1F00..$AF:173F - Text Mode Color Palette (Foreground)
$AF:1F40..$AF:1F7F - Text Mode Color Palette (Background)

$AF:2000..$AF:23FF - Graphic Mode Color Palette0
$AF:2400..$AF:27FF - Graphic Mode Color Palette1

The first line seems to have a typo 173f should be 1F3F I think. Correct?

If I read correctly that leaves a 64 byte segment for fore and background color. Given 4 bytes per color this gives me 16 colors for text max. Correct? Seems so when I toy with the values in the emulator

For graphics a lut is 16384 bytes divided by 4 bytes that gives 4096 entries per LUT. That more than 256 max color specified in the spec. So I'm guessing I am missing something here. But what?

Also it seems the emulator follows the memory map in the wiki and the hardware shifted the text lut's a little as they specify different addresses. I would edit the wiki but not sure which is correct and if I am allowed to edit the wiki.
User avatar
PJW
Posts: 37
Joined: Wed Apr 24, 2019 12:44 am

Re: Small LUT question

Post by PJW » Tue Feb 04, 2020 1:23 am

bzuidgeest wrote:
Mon Feb 03, 2020 11:01 pm
I've been toying with the emulator to see how vicky works and I have the following questions/notes. Hope someone can answer them for me

From the Revc4 published memory map I get the following:

$AF:1F00..$AF:173F - Text Mode Color Palette (Foreground)
$AF:1F40..$AF:1F7F - Text Mode Color Palette (Background)

$AF:2000..$AF:23FF - Graphic Mode Color Palette0
$AF:2400..$AF:27FF - Graphic Mode Color Palette1

The first line seems to have a typo 173f should be 1F3F I think. Correct?
Yeah... pretty sure that's a typo. At the moment, the Vicky memory map is the same as the RevB, if I recall correctly. Although things may move as Stefany starts to turn her attention to it.
If I read correctly that leaves a 64 byte segment for fore and background color. Given 4 bytes per color this gives me 16 colors for text max. Correct? Seems so when I toy with the values in the emulator
Yes... it's 4 bytes per LUT entry. Text mode has 32 colors: 16 for the foreground, 16 for the background. This matches how the color matrix works... each cell uses a byte: one nibble for foreground, and one nibble for background.
For graphics a lut is 16384 bytes divided by 4 bytes that gives 4096 entries per LUT. That more than 256 max color specified in the spec. So I'm guessing I am missing something here. But what?
I think you've done your hex math incorrectly here. It's 0x400 bytes per graphical LUT. That's 1024 bytes. With four bytes per entry, that's 256 entries, which is what should be in a graphical LUT.

Oh... and for those who don't know, a LUT entry is four bytes, one per channel: red, green, blue, and alpha. Currently, alpha is not used.
bzuidgeest
Posts: 43
Joined: Wed May 01, 2019 6:51 pm

Re: Small LUT question

Post by bzuidgeest » Tue Feb 04, 2020 10:42 am

@PJW,

That last one was indeed a miscalculaion (3FFF vs 3FF), sorry.

From your text you say "Vicky memory map is the same as the RevB" But revB has the pallettes at 1F40 and 1F80 (I think like emulator) not 1F00 and 1F40. So either stef's published revC spec contains the wrong range or they moved. Not impossible on a dev unit. Which range do you use in your basic on the revC?
User avatar
PJW
Posts: 37
Joined: Wed Apr 24, 2019 12:44 am

Re: Small LUT question

Post by PJW » Tue Feb 04, 2020 1:33 pm

bzuidgeest wrote:
Tue Feb 04, 2020 10:42 am
@PJW,

That last one was indeed a miscalculaion (3FFF vs 3FF), sorry.

From your text you say "Vicky memory map is the same as the RevB" But revB has the pallettes at 1F40 and 1F80 (I think like emulator) not 1F00 and 1F40. So either stef's published revC spec contains the wrong range or they moved. Not impossible on a dev unit. Which range do you use in your basic on the revC?
Oh... I failed to notice the different base address there. BASIC is currently using AF1F40 for the foreground text color LUT and AF1F80 for the background (and I've just verified that it's working in that respect). So at the moment, that's where the text color LUTs are located on the RevC. I'm not sure why the difference with the published memory map in this case. It may be that will be the location of the LUTs on the next FPGA update.

In general, I think my recommendation in this early stage is to get a copy of the kernel off of github and use the *_def.asm files as the canonical answers on the locations of the various hardware registers. If there's a conflict between something posted and something in the kernel, the kernel is mostly likely the right answer (since those definitions are generally what are used when code was written to test the hardware feature).
Post Reply