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?
"Free ZP" which ones?
Moderator: Moderators
- Mike
- Herr VC
- Posts: 4941
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: "Free ZP" which ones?
Just $FB..$FE, actually.heaven6502 wrote:what are the ZPs which are really free?
...
You find more details in this post of mine.
Re: "Free ZP" which ones?
There are very few locations that are completely unusedheaven6502 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?
- $2A
- $52
- $FB - $FE
- Mike
- Herr VC
- Posts: 4941
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: "Free ZP" which ones?
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.srowe wrote:
- $2A
- $52
- $FB - $FE
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.
-
- Vic 20 Drifter
- Posts: 29
- Joined: Sat Jan 26, 2013 3:30 pm
Re: "Free ZP" which ones?
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?
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.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.
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
- Mike
- Herr VC
- Posts: 4941
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: "Free ZP" which ones?
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.
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.