| |
Barbarossa
Registered: May 2007 Posts: 31 |
Cycle count in upperborder
Hi guys,
When trying to put together some timing scheme I noticed something I cannot explain.
When I singlestep trace my rasterinterrupt (I use CCS64) which triggers at raster $000, on the first line everything behaves fine. But on the second line ($001) and furtherdown, the cycle counter jumps from 56-58 to 8-10 as if sprites were active.
Sprites are active on the screen however only from Y=$36 to Y=$76.
What I am missing here? There cannot be bad lines in the border, and I am certain there are no sprites active. Why is the VIC stealing my cycles?
Some insight will be greatly appreciated.
Thanks.
John
|
|
| |
Scout
Registered: Dec 2002 Posts: 1570 |
Quote:
Why is the VIC stealing my cycles?
*Insert random seal picture here*
(Sorry for the thread hijack ;-) |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
One possible answer:
Sprite y position is 8 bit only. So, if you already set the sprite y to $36 before, VIC will display the sprites also beginning with $136 (PAL reaches this line) for the next 21 lines, which will also cover the top of the screen. So, actually this should happen on line 0 as well(can you recheck? could also be an emulator problem, you never know...). |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
Ninja,
Learning all the time... It looks to me your answer might be the right one, so I did a test. I moved my sprites to $06c. Obviously there can never be a $16c rasterline so in theory the delay should be gone. And... it was.
One question remains, why is it not there on rasterline $000? Maybe $000 is a special case because you cannot put a sprite on that line as well (I think it is not possible, since sprite Y = raster + 1).
Also it seems weird (allthough logical) that a sprite can steals cycles twice a frame.
John
|
| |
Barbarossa
Registered: May 2007 Posts: 31 |
So the delay is not there on $000, in both cases. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
Have you checked on a real c64? It might as well be an emulator bug. Can't tell, I never checked this. But if a sprite started before $0, I would assume it will be fetched also in 0. If not, abuse it, give it a fancy name and make a demo part out of it :) |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
I have not checked it on a real C64.
Maybe the users of Vice can confirm if this behaviour does or doesn't occur on that emulator? |
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
better check in Hoxs64 if you want to be on a safe side and cannot check on a C64. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
Naaah, nothing besides a real C64 can serve as a reference (by defintion, so to say ;)). Maybe someone else is willing to check this... |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
I can check it, but you know how does things go. Digging up the C64 out of a closet and plugging it on takes some time :-) And then I have to write some program to check, because there is not such thing as a cycle monitor on the real thing.
It could be a bug, however I doubt it. I have seen most things work like a charme on CCS64. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
CCS is good, no doubt. Still "most things" is way not enough for a reference, especially as this issue qualifies as a corner-case. I think you get my point :) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
also by now ccs is probably the least accurate of the "big three" when it comes to VIC :)
and yes, please write a testprogram.... wouldnt mind to test it on peters fpga core :) |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Ninja is 100% right. |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
@Ninja
I get your point. I will try to do some tests on the real thing when I get the chance. I did do a test with sprite 0 on Y=0. The spritedata is fetched during rasterline $000. And this worked ok in CCS64.
Could it be humble me stumbled on to something new :-)
@Groepaz
I noticed most of your hardcore guys here use Vice. I started out on CCS64 and it is difficult to change your habbits (I glanced at it once and didn't like the interface). I changed crossassembler once, and that was a long proces I would not like to repeat. But you are probably right that you are using the best Emulator. I am not a really hardcore democoder and learned the VIC tricks the last few years, so I guess for my needs CCS64 is suitable.
To sum it al up. I know now why the VIC steals cycles in the upper border, but it should also do that in line $000, which is probably a bug of the emulator. Right?
|
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Sounds like an emulator bug indeed, though i haven't confirmed it. |
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
Quote:.pc = $1000
sei
lda #<irq1
sta $0314
lda #>irq1
sta $0315
asl $d019
lda #$7b
sta $dc0d
lda #$f1
sta $d01a
lda #$1b
sta $d011
lda #$20
sta $d012
cli
loop: jmp loop
irq1:
lda #$ff
sta $d015
lda #$24
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
sta $d00b
sta $d00d
sta $d00f
lda #<irq2
sta $0314
lda #>irq2
sta $0315
lda #$00
sta $d012
asl $d019
pla
pla
pla
rti
irq2:
nop
nop
lda $d012
sta $0400
lda #<irq1
sta $0314
sta $d012
lda #>irq1
sta $0315
asl $d019
pla
pla
pla
rti
verified to give "A" ($01) in the top left corner of the screen on a real C64C, in Hoxs64 v1.0.5.25 and in VICE v2.0. "@" ($00) is displayed in CCS64 v3.6 suggesting a bug in this emulator.
Quoting Groepazalso by now ccs is probably the least accurate of the "big three" when it comes to VIC :)
this is correct,CCS is a real minefield of emulation flaws as far as i can tell from what i`ve seen. Vice is not flawless either but it has improved abit recently. Hoxs64 remains unbeatable when it comes to these "corner cases" and the overall emulation accuracy. |
| |
Martin Piper
Registered: Nov 2007 Posts: 722 |
It is just a shame Hoxs64 doesn't have such good debugging related support as VICE. :(
What would be really useful, which none of the emulators support at the moment, is being able to set a cycle level break point for a position on the screen and inspect CPU/VIC/CIA/SID with single cycle stepping. |
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
these features and many other debugging options would have been added to Hoxs long ago but the emulation accuracy fixes take top priority at all times and theres been alot to fix since the research on the C64 intensified in the late 2007. |
| |
Martin Piper
Registered: Nov 2007 Posts: 722 |
Quote: these features and many other debugging options would have been added to Hoxs long ago but the emulation accuracy fixes take top priority at all times and theres been alot to fix since the research on the C64 intensified in the late 2007.
If you need any help improving the debugger I'm more than happy to donate my coding time. |