Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Sideborder open on badline
2022-05-12 10:32
Starfox

Registered: Jul 2014
Posts: 31
Sideborder open on badline

I'm just trying to see if I can remember some vic effects, like the FLD question I asked about the other day. I made those effects myself back in the day, but couldn't remember the timings etc. (even looking over my old convoluted code didn't help, lol) but got it working (thanks).

I'm now trying to open the sideborder on the first text line (line 51), which should be a badline.

I break after the stabilizing code:
            txs
            ldx #8
            dex
            bne *-1
            bit $00
            lda $d012
            cmp $d012
            beq *+2

            ldx #0        // break here
            ldy #$c0
            lda #$c8

            sty $d016
            sta $d016
            sty $d016
            sta $d016,x

Vice tells me it is at cycle 3. After executing "ldx #0" I'm at cycle 5. Executing "ldy #$c0" and I'm at cycle 7. Executing "lda #$c8" and I'm at cycle 9, as expected.

I'm then executing "sty $d016" but I'm at cycle 51. so the instruction ends on cycle 55. One cycle short, to open the border.

Btw I have no sprites on at the moment, but I want to have one sprite in the left border, and one in the right border, and I want to have text on those lines too, so no fld.

Before I try to fix this, I just want to know if I'm on the right track or completely wrong? 😄
 
... 11 posts hidden. Click here to view all posts....
 
2022-05-12 12:59
Martin Piper

Registered: Nov 2007
Posts: 631
I seem to remember the side borders cannot be opened on a bad line with sprite and text/bitmap screen enabled and without FLD. The cycles aren't available at the time you need them. Unless you're using that enabled screen but disabled badline mode.
2022-05-12 13:06
chatGPZ

Registered: Dec 2001
Posts: 11100
it can be done :) You might have to play with different instructions so the store happens in the right cycle
2022-05-12 13:18
Martin Piper

Registered: Nov 2007
Posts: 631
Postpone the $d016 write with a RMW instruction?
2022-05-12 13:34
Martin Piper

Registered: Nov 2007
Posts: 631
oh yes, doh, this is probably a clean example: Sideborder 4K

$265c stx $d016 - cycle 52
$265f sta $d016 - cycle 56

Note sprites 4-7 are enabled, 0-3 are disabled.

Interesting use of HSP/DMA delay as well.
2022-05-12 14:00
chatGPZ

Registered: Dec 2001
Posts: 11100
Quote:
sprites 4-7 are enabled, 0-3 are disabled

yes, this is the key :)
2022-05-12 14:21
Martin Piper

Registered: Nov 2007
Posts: 631
Quote: Quote:
sprites 4-7 are enabled, 0-3 are disabled

yes, this is the key :)


Yeah, sprite 0 fetch starts at cycle 58 with a read pre-stall 3 cycles before.
2022-05-12 17:26
Krill

Registered: Apr 2002
Posts: 2825
The interesting point here is that the write to $d016 most likely happens just before badline DMA, and not after in cycle 56.

Any new CPU op after the badline would be to late.

So the write goes to VIC just before badline DMA, but it's only effective in that magic cycle.

Or is there a better explanation for why open sideborder on a badline is possible at all? :)

Or maybe Christian Bauer's VIC Artikel is wrong again, and badline DMA is not offset by 1 cycle/char before display, but by 5 or so, thus CPU can work again already 5 cycles before the sideborder while the badline is still being drawn?
2022-05-12 18:03
Oswald

Registered: Apr 2002
Posts: 5017
Gunnar, I cant imagine VIC would only register d016 change 40 cycle later on a badline, just because, why ? I think instruction is stopped before its write cycle, then write cycle AND VIC checking if border needs to be started might happen at the same cpu cycle (remember vic being 8mhz)
2022-05-12 18:41
chatGPZ

Registered: Dec 2001
Posts: 11100
Quote:
remember vic being 8mhz

only the graphics sequencer
2022-05-12 18:44
Krill

Registered: Apr 2002
Posts: 2825
Quoting Oswald
I think instruction is stopped before its write cycle, then write cycle AND VIC checking if border needs to be started might happen at the same cpu cycle (remember vic being 8mhz)
The instruction isn't just stopped or temporarily halted, it's aborted, retired, and then restarted after the badline. At least afaik.

Or might there be some kind of clock-stretch going on?

As for delayed internal register update, VIC-II most likely isn't 8 MHz throughout, and i'm fairly certain the bus and register access circuitry is clocked at no more than 2 Mhz (and maybe only 1 for the latter). Also why can't the register update be delayed by a higher-priority bus access like DMA? :)
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
goerp/F4CG
CA$H/TRiAD
Matt
t0m3000/ibex-crew
kbs/Pht/Lxt
rexbeng
Mason/Unicess
Guests online: 76
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Newscopy  (9.1)
5 Elwix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.057 sec.