[net.micro.apple] 128K II+ & Pascal 1.2

neves@WISC-RSCH.ARPA (07/08/84)

Someone asked a week ago about getting 128K on an Apple II+.  One
program that uses the extra 64K on an Apple //e (with extended 80
column card), Apple //c is Apple Pascal 1.2.  The extra 64K is used
to store P-code and frees up main memory for data.  It actually works
pretty well -- to execute a p-code instruction I imagine that the p-code
is read from auxiliary memory and decoded in main memory.  Any addresses
that p-code references are main memery addresses.  Aux memory is used
only to store and retrieve p-code.

To get a II+ to do the same thing you would need a ram card, would need
to understand how to store and retrieve bytes of memory from it, and
would need to alter System.Apple to change the instructions that
reference the extended 80 column card (see below).

I won't go into how the extended 80 column card works, but let me just
say that it is banked switched.  You can switched in the middle 48K
(300-BFFF) and read/write aux or main memory by storing in one of
the CXXX locations.  Apple Pascal 1.2 doesn't use D000-FFFF or the
stack/page 0 of auxiliary memory.

Unfortunately (for the II+ implementor) the switch from main to auxiliary
memory is not done in one place but is scattered throughout DOOO-FXXX.
A typical (and simple) sequence is below.  First the middle 48K of
auxiliary memory is switched in for reading.  Two bytes are read into
main memory by indirect addressing.  Then main memory is switched back in.
Most of the code is like this, but there is some more complicated code
that switching in some memory and then does a JSR.

I encourage anyone to try to get 128K version of Pascal 1.2 on a II+!
Let me know if I can be of any help.
D155 8D 03 C0   STA  C003   [rdaux48     ]
D158 B1 58      LDA  @58,Y
D15A 10 13      BPL  D16F
D15C 85 69      STA  69
D15E E6 58      INC  58
D160 D0 02      BNE  D164
D162 E6 59      INC  59
D164 B1 58      LDA  @58,Y
D166 0A         ASL  A
D167 85 68      STA  68
D169 26 69      ROL  69
D16B 8D 02 C0   STA  C002   [rdmain48    ]
D16E 60         RTS

;;; search for all locations referencing C003 (rdaux48)
>SEARCH[2]: H(EX, C(HAR, Q(UIT
C37C C3AA C3BC D156 D219 D280 D29C D2C2 D2DC D3C7 D3F3 D427 D453 D47E D4A9 D4F9
D518 D536 D56B D61A D98D D9B3 D9E5 DA56 DB22 DB2E DD3A DF47 E233 E278 E2C5 E2DA
E2E8 E340 E36D E3DC E3EB E41D E43C E45E E47B E487 E4A1 E4B2 E526 E54B E81C E9AC
EA82 EBE5 EC01 EC49 EC68 EC78 EC88 ECA1 ED4D FDE9 FE60

SEQUENCE  03  C0

Wilkinson@HI-MULTICS.ARPA (07/08/84)

On this same subject; does anyone know if Turbo Pascal will utilize the
second bank of 64K on either the II+ or the IIe?  Are there other
compilers, Pascal or otherwise, that can use the second bank (bank #1?).
          Sincerely
          Richard Wilkinson  (Wilkinson @ HI-MULTICS)