Hi everyone. I have a few questions about setting up custom characters that I was hoping you guys could clear up.
In the old books and magazines, most folks setup 52 and 56, and then CLR to protect the memory used by their characters. From what I've read on the forums, setting 52 is not necessary, and it is good practice to setup 55 as well as 56 (which I agree with). I don't like cargo cult, so I need a few things cleared up.
Why doesn't 52 need to be setup?
What exactly is the CLR command doing in this context? I know it frees up memory taken by variables, arrays, and strings, but what EXACTLY does it do?
Custom Character Questions
Moderator: Moderators
-
- Vic 20 Amateur
- Posts: 55
- Joined: Thu Nov 27, 2014 10:50 am
- Kweepa
- Vic 20 Scientist
- Posts: 1314
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Re: Custom Character Questions
The shortest 'clean' approach is this, I think:
which sets the top of free memory, and then calls CLR which will delete all variables and therefore set 52/53 (the bottom of strings) to the top of free memory.
Code: Select all
poke55,0:poke56,28:clr
-
- Vic 20 Amateur
- Posts: 55
- Joined: Thu Nov 27, 2014 10:50 am
Re: Custom Character Questions
Thanks for the reply.
On a side note, when I started doing research on custom characters, I noticed that 52 is setup in the part of the Programmer's Reference Manual that covers them. I imagine that back then folks saw that and did it without considering whether it was actually necessary. Oh, well .
I had a hunch that was what was going on. Thanks for clearing it up.which will delete all variables and therefore set 52/53 (the bottom of strings) to the top of free memory.
On a side note, when I started doing research on custom characters, I noticed that 52 is setup in the part of the Programmer's Reference Manual that covers them. I imagine that back then folks saw that and did it without considering whether it was actually necessary. Oh, well .
-
- Vic 20 Afficionado
- Posts: 345
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: Custom Character Questions
In addition to clearing all the variables, CLR also resets the CPU stack (forgetting all FOR/NEXT loops and all GOSUB calls) and CLR closes all files.Kweepa wrote:The shortest 'clean' approach is this, I think:which sets the top of free memory, and then calls CLR which will delete all variables and therefore set 52/53 (the bottom of strings) to the top of free memory.Code: Select all
poke55,0:poke56,28:clr
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic