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


Forums > C64 Coding > Zeropage initialization values
2006-03-17 19:49
Frantic

Registered: Mar 2003
Posts: 1628
Zeropage initialization values

Hello!

I don't really have any good understanding of what happens all around in the Zeropage area when kernal is switched in and so on (as I normally just take over the whole memoryspace of the c64 myself). However, I wonder if anyone can point me to a zeropage adress that is veeeeeeeeeeeerry (preferably 100%) probable to contain a value of zero directly after your program has been loaded, no matter if it was loaded by kernal routines, a cartridge fastloader, from mmc64 (maybe this is a special case?) or cmd-hd, on c128 as well as sx-64 and all that, or just whatever. Simply, an adress that you can safely assume is set to $00 when your own program is loaded and starts. ...if there is such an adress.

Thanks in advance.

//Frantic / Hack'n'Trade - http://www.lcp.c64.org
2006-03-17 20:49
Krill

Registered: Apr 2002
Posts: 2853
$39/$3a contains the current basic address. So if your program's basic start line is 0 sys2061 or so, $39 and $3a will safely contain 0 after run. Is that what you're looking for?
But, what do you need that for?
2006-03-23 12:56
Frantic

Registered: Mar 2003
Posts: 1628
Thanks for the reply.

I am coding an entry for the Tiny Sid competition and I wanted to substitute:

lda #0
tax

for a:

lax zpsomewherewhichisalreadyequaltozero

...to save one byte. ;)

But in this special tinytinytiny-coding case I do not start with a basic sys. The startup code looks like this instead:

* = $326
@binbegin:
.word @start
.word $f6ed
@start: sei
;..and the rest of the code goes here.

2006-03-23 14:31
ready.

Registered: Feb 2003
Posts: 441
Self-starting code after loading, right? I'm not sure about tiny sid rules, but in some compos your production HAS to be started from a RUN command. But I might be wrong for tiny sid compo.


Back to your request. Location $02 is zero after loading and as far as I know it is unused.
2006-03-23 15:11
Frantic

Registered: Mar 2003
Posts: 1628
..about the Tiny SID rules. Several entries, including my own, in the previous run of the compo used this specific method to execute the program. Even the entry of the compo organizer himself for the current compo use this method, so I guess it's pretty much 100% safe. ;)

And.. Is it really the case that $02 is 00 after loading in general, no matter what cart you've been using for loading the program and so on? The fact that it is generally 00 doesn't mean that it is _always_ zero, I guess? Just want to make sure... :)
2006-03-23 16:00
TNT
Account closed

Registered: Oct 2004
Posts: 189
Couple of pretty safe locations:

$93 - load/verify flag (0 = load)
$98 - open file count
$99 - input device (0 = keyboard)

I doubt *any* card uses them ($93 maybe being exception) as that would affect computer state too much.

Maybe better idea is to do "tya; tax;" instead, tho...
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
Sande/Hokuto Force
Sentinel/Excess/TREX
tubesockor
algorithm
Thunder.Bird/HF/MYD!..
Jazzcat/Onslaught
bugjam
anonym/padua
Rebok/BOOM!/Tropyx
d4ng3r
DeMOSic/HF^MS^BCC^LSD
Fritske
digix
Guests online: 166
Top Demos
1 13:37  (9.8)
2 Next Level  (9.8)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 No Bounds  (9.6)
8 Uncensored  (9.6)
9 Wonderland XIV  (9.6)
10 Multiverse 100%  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Layers  (9.6)
5 Copper Booze  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

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