Subject: Re: Language Card access -- do $C08x switches work on IIGS?
From: [email-masked]
Date: 7 Jun 93 00:43:28 -0600
Newsgroups: comp.sys.apple2

FIre up your copy buffers.  This should answer your question about the
soft switches.  Four pages of goodies no Appler should be without:

                   SOFT SWITCHES
+--------+---------------+---------+---------+-----+
| ACTION |    ADDRESS    |   READ  |  WRITE? | $D0 |
+--------+---------------+---------+---------+-----+
|   R    | $C080 / 49280 |   RAM   |   NO    |  2  |
|   RR   | $C081 / 49281 |   ROM   |   YES   |  2  |
|de R    | $C082 / 49282 |   ROM   |   NO    |  2  |
|   RR   | $C083 / 49283 |   RAM   |   YES   |  2  |
|   R    | $C088 / 49288 |   RAM   |   NO    |  1  |
|   RR   | $C089 / 49289 |   ROM   |   YES   |  1  |
|   R    | $C08A / 49290 |   ROM   |   NO    |  1  |
|   RR   | $C08B / 49291 |   RAM   |   YES   |  1  |
+--------+---------------+---------+---------+-----+
|de W    | $C008 / 49160 |  MAIN ZPAGE,STACK,LC    |
|   W    | $C009 / 49161 |  AUX. ZPAGE,STACK,LC    |
+--------+---------------+-------------------------+
|   R7   | $C011 / 49169 |  $D0 BANK 2(1) OR 1(0)  |
|   R7   | $C012 / 49170 |  READ RAM(1) OR ROM(0)  |
|   R7   | $C016 / 49174 |  USE AUX(1) OR MAIN(0)  |
+--------+---------------+-------------------------+
|de W    | $C002 / 49154 |  READ FROM MAIN 48K     |
|   W    | $C003 / 49155 |  READ FROM AUX. 48K     |
|de W    | $C004 / 49156 |  WRITE TO MAIN 48K      |
|   W    | $C005 / 49157 |  WRITE TO AUX. 48K      |
|   R7   | $C013 / 49171 |  RDG MN (0) OR AX (1)   |
|   R7   | $C014 / 49172 |  WRT MN (0) OR AX (1)   |
+--------+---------------+-------------------------+
|de W    | $C000 / 49152 |    RD/WR MAIN $40-5F    |
|   W    | $C001 / 49153 |    RD/WR AUX. $40.5F    |
|   R    | $C054 / 49236 |        VIEW PG 1        |
|   R    | $C055 / 49237 |        VIEW PG 2        |
|   R    | $C056 / 49238 |   VIEW TEXT & LO-RES    |
|   R    | $C057 / 49239 |       VIEW HI-RES       |
+--------+---------------+-------------------------+
|?  R7   | $C018 / 49176 | 80STORE ON(1) OR OFF(0) |
|   R7   | $C01C / 49180 | VEIW PAGE 2(1) OR 1(0)  |
+--------+---------------+-------------------------+
|   W    | $C07E / 49278 |      ENABLE DHIRES      |
|de W    | $C07F / 49279 |     DISABLE DHIRES      |
|   R/W  | $C05E / 49246 |        DHIRES ON        |
|de R/W  | $C05F / 49247 |        DHIRES OFF       |
|   R7   | $C07E / 49278 | DHRS ENABLED  1=Y 0=N   |
|   R7   | $C07F / 49279 | DHIRES ON(1) OR OFF(0)  |
+--------+---------------+-------------------------+
|   W    | $C00C / 49164 |        40 COLUMN        |
|   W    | $C00D / 49165 |        80 COLUMN        |
+--------+---------------+-------------------------+
|   R7   | $C01F / 49183 | VIEWING 40(0) OR 80(1)  |
+--------+---------------+-------------------------+
|   R7   | $C068 / 49256 | 80/40 DOWN(1) OR UP(0)  |
|   W    | $C073 / 49267 | RAM BANK (0-15)         |
+--------+---------------+-------------------------+
            HARDWARE LOCATIONS

+-------+-------+---------------------------+
|  DEC  |  HEX  |            USE            |
+-------+-------+---------------------------+
| 49280 | $C080 | PHASE 0 OFF               |
| 49281 | $C081 | PHASE 0 ON                |
| 49282 | $C082 | PHASE 1 OFF               |
| 49283 | $C083 | PHASE 1 ON                |
| 49284 | $C084 | PHASE 2 OFF               |
| 49285 | $C085 | PHASE 2 ON                |
| 49286 | $C086 | PHASE 3 OFF               |
| 49287 | $C087 | PHASE 3 ON                |
| 49288 | $C088 | MOTOR OFF                 |
| 49289 | $C089 | MOTOR ON                  |
| 49290 | $C08A | DRIVE 1                   |
| 49291 | $C08B | DRIVE 2                   |
| 49292 | $C08C | READ LATCH OR WRITE+SHIFT |
| 49293 | $C08D | WRITE+LOAD OR PROTECT CHK |
| 49294 | $C08E | READ LATCH OR PROTECT CHK |
| 49295 | $C08F | WRITE+LOAD OR WRITE+SHIFT |
+-------+-------+---------------------------+

               I/O FUNCTIONS

+-------------+-------------+-------------+
|     READ    |    WRITE    |  PROTECTED? |
+-------------+-------------+-------------+
| LDA $C08E,X | LDA $C08F,X |             |
| ...         | ...         |             |
| ...         | LDA DATA    | LDA $C08D,X |
| LDA $C08C,X | STA $C08D,X | LDA $C08E,X |
| BPL -1      | ORA $C08C,X | BMI PROTECT |
+-------------+-------------+-------------+

            SKEWING

DOS   : 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
PRODOS: 0A 7A 6B 6A 5B 5A 4B 4A 3B 3A 2B 2A 1B 1A 0B 7B
DISK  : 0  D  B  9  7  5  3  1  E  C  A  8  6  4  2  F

         SIZES

PRO+VOL+TRK+SEC+CSM+EPG = 3+2+2+2+2+3 = 14 ($0E)

PRO+BYTES+CSM+EPG = 3+342+2+3 = 350 ($015E)

4 & 4 encoding = SEC, ROL 1st, AND with 2nd

 300 baud =  3.33 bks/min
1200 baud = 13.33 bks/min
2400 baud = 26.50 bks/min
                    DISK DRIVE ADDRESSES

+---------------------------------------------------------+
|                      ADDRESS FIELD                      |
|    +-----------------------+-----------------------+    |
|    |       PROLOGUE        |       EPILOGUE        |    |
|    +-------+-------+-------+-------+-------+-------+    |
|    |$D5/213|$AA/170|$96/150|$DE/222|$AA/170|$EB/235|    |
+----+-------+-------+-------+-------+-------+-------+----+
| RD | 47445 | 47455 | 47466 | 47505 | 47515 | - - - | RD |
|    | $B955 | $B95F | $B96A | $B991 | $B99B | - - - |    |
+----+-------+-------+-------+-------+-------+-------+----+
| WR | 48250 | 48255 | 48260 | 48302 | 48307 | 48312 | WR |
|    | $BC7A | $BC7F | $BC84 | $BCAE | $BCB3 | $BCB8 |    |
+----+-------+-------+-------+-------+-------+-------+----+

Read checksum at $B989: D0 B7 (47497 = 208,183)

+---------------------------------------------------------+
|                        DATA FIELD                       |
|    +-----------------------+-----------------------+    |
|    |       PROLOGUE        |       EPILOGUE        |    |
|    +-------+-------+-------+-------+-------+-------+    |
|    |$D5/213|$AA/170|$AD/173|$DE/222|$AA/170|$EB/235|    |
+----+-------+-------+-------+-------+-------+-------+----+
| RD | 47335 | 47345 | 47356 | 47413 | 47423 | - - - | RD |
|    | $B8E7 | $B8F1 | $B8FC | $B935 | $B93F | - - - |    |
+----+-------+-------+-------+-------+-------+-------+----+
| WR | 47187 | 47192 | 47197 | 47262 | 47267 | 47272 | WR |
|    | $B853 | $B858 | $B85D | $B89E | $B8A3 | $B8A8 |    |
+----+-------+-------+-------+-------+-------+-------+----+

Read checksum at $B92D: D0 13 (47405 = 208,19)

           RWTS LOCATIONS

$B7E9 / 47081 = SLOT * 16
$B7EA / 47082 = DRIVE
$B7EB / 47083 = ZERO
$B7EC / 47084 = TRACK
$B7ED / 47085 = SECTOR
$B7F0 / 47088 = BUFFER LO
$B7F1 / 47089 = BUFFER HI
$B7F3 / 47091 = ZERO
$B7F4 / 47092 = SEEK/READ/WRITE

$03E3 / NA    = LOAD X/Y WITH PARM LIST ADDRESS
$03D9 / NA    = CALL RWTS (MUST CALL ABOVE FIRST)

$B793 / 46995 = SEEK/READ/WRITE MULTIPLE PAGES
$B7E1 / 47073 = NUMBER OF PAGES
                ROM SUBROUTINES
BASCLCTX $FBC1
         IP Ar = vtab - 1
         OP $28.29 = base location htab 1
HOME     $FC58
CHAROUT  $FDF0
         IP Ar = a character
         OP print Ar at ($28)+$36
READKEY  $FD0C
         OP character in Ar
PRINTHEX $FDE3
         IP Ar = a number 00-0F
         OP Ar printed as a number, form $A
PRBYTE   $FDDA
         IP Ar = a number
         OP Ar printed as a number, form $AA
PRINTAX  $F941
         IP Ar & Xr = a number
         OP Ar & Xr printed as a number, form $AAXX
TEXT     $FB2F
BASCLCHI $F411
         IP Ar, Xr, Yr = hires location, form YYXX,AA
         OP ($26) = base address
CLRHIRES $F3F6
         IP $E6 = page, $1C = hcolor
         OP hires screen cleared to given color
HPLOT    $F457
         IP $E4 = hcolor, HPOSN called
         OP point plotted
PRNMZERO $FE93
NORMAL   $FE84
         OP $32: FF
WAIT     $FCA8
         IP Ar = length of pause
         OP returns after relative pause
CHKCOMMA $DEBE
         IP command line = char
         OP syntax error if not a comma
GETHIRES $F6B9
         IP command line = hires location
         OP location in form YYXX,AA, or ill. quant.
GETCHAR  $00B1
         IP command line = char or token
         OP char/token in Ar
GETSMNUM $E6F8
         IP command line = number
         OP Xr = number 00-FF
GETBGNM  $DD67 + $E752
         IP command line = number
         OP $50.51 = number 0000-FFFF
ILLQUAN  $F6E6
SNTXERR  $DEC9
PRTAREG  $FE95
         IP: number in Areg
         op: number printed
RDPADDL  $FB1E
         IP: Xreg = paddle #
         OP: xreg = pdl(x)

A note of care: CLRHIRES has been found to ERASE parts of ProDOS if you
don't make sure to set the hires page at $E6. (found this one out the
*hard way*)