Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


Forums > C64 Coding > D020 and D025 Raster Help
2018-04-15 07:23
Raistlin

Registered: Mar 2007
Posts: 14
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: 952
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: 14
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: 14
(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: 69
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: 14
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
Color Bar

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

Registered: Jan 2018
Posts: 61
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
Icon/TRIAD
Mr Ammo/SCS*TRC
Dr.Strange/Atlantis
cadaver/covertbitops
psych858o/MSL/Elysiu..
The Human Co../Maste..
pcollins/Excess
Mibri/HF
Danzig/Guilty
Lubber/Padua
taper/ΤRIΛD
ghost/excess
Knight Rider/Excess
deizi
Harekiet
TPM/Silicon Ltd
Guests online: 51
Top Demos
1 Uncensored  (9.7)
2 Comaland 100%  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 The Shores of Reflec..  (9.6)
6 Wonderland XII  (9.6)
7 We Come in Peace  (9.6)
8 Lunatico  (9.6)
9 Incoherent Nightmare  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 FMX Music Demo  (9.5)
2 Pandemoniac Part 2 o..  (9.5)
3 Daah, Those Acid Pil..  (9.5)
4 Dawnfall V1.1  (9.5)
5 Treu Love [reu]  (9.5)
6 In Memoriam BHF  (9.5)
7 Merry Xmas 2017  (9.4)
8 Dawnfall  (9.4)
9 SWiRL  (9.4)
10 Synthesis  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.4)
5 Crest  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Horizon  (9.8)
3 The Mind Slayer  (9.7)
4 The Shadow  (9.7)
5 Stormbringer  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.098 sec.