Vera Color Registers
-
- Posts: 82
- Joined: Tue Jan 12, 2021 9:52 pm
Vera Color Registers
Hi!
The Vera has a palette that can be changed, which is awesome, a little like the Amiga in that way.
All is fine when I change the colors to writing to the Vera registers, but when I read, and try to restore later, it won't work. It is like the values reading the color registers are not correct?
Am I doing something wrong, or is this a known bug, or a know issue, that you need to take special care to read the registers?
Cheer
CKs
Vera Color Registers
14 minutes ago, CursorKeys said:
All is fine when I change the colors to writing to the Vera registers, but when I read, and try to restore later, it won't work. It is like the values reading the color registers are not correct?
Am I doing something wrong, or is this a known bug, or a know issue, that you need to take special care to read the registers?
You should be able to read back the values once you've set them. That's the caveat though, you can't read them unless you've set them. Ie, you can't read the default palette. (Imho this should be set on startup by the kernel on startup...)
Just checked, and the following does return $0f for both 'lda's.
lda #$11
sta ADDRx_H
lda #$fa
sta ADDRx_M
stz ADDRx_L
lda #$0f
sta DATA0
sta DATA0
lda #$11
sta ADDRx_H
lda #$fa
sta ADDRx_M
stz ADDRx_L
stp
lda DATA0
lda DATA0
-
- Posts: 82
- Joined: Tue Jan 12, 2021 9:52 pm
Vera Color Registers
>>You can't read them unless you've set them. Ie, you can't read the default palette
Ah ok.... I think you should though. Now my code is including the original palette as data, just in order to restore the palette after I messed it up. But if the default palette would be tweaked at some point, my code will be less accurate. Ok, not a biggy, but at least then I am not going crazy. And yes, if the Kernal would set the palette on startup, it would make sense you could read it later on. That sounds like a good solution.
Vera Color Registers
59 minutes ago, CursorKeys said:
Hi!
The Vera has a palette that can be changed, which is awesome, a little like the Amiga in that way.
All is fine when I change the colors to writing to the Vera registers, but when I read, and try to restore later, it won't work. It is like the values reading the color registers are not correct?
Am I doing something wrong, or is this a known bug, or a know issue, that you need to take special care to read the registers?
Cheer
CKs
Right, the issue is that the VERA registers are read only. So when you read data back from the locations used for things like the palette, what you are actually reading is the RAM at those same locations.
Once you have written your own palette data there, it's easy enough to read it back, but remember that you're always reading the cached information - not the actual register values.
Having said all that... the palette is (or will be) documented in the VERA programmer's reference, so it should be possible to create a default state, so you can fall back to it. You'll have to create your initial palette by hand, but once you do, you can reload that at any time.
Vera Color Registers
Oh, that's what's going on. Heh. I read the VERA programmer's reference, said "wut? But how did the palette get there in the first place?" then said "meh" and wrote code to write the entries I needed into the palette ... that was already there... so it would be initialized and I could read it back. Ok. Anyway, I only preloaded 2 of the palette pages, the 0 page with the system colors, and the grey scale page, which I loaded into the remaining 15 pages.
I would like to load pages 1 to 14 with the original default colors, are they documented anywhere? Reverse engineering the grey scale was a piece of cake... 1,1,1, 2,2,2, etc. But page 0 was a pain, requiring me to meticulously color match each entry.
-
- Posts: 503
- Joined: Sat Jul 11, 2020 3:30 pm
Vera Color Registers
You can find the numbers for the default palette here:
https://www.8bitcoding.com/2019/12/default-palette.html?m=1
Vera Color Registers
On 12/2/2022 at 6:30 PM, Ed Minchau said:
You can find the numbers for the default palette here:
https://www.8bitcoding.com/2019/12/default-palette.html?m=1
Sweet! Thanks! That's exactly what I needed. Now I can just populate the other 14 pages easy-peazy.
So basically, in a nut shell, (Ans someone please correct me if my assessment is in error.) the VERA initializes the palette internally on startup, but leaves the cache section in VRAM at random values. The cache migration is one way only, you place data in address 1fa00 to 1fbff and it is pulled into the VERA chip and used, once you place data in the VRAM, you can read the copy that is left by reading from it, or further modify it by rewriting it.
- StephenHorn
- Posts: 565
- Joined: Tue Apr 28, 2020 12:00 am
- Contact:
Vera Color Registers
On 12/2/2022 at 9:04 PM, Daedalus said:
So basically, in a nut shell, (Ans someone please correct me if my assessment is in error.) the VERA initializes the palette internally on startup, but leaves the cache section in VRAM at random values. The cache migration is one way only, you place data in address 1fa00 to 1fbff and it is pulled into the VERA chip and used, once you place data in the VRAM, you can read the copy that is left by reading from it, or further modify it by rewriting it.
That sounds pretty much correct.
Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
Vera Color Registers
Maybe "BIOS" (Kernal) could make life easier for programmers, if the boot procedure set VERA color registers?
Reminds me of 0xD012 on C64 ?
-
- Posts: 24
- Joined: Sun Nov 13, 2022 9:15 am
Vera Color Registers
On 12/3/2022 at 1:30 AM, Ed Minchau said:
You can find the numbers for the default palette here:
https://www.8bitcoding.com/2019/12/default-palette.html?m=1
I have a little byte block for it:
$00,$0,$ff,$f,$00,$8,$fe,$a,$4c,$c,$c5,$0,$0a,$0,$e7,$e,$85,$d,$40,$6,$77,$f,$33,$3,$77,$7,$f6,$a,$8f,$0,$bb,$b,
$00,$0,$11,$1,$22,$2,$33,$3,$44,$4,$55,$5,$66,$6,$77,$7,$88,$8,$99,$9,$aa,$a,$bb,$b,$cc,$c,$dd,$d,$ee,$e,$ff,$f,
$11,$2,$33,$4,$44,$6,$66,$8,$88,$a,$99,$c,$bb,$f,$11,$2,$22,$4,$33,$6,$44,$8,$55,$a,$66,$c,$77,$f,$00,$2,$11,$4,
$11,$6,$22,$8,$22,$a,$33,$c,$33,$f,$00,$2,$00,$4,$00,$6,$00,$8,$00,$a,$00,$c,$00,$f,$21,$2,$43,$4,$64,$6,$86,$8,
$a8,$a,$c9,$c,$eb,$f,$11,$2,$32,$4,$53,$6,$74,$8,$95,$a,$b6,$c,$d7,$f,$10,$2,$31,$4,$51,$6,$62,$8,$82,$a,$a3,$c,
$c3,$f,$10,$2,$30,$4,$40,$6,$60,$8,$80,$a,$90,$c,$b0,$f,$21,$1,$43,$3,$64,$5,$86,$7,$a8,$9,$c9,$b,$fb,$d,$21,$1,
$42,$3,$63,$4,$84,$6,$a5,$8,$c6,$9,$f7,$b,$20,$1,$41,$2,$61,$4,$82,$5,$a2,$6,$c3,$8,$f3,$9,$20,$1,$40,$2,$60,$3,
$80,$4,$a0,$5,$c0,$6,$f0,$7,$21,$1,$43,$3,$65,$4,$86,$6,$a8,$8,$ca,$9,$fc,$b,$21,$1,$42,$2,$64,$3,$85,$4,$a6,$5,
$c8,$6,$f9,$7,$20,$0,$41,$1,$62,$1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