Jump to content
IGNORED

VBI question regarding PF0 and BAK in Graphics 1.10 - need help


Recommended Posts

Ok, here's the situation:

 

I am working on my latest ICE editor (ICE IRG 20, which uses Super IRG modes based on Graphics 1), and I have found that I need to modify my VBI routine that I used in previous ICE editors.

 

The character grid display is meant to render characters using Graphics 1 with the GTIA mode set to $40, $80, and $C0 ... that is, Graphics 9, 10, and 11. The problem is, Graphics 10 changes the color layouts to where BAK is used on some color combinations, and for the character grid, because of these quirks, the grid color is showing PF0. This becomes painfully obvious when I am using the Super IRG+ 20 mode, which makes color changes on all the used color registers (P1,P2,P3,PF1,PF3,BAK) every VBLANK:

 

post-23798-0-15219500-1363673847_thumb.png

 

This is the color tuner screen for Super IRG+ 20 (which is based on Graphics 1.10, or Graphics 1 with the GPRIOR set to $80). I've had to use normal Graphics 0.10 for the grid characters (the color blocks on the top), and this introduces errors into the display. I have marked these errors below:

 

Top left 9x9 color grid:

 

post-23798-0-29467400-1363675224.png

 

The right two groups of colors:

 

post-23798-0-72340400-1363675234_thumb.png

 

Incorrect colors/color groups have been marked with an X.

 

What's wrong is: In the upper left 9x9 color grid, the 2nd pixel in the first and last row needs to be dark brown, the same as the right two pixels in the second row (this should also be the case in all the color grids). Also, looking at the third group of colors in the first three rows and the last three, these should all be shaded the same yellow shading as the right two groups of colors in the middle three rows. This is the correct color display for Super IRG+ 20. Instead, the colors which should be showing BAK (yellow and dark brown) are instead returning PF0, a color register not used in Super IRG+ 20 (which I have set to black here).

 

So what I need, is to add code to the VBI routine below, to make PF0 a shadow of BAK ... that is, take the value in BAK (712) and store it in PF0 (708) after all the other register changes are done, and make the character grid display correct ... since PF0 is never used in these modes anyway, this would not be a problem.

 

The VBI routine is below, where do I add the changes, and are there any other commands (like PLA, etc.) needed?

 


0100 *=600
0108 VBI
0109 LDX #14
0110 CHECKLOOP
0120 LDA REGTABLE,X
0130 STA 203
0140 LDA REGTABLE+1,X
0150 STA 204
0160 ORA 203
0170 BEQ NOCHANGE
0180 LDA 20
0190 AND #1
0200 STA TEMP1
0210 TXA
0220 ORA TEMP1
0230 TAY
0240 LDA VALUETABLE,Y
0250 LDY #0
0260 STA (203),Y
0270 NOCHANGE = *
0280 DEX
0290 DEX
0300 BPL CHECKLOOP
0310 JMP $E45F
0320 TEMP1 = 205
0330 .BYTE 0
0340 REGTABLE = $0400
0350 .WORD $02F4,$02C4,0,0
0360 .WORD 0,0,0,0
0370 VALUETABLE = $0408
0380 .BYTE $60,64
0390 .BYTE $34,$36
0400 .BYTE 0,0
0410 .BYTE 0,0
0420 .BYTE 0,0
0430 .BYTE 0,0
0440 .BYTE 0,0
0450 .BYTE 0,0

Edited by Synthpopalooza
Link to comment
Share on other sites

This part is at least not 100% correct, it will underflow once to X=$FE because BPL also branches on X=0.

 

LDX #14

 

DEX

DEX

BPL CHECKLOOP

 

And of course Graphics 10 is off to the right by one color color clock (basis for HIP/TIP modes), which can cause squirks here.

Link to comment
Share on other sites

This part is at least not 100% correct, it will underflow once to X=$FE because BPL also branches on X=0.

 

LDX #14

 

DEX

DEX

BPL CHECKLOOP

 

?? ;) why wouldn't it be corect? Last loop will be with X=0, when it decreases to $fe it will not loop and jmp $e465 will be executed.

Edited by MaPa
Link to comment
Share on other sites

I believe that's the point, to make the loop count from 14 to 0 inclusive, a trick I use all the time. The routine supports updating up to eight memory locations per VBL from one of two sets of interleaved register values depending on whether an even or odd frame is being displayed.

 

To update PF0, I believe the address of COLOR0 (708) just needs to be added to the register table, and corresponding colors duplicated in the value table.

 

What's unfortunate is that at 73 bytes this routine is not much shorter than just doing 8x LDA imm + STA abs for all eight registers on two paths. Also, shouldn't the value table be at $0410 instead of $0408, and shouldn't the origin be $0600 instead of 600?

Link to comment
Share on other sites

The problem here is, all eight locations are in use by my program.

 

For the Super IRG+ 20 mode, it's set up like this:

 

1. CHBAS (character grid)

This is for the character grid at the top of the screen

 

2. CHBAS (character set)

Character set display at bottom of screen

 

3. PM1 (705)

4. PM2 (706)

5. PM3 (707)

6. PF1 (709)

7. PF3 (711)

8. BAK (712)

 

These are the six color registers which are used in Super IRG+ 20 that get changed every VBLANK.

 

No room left for PF0 without adding registers, but I think I'd rather just have an extra command or two on the end of the loop to read the value currently stored in BAK after each frame, and store it in PF0. It would also require the least alterations to my program, and automatically correct itself whenever I switch to other ICE graphics modes that use Graphics 1.10.

 

The HIP shift is not an issue, as all the modes in this ICE editor are entirely GTIA based. And the example Super IRG+ 20 mode here, is used entirely in Graphics 1.10 with no GTIA changes.

Edited by Synthpopalooza
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...