Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Critikill (CK) ! (Registered 2024-09-19) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > $D016 bit 5
2023-08-05 18:22
Krill

Registered: Apr 2002
Posts: 2940
$D016 bit 5

There is this mysterious bit early on in the KERNAL reset routine:
FCEF: 8E 16 D0  STX $D016     ; VIC: Control Register 2
with X being anything in [0..5].

Now, some people [who?] claim that without this store to $d016, some [which?] cartridges won't start [citation needed].

However, $D016 apparently used to have a mysterious "reset bit" in supposedly early VIC-II revisions (those with only 5 not 9 luma steps, and then the early ones of those).
   | Bit  5   |    Reset-Bit: 1 = Stop VIC (no Video Out, no RAM  |
   |          |                   refresh, no bus access)         |
Could this be the reason why some things on some machines (?) won't start without that store to $D016?
Do any machines still exist where setting $D016 to, say, $f8 would crash them (when running code from RAM)?
Or did this "reset bit" never exist? =)
2023-08-05 18:29
chatGPZ

Registered: Dec 2001
Posts: 11290
AFAIK this bit is only needed/used in the VICII of the MAX Machine. If at all :)
2023-08-05 18:32
Krill

Registered: Apr 2002
Posts: 2940
I thought so, too. And yet, seems to be a C-64 thing, too, after all. :)
2023-08-05 18:32
chatGPZ

Registered: Dec 2001
Posts: 11290
I'd say: Proof or bullshit :)
2023-08-06 07:40
Monte Carlos

Registered: Jun 2004
Posts: 355
What does "no ram" mean? How is d016 related to ram?
2023-08-06 07:55
Jetboy

Registered: Jul 2006
Posts: 265
Quote: What does "no ram" mean? How is d016 related to ram?

VIC IS responsible for RAM refresh. Turning VIC off would mean no RAM refresh = mangled memory sooner than later.
2023-08-06 08:51
Martin Piper

Registered: Nov 2007
Posts: 699
Quote: There is this mysterious bit early on in the KERNAL reset routine:
FCEF: 8E 16 D0  STX $D016     ; VIC: Control Register 2
with X being anything in [0..5].

Now, some people [who?] claim that without this store to $d016, some [which?] cartridges won't start [citation needed].

However, $D016 apparently used to have a mysterious "reset bit" in supposedly early VIC-II revisions (those with only 5 not 9 luma steps, and then the early ones of those).
   | Bit  5   |    Reset-Bit: 1 = Stop VIC (no Video Out, no RAM  |
   |          |                   refresh, no bus access)         |
Could this be the reason why some things on some machines (?) won't start without that store to $D016?
Do any machines still exist where setting $D016 to, say, $f8 would crash them (when running code from RAM)?
Or did this "reset bit" never exist? =)


The stx $d016 at $fcef uses the X index result of the cartridge check routine at $fd02 which checks for the CBM80 being mapped into $8004, which is why some might think it is related to "cartridges won't start".

In reality, if a cartridge partially maps the CBM80, maybe the cartridge dump was bad or deliberately like that, then the screen would have a noticeable different X scroll during reset and mem test.

You can see the different screen X scroll during a soft reset if you do: > 8004 0 0 cd 38 30
And compare it with: > 8004 0 0 0 0 0


So it is probably just a visual debugging aid for auto-start cartridges.
2023-08-06 09:21
Martin Piper

Registered: Nov 2007
Posts: 699
Although the programmer's reference guide does show d016 db5 as "RST" high. Hmm :)

The reset cartridge test at $fd02 does happen very early on after machine reset, the jsr does use the stack though. Hypothetically if the VIC defaults to being "in reset" and the memory refresh is off, this might mean the memory for the stack could fail... For the same/similar reason some machines fail with the VIC HSP using a "DMA delay" (DRAM refresh or whatever you want to call it) screen scroll.

Theoretically the delay between setting the stack memory, checking the cart, and reading the stack back with an rts could be small enough to not experience memory corruption.

This might explain why the $d016 set without "reset" is very early in the reset code, to make sure the VIC is refreshing memory...

All this would need to be tested if there are any VICs that do default to "reset on" and do not refresh the DRAM.
2023-08-06 09:33
Martin Piper

Registered: Nov 2007
Posts: 699
Although the HSP/VSP DRAM issue does seem to be related to unexpected DRAM refresh signal timings, rather than lack of refresh timings. DRAM that isn't refreshed *at all* would tend to decay slower than badly refreshed DRAM due to signals flickering unexpectedly.
2023-08-06 14:28
chatGPZ

Registered: Dec 2001
Posts: 11290
<offtopic>"VSP Bug" is not related to refresh - see LFTs article</offtopic>
2023-08-06 15:02
Martin Piper

Registered: Nov 2007
Posts: 699
Quote: <offtopic>"VSP Bug" is not related to refresh - see LFTs article</offtopic>

Incorrect, see "In short, one memory cell gets refreshed with the bit value of a different memory cell."
 
... 66 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next
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
MWR/Visdom
Guests online: 78
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Comaland 100%  (9.6)
8 Wonderland XIV  (9.6)
9 No Bounds  (9.6)
10 Unboxed  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Morph  (9.5)
8 Dawnfall V1.1  (9.5)
9 Onscreen 5k  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.2)
Top Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.2)

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