Page 1 of 1
"Free ZP" which ones?
Posted: Sun Feb 18, 2024 2:30 am
by heaven6502
coming from Atari 800 and C64 I am used to switch off OS completly and having the ZP "free".
on the VIC20 I can not do this but using the IRQs mainly so just to be sure. what are the ZPs which are really free?
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 3:33 am
by Mike
heaven6502 wrote:what are the ZPs which are really free?
Just $FB..$FE, actually.
...
You find more details in
this post of mine.
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 3:34 am
by srowe
heaven6502 wrote: ↑Sun Feb 18, 2024 2:30 am
coming from Atari 800 and C64 I am used to switch off OS completly and having the ZP "free".
on the VIC20 I can not do this but using the IRQs mainly so just to be sure. what are the ZPs which are really free?
There are very few locations that are completely unused
There are plenty of locations that are only used for particular subsystems, like the cassette, which can safely used if you're not calling those routines.
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 3:44 am
by Mike
I wouldn't be that sure about $2A and $52. Even though there are no direct ZP operand fields of instructions in the BASIC interpreter that point to these two addresses, these two addresses are part of temporary float values (actually their 5th byte) and might be referenced by indirect address modes.
However, when a program does not use any routines of the BASIC interpreter at all and only calls the KERNAL (i.e. might itself be regarded as 'language' in the broadest sense), then the lower ZP of $00..$8F is essentially free. Again, more details
here.
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 9:15 am
by heaven6502
As written... I am using it in demo so just IRQ Kernel used.
Thanks will look into the other thread.
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 1:08 pm
by tlr
heaven6502 wrote: ↑Sun Feb 18, 2024 9:15 am
As written... I am using it in demo so just IRQ Kernel used.
Thanks will look into the other thread.
If you are using only IRQ and nothing else then
all of zp is free and most of the stack, just be sure to set the stack pointer to a convenient spot. $0314 and $0315 must be set up at the time of IRQ.
Code: Select all
>C:fffe 72 ff
.C:ff72 48 PHA
.C:ff73 8A TXA
.C:ff74 48 PHA
.C:ff75 98 TYA
.C:ff76 48 PHA
.C:ff77 BA TSX
.C:ff78 BD 04 01 LDA $0104,X <- check for BRK flag in status word pushed to stack by the IRQ
.C:ff7b 29 10 AND #$10
.C:ff7d F0 03 BEQ $FF82
.C:ff7f 6C 16 03 JMP ($0316) <- called if BRK
.C:ff82 6C 14 03 JMP ($0314) <- called if IRQ
Re: "Free ZP" which ones?
Posted: Sun Feb 18, 2024 4:28 pm
by Mike
Many of the
new graphics modes pioneered by tokra and me routinely use the entire ZP, stack and OS workspace (i.e. $0000..$03FF) for graphics data.
The only thing that necessitates the use of ZP are the two indirect-ZP address modes, and maybe the odd cycle saved with ZP (instead of ABS) operands. Placing significant amounts of code or data there almost always is the result of a deliberate design choice (read this as: not wanting to use a RAM expansion, insisting on the unexpanded RAM configuration instead) ... well, it's not my stuff I need to debug.