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


Forums > C64 Coding > Safe zeropage addresses
2008-04-21 12:30
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Safe zeropage addresses

Which zeropage addresses are safe for use?
I've checked through a C64-memory map, and it seems like most zeropage locations with the exception of $00 and $01 are mostly for BASIC stuff, meaning that they should be OK when coding demos that doesn't use ase any BASIC or Kernel stuff?

2008-04-21 12:37
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Which zeropage addresses are safe for use?
I've checked through a C64-memory map, and it seems like most zeropage locations with the exception of $00 and $01 are mostly for BASIC stuff, meaning that they should be OK when coding demos that doesn't use ase any BASIC or Kernel stuff?



You said it yourself. If your demo doesn't use any BASIC or Kernel stuff, all addresses except $00 and $01 are safe. It's really simple as that.
2008-04-21 12:41
Shadow
Account closed

Registered: Apr 2002
Posts: 355
Thanks, good to know. I was a bit unsure of things like $a0-$a2 and $c5-$c6 for example (some kind of timer thing, and keyboard).
2008-04-21 12:52
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Thanks, good to know. I was a bit unsure of things like $a0-$a2 and $c5-$c6 for example (some kind of timer thing, and keyboard).

ZP is just memory and not related to any I/O chips at all in any way except through kernel calls.

Although when adding music and IRQ-loaders you must know what ZP-locations they use so that you doesn't accidentally overwrite those. F.e. I normally use GoatTracker and Krill's IRQ-loader, both with customizable ZP-locations so it's really not any problems at all.
2008-04-21 13:32
HCL

Registered: Feb 2003
Posts: 727
IRQ-loaders don't use ZeroPage, only decrunchers. That's a rule. Plus music of course.
2008-04-21 13:55
Oswald

Registered: Apr 2002
Posts: 5076
I prefer stacking the zp pointers used by the music (the better players use only one) and then forget about it.
2008-04-21 14:17
Martin Piper

Registered: Nov 2007
Posts: 699
Quote: Thanks, good to know. I was a bit unsure of things like $a0-$a2 and $c5-$c6 for example (some kind of timer thing, and keyboard).

$c5-$c6 are updated by the keyboard routines quite late on after $ea31 is called.

$a0-$a2 are updated by the real time clock rountine which is the first thing called by $ea31.

So as long as you're not using $ea31 to exit your interrupt then you're fine.
2008-04-21 14:26
Skate

Registered: Jul 2003
Posts: 494
in other words as long as you are not using kernel...
2008-04-21 14:44
Soren

Registered: Dec 2001
Posts: 547
@Oswald: afaik one can just do some selfmodding code instead of using the stack... throw the zp values into somewhere else in the music-player.... that's the "trick" I use nowadays, but ofcourse I used the stack in my earlier players :-)
2 zeropage adresses is usually what's needed for a musicplayers, I'd say.
2008-04-21 16:26
Mantiz
Account closed

Registered: Apr 2006
Posts: 36
$00 is okay too, as long as you remember to set it accordingly if you plan to change $01.
2008-04-21 16:50
Burglar

Registered: Dec 2004
Posts: 1069
you might want to skip using $90 (I/O status) and $ba (device number). some loaders will set/use those.
 
... 14 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - 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
HCL/Booze Design
chesser/Nigaz
Knight Rider/TREX
Grue/Extend
icon/The Silents, Sp..
Sychamis
kbs/Pht/Lxt
CA$H/TRiAD
macx
goerp/F4CG/HF
leonofsgr/Singular C..
lft
MaD ][/Starship
celticdesign/G★P/M..
Berluskåni/The Gump..
dstar/Fairlight
Alakran_64
Guests online: 133
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 Wonderland XIV  (9.6)
8 Comaland 100%  (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 Coders
1 Axis  (9.9)
2 Graham  (9.8)
3 Crossbow  (9.8)
4 Lft  (9.8)
5 HCL  (9.8)

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