Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
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: 1648
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: 2980
$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: 1648
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: 1648
..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
crayon/Hokuto Force
apprentix
E$G/HF ⭐ 7
XmikeX
Guests online: 98
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Pal  (9.6)
4 Carrion  (9.6)
5 Sulevi  (9.6)

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