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