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 > D020 and D025 Raster Help
2018-04-15 07:23
Raistlin

Registered: Mar 2007
Posts: 549
D020 and D025 Raster Help

I haven't touched C64 coding for -years-... so have almost completely forgotten everything...

What I need is, one certain lines of the screen, to change D020 (border) and D025 (Sprite Multicolor1). On the screen, I have 8 sprites enabled, doubled in width and height and repeated all the way down.

I have a stable raster.

I can get -either- D025 or D020 to update at the right line - but never both. One always looks to be a whole raster line out. The code doing the updates is along the lines of:-

lda #40+(12*8)
WaitForRightLine:
cmp $d012
bcs WaitForRightLine

ldx #$0e
Loop0:
dex
bpl Loop0
nop
nop
lda $f0

sty $d025
sty $d020

ldx #$2b
Loop1:
dex
bpl Loop1
nop
nop

lda #$00
sta $d025
sta $d020

ldx #$0f
Loop2:
dex
bpl Loop2

Anyone know what I'm doing wrong..? This seems like something that people would commonly use for effects so I'm wondering what the problem is...

nb. I'm not using a whole-screen raster effect, I'm just doing the above at certain parts in the screen ... Ideally I'd like not to hog the CPU with this as I have some important calculations going on outside of the IRQs...
2018-04-15 08:06
Krill

Registered: Apr 2002
Posts: 2825
Assuming you're not stumbling over badline issues, are you sure you issue these two writes around HSYNC?

You can break into VICEmon and see what the line cycle count says when you execute these instructions. Should be around the 62->0 wrap.
2018-04-15 08:40
Raistlin

Registered: Mar 2007
Posts: 549
Ah... I didn't realise about the ViceMon cycle count - that's.. wow.. game changer for you guys compared to the 1980s ;)

Playing around with that, if I simply use NOPs (instead of a loop) to time things out, I'm seeing:-

0 NOPs: cycle=17
1 NOPs: cycle=19 (as expected)
10 NOPs: cycle=37 ("")
..
18 NOPs: cycle=53 ("")
19 NOPs: next-line and cycle=9 (!!!)

I've tried this on a few raster lines .. 137, 138, 139, 140, 141 .. always the same behaviour :-(

Is this because I have 8 sprites visible on the line..?
2018-04-15 08:44
Raistlin

Registered: Mar 2007
Posts: 549
(C:$98e3) z
.C:98e4 EA NOP - A:8C X:00 Y:02 SP:f3 N.-..I.. 8854132
(C:$98e4) r
ADDR A X Y SP 00 01 NV-BDIZC LIN CYC STOPWATCH
.;98e4 8c 00 02 f3 2e 35 10100100 141 049 8854132
(C:$98e4) z
.C:98e5 EA NOP - A:8C X:00 Y:02 SP:f3 N.-..I.. 8854134
(C:$98e5) r
ADDR A X Y SP 00 01 NV-BDIZC LIN CYC STOPWATCH
.;98e5 8c 00 02 f3 2e 35 10100100 141 051 8854134
(C:$98e5) z
.C:98e6 EA NOP - A:8C X:00 Y:02 SP:f3 N.-..I.. 8854136
(C:$98e6) r
ADDR A X Y SP 00 01 NV-BDIZC LIN CYC STOPWATCH
.;98e6 8c 00 02 f3 2e 35 10100100 141 053 8854136
(C:$98e6) z
.C:98e7 EA NOP - A:8C X:00 Y:02 SP:f3 N.-..I.. 8854155
(C:$98e7) r
ADDR A X Y SP 00 01 NV-BDIZC LIN CYC STOPWATCH
.;98e7 8c 00 02 f3 2e 35 10100100 142 009 8854155
2018-04-15 08:45
Scan

Registered: Dec 2015
Posts: 110
Quote:
Is this because I have 8 sprites visible on the line..?


Yes.

This PDF might come in handy for you, it shows when what happens. https://www.linusakesson.net/programming/vic-timing/index.php

Edit: Also, this tool can be of great help to see what cycles are consumed by the VIC in certain conditions: Victimer
2018-04-15 10:21
Raistlin

Registered: Mar 2007
Posts: 549
Ah, thanks all ... it looks like I need to rethink my effect a little. Back to the drawing board (again) :-)
2018-04-15 18:50
Rastah Bar

Registered: Oct 2012
Posts: 336
I also found this page very helpful:
http://unusedino.de/ec64/technical/aay/c64/victmain.htm
2018-04-15 19:38
Golara
Account closed

Registered: Jan 2018
Posts: 212
Quote: I haven't touched C64 coding for -years-... so have almost completely forgotten everything...

What I need is, one certain lines of the screen, to change D020 (border) and D025 (Sprite Multicolor1). On the screen, I have 8 sprites enabled, doubled in width and height and repeated all the way down.

I have a stable raster.

I can get -either- D025 or D020 to update at the right line - but never both. One always looks to be a whole raster line out. The code doing the updates is along the lines of:-

lda #40+(12*8)
WaitForRightLine:
cmp $d012
bcs WaitForRightLine

ldx #$0e
Loop0:
dex
bpl Loop0
nop
nop
lda $f0

sty $d025
sty $d020

ldx #$2b
Loop1:
dex
bpl Loop1
nop
nop

lda #$00
sta $d025
sta $d020

ldx #$0f
Loop2:
dex
bpl Loop2

Anyone know what I'm doing wrong..? This seems like something that people would commonly use for effects so I'm wondering what the problem is...

nb. I'm not using a whole-screen raster effect, I'm just doing the above at certain parts in the screen ... Ideally I'd like not to hog the CPU with this as I have some important calculations going on outside of the IRQs...


EDIT. Ignore me
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
Båtsman/Y-front
Scooby/G★P/Light
kbs/Pht/Lxt
St0rmfr0nt/Quantum
MAT64
Bieno/Commodore Plus
Guests online: 89
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.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (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 Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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