VERA FX

Chat about anything CX16 related that doesn't fit elsewhere
DragWx
Posts: 306
Joined: Tue Mar 07, 2023 9:07 pm

Re: VERA FX

Post by DragWx »

Ed Minchau wrote: Wed Aug 30, 2023 6:39 am

Code: Select all

 lda #$04 ;DCSEL = 2
 sta $9f25
 lda #$40 ;enable cache write, addr-1 mode normal
 sta $9f29
 lda #$10 ;multiply
 sta $9f2c
 sta $9f24 ;send result to VRAM
 stz $9f29 ;disable cache write
 stz $9f25 ;DCSEL = 0
Change STA $9F24 to STZ $9F24, because according to the FX documentation, when cache-write mode is enabled, the value you write to DATA0 or DATA1 acts as a nybble-mask which determines which nybbles of the cache get written out to VRAM, where a 0 bit writes the nybble and a 1 bit masks it out.

I suspect this may resolve the issue in your second post too.
Ed Minchau
Posts: 483
Joined: Sat Jul 11, 2020 3:30 pm

Re: VERA FX

Post by Ed Minchau »

STZ fixed the first problem. The documentation makes it sound like it must be a STA command. The second problem persists though; the first time I execute test, the bits 7:0 don't change. The second time I do the identical test, the least significant bits are correct. Not a big deal if you're only using 31:16 of the result.
DragWx
Posts: 306
Joined: Tue Mar 07, 2023 9:07 pm

Re: VERA FX

Post by DragWx »

Oh, I see what's going on. The data ports fetch from VRAM only when the address is updated, not when the port is read.

Therefore, if you set both ports to the same address, then use one port to write a byte to VRAM, then immediately use the other port to try to read it, you'll get the old value that was at that address, from when you first pointed that port to that address. The documentation points this out too, in the blurb just above this link.

A couple of people have been caught by this gotcha by now actually, so maybe the VERA documentation should make this behavior more clear.
Ed Minchau
Posts: 483
Joined: Sat Jul 11, 2020 3:30 pm

Re: VERA FX

Post by Ed Minchau »

Ohhh, I hadn't seen that documentation. I was going from a link in the original post which links to a Google Doc. This one has examples!
BruceRMcF
Posts: 222
Joined: Sat Jan 07, 2023 10:33 pm

Re: VERA FX

Post by BruceRMcF »

Ed Minchau wrote: Thu Aug 31, 2023 3:42 am STZ fixed the first problem. The documentation makes it sound like it must be a STA command. ...
According to the 65C02 datasheet, if STZ and STA have the same address mode, they execute the same cycles in the same order, so for accessing I/O devices, you can generally treat a STZ as a specialized form of a STA.
User avatar
ahenry3068
Posts: 988
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA FX

Post by ahenry3068 »

DragWx wrote: Thu Aug 24, 2023 2:02 am I'm not sure, it looks like there's a pre-release build available on the GitHub page, but I think it might still need some more time for an "official" release or else we would've seen an announcement here.

I'm feeling kind of stupid. I've been poking around on GitHUB and I can't figure out which file I need to download to upgrade my VERA firmware. Just upgraded my board to R44 yesterday, I was holding out.
DragWx
Posts: 306
Joined: Tue Mar 07, 2023 9:07 pm

Re: VERA FX

Post by DragWx »

On the community VERA repo page, find "Releases" in the right column and click on it. On this releases page, check that you're looking at the most recent post, read it for information, and the files to download will be under the "assets" header (click to expand it) at the bottom of the post.

I agree that this isn't very discoverable on GitHub's part, similar to repos where the "actions" tab contains the automated builds.
russell-s-harper
Posts: 13
Joined: Sat Jan 27, 2024 7:22 pm

Re: VERA FX

Post by russell-s-harper »

Is there any chance of getting some examples for the helpers? I'm finding the documentation very hard to follow.

For example, I'm trying to use the "Line Helper" but it's like every time I read the documentation I find some other missing detail, and then I'm not sure where it fits in the sequence. Having the memory map on an initial page while the FX material is near the end is also very inconvenient. By the time I scroll up, then back down, I've forgotten what I was looking for.

It would really help to have some working code as the author Frank van den Hoef intended the VERA FX features to be used.
russell-s-harper
Posts: 13
Joined: Sat Jan 27, 2024 7:22 pm

Re: VERA FX

Post by russell-s-harper »

To answer my own question:
russell-s-harper wrote: Mon Apr 08, 2024 4:03 pm Is there any chance of getting some examples for the helpers? ...
There is now! https://github.com/Russell-S-Harper/EXPLORE

Directory cx16-v2 has an example of dual 16-color screens, with swapping during the VBI, and 16-color line drawing routines, all using VERA. Even though it's written in C and implements clipping, it's still about 25% faster than the 256-color line drawing routines in TGI.

Major thing I don't like is that I'm still using TGI routines to set up the graphics, and then later I set the screen to 16-color. Would like to not be dependent on TGI.

Next on deck is to work on a complete demo, either the DOSBox Demo in the same repository, or something related.

Thanks to hstubbs3 and DragWx for their assistance!
Post Reply