| |
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... |
|
| |
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. |
| |
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..? |
| |
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 |
| |
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 |
| |
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) :-) |
| |
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 |
| |
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 |