Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
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: 680
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: 2980
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: 680
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: 680
(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: 111
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: 680
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
Account closed

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
Krill/Plush
Linus/MSL
Fred/Channel 4
X-Raffi/X-Rated
REBEL 1/HF
Paul Bearer
Mike
Didi/Laxity
Guests online: 78
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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