D Finnigan
2009-12-21 21:09:00 UTC
I've decided to take a stab at fixing the version of XINU which was written
for Apple II over 10 years ago.
The problem with it is a real twist of fate: the guy who wrote it had an
Apple II clone (the "CAT") which had 256 KB of memory and a non-standard way
of bank-switching it. Here's how it worked:
The micro had 256 kilobytes of RAM which were sub-dived into 16 banks of 16K
each, and they were called $1, $2, ... $E, $F. Bank $F had the monitor,
Applesoft, and other utilities. All of the other banks were essentially
"user-land."
Now, there was a method of switching any 4 of these 16 banks of RAM into 4
"blocks" as they were known. Each block was 16k, of course. Block 1 was the
zero page, stack, input buffer, and text screen. Blocks 2 and 3 were
graphics screen as well as user storage space. Block 4 was typically the
monitor, Applesoft, and other utilities as mentioned in bank $F.
How one switched different banks into the 4 blocks was to write either a $1,
$2, ... $F into one of 4 special I/O locations, $C07C, $C07D, $C07E, and
$C07F, which corresponded to blocks 1, 2, 3, and 4, respectively.
.. So now that I've got that explained, on to how it relates to the
standard Apple ....
As you should well know, the standard Apple relies on 64k banks, with the
exception of the 16K Language card bank. This version of Xinu is written
such that block 2 ($C07D) was substituted for either User memory or Kernel
memory, as needed.
What I plan to do is go over the source and remove the instances where this
strange block/bank-switching is done, and place the System memory up in high
memory, and the user-memory below.
Then once I've got that working, I can implement standard Apple II 64k
bank-switching and see if I can get that to work.
Here's a .zip archive of the ASCII sources, as de-tokenized from the LISA
v2.5 files:
http://dserver.macgui.com/XINU_for_Apple_II.zip
Look for SBANK2.
Also, two or three of the files are not sources, but rather are notes on
implementation.
Anyway, I have a feeling that there's a rather interesting little system
beneath this troublesome problem. I'm also going to see about getting a copy
of the XINU book which was used to write this code.
for Apple II over 10 years ago.
The problem with it is a real twist of fate: the guy who wrote it had an
Apple II clone (the "CAT") which had 256 KB of memory and a non-standard way
of bank-switching it. Here's how it worked:
The micro had 256 kilobytes of RAM which were sub-dived into 16 banks of 16K
each, and they were called $1, $2, ... $E, $F. Bank $F had the monitor,
Applesoft, and other utilities. All of the other banks were essentially
"user-land."
Now, there was a method of switching any 4 of these 16 banks of RAM into 4
"blocks" as they were known. Each block was 16k, of course. Block 1 was the
zero page, stack, input buffer, and text screen. Blocks 2 and 3 were
graphics screen as well as user storage space. Block 4 was typically the
monitor, Applesoft, and other utilities as mentioned in bank $F.
How one switched different banks into the 4 blocks was to write either a $1,
$2, ... $F into one of 4 special I/O locations, $C07C, $C07D, $C07E, and
$C07F, which corresponded to blocks 1, 2, 3, and 4, respectively.
.. So now that I've got that explained, on to how it relates to the
standard Apple ....
As you should well know, the standard Apple relies on 64k banks, with the
exception of the 16K Language card bank. This version of Xinu is written
such that block 2 ($C07D) was substituted for either User memory or Kernel
memory, as needed.
What I plan to do is go over the source and remove the instances where this
strange block/bank-switching is done, and place the System memory up in high
memory, and the user-memory below.
Then once I've got that working, I can implement standard Apple II 64k
bank-switching and see if I can get that to work.
Here's a .zip archive of the ASCII sources, as de-tokenized from the LISA
v2.5 files:
http://dserver.macgui.com/XINU_for_Apple_II.zip
Look for SBANK2.
Also, two or three of the files are not sources, but rather are notes on
implementation.
Anyway, I have a feeling that there's a rather interesting little system
beneath this troublesome problem. I'm also going to see about getting a copy
of the XINU book which was used to write this code.