[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Jon Relay's Apple II Info Archives (Part 1 of 2)



Jon Relay's Apple II Info Archives: 

* Zero Page Addresses
* ProDOS File Types
* Macintosh Computer Setups that Produce Readable ProDOS Disks
* Standard Color HiRes Information
* Video Display Theory
* Description of Memory Areas
* I/O Memory
* Screen Holes
* Graphics Modes
* Super Serial Card DIP Switches

This file is best viewed with a monospaced
font (i.e. Monaco, Courier, etc.).

All topics are preceded with a ###. You
can easily jump to one by searching for

     ### <topic name>:

using your newsgroup reader's/web
browser's/text viewer's find command.

This file is posted every two months, starting
with February each year. Any input is welcome.



### Zero Page Addresses:

Please note: No free space is really free
when using the Sabine 9-bit Text System.

$00-$05 - ???
$06-$09 - Free Space
$0A-$0C - JMP to USR() User Function Routine
$0D-$17 - ???
$18     - First Data Track
$19     - First Data Sector
$1A-$1B - Shape Pointer for DRAW
$1C     - Last COLOR Used
$1D-$1E - Free Space
$1F     - ???
$20     - Left Margin (0 - 39/79, 0 is default)
$21     - Width (1 - 40/80, 40 is default, 0 crashes Applesoft)
$22     - Top Margin (0 - 23, 0 is default, 20 in graphics mode)
$23     - Bottom Margin (0 - 23, 23 is default)
$24     - Horizontal Cursor Position (0 - 39/79)
$25     - Vertical Cursor Position (0 - 23)
$26-$27 - Address of Byte Containing X,Y
$28-$29 - Base Address of Text Cursor's Position
$2A     - ???
$2B     - Boot Slot * 16
$2C     - Lo-Res HLIN/VLIN Endpoint
$2D-$2F - ???
$30     - COLOR Value * 17
$31     - ???
$32     - Text Mask ($FF = Normal, $7F = Inverse, $3F = Flashing)
$33     - Prompt Character
$34-$35 - ???
$36-$37 - Address of Output Routine
$38-$39 - Address of Input Routine
$3A-$4F - ???
$50-$51 - Result of the Conversion of the FAC to a 16-Bit Integer
$52-$66 - ???
$67-$68 - Address of Beginning of BASIC Program ($0801 is default)
$69-$6A - Address of Beginning of BASIC Variables
$6B-$6C - Address of Beginning of BASIC Arrays
$6D-$6E - Address of End of BASIC Variables
$6F-$70 - Address of End of String Data
$71-$72 - Address to Move String To
$73-$74 - Address of Beginning of String Data
$75-$76 - Current Line Number Being Executed
$77-$78 - Line Number Where END or STOP or BREAK Occurred
$79-$7A - Address of Line Number Being Executed
$7B-$7C - Current Address of DATA
$7D-$7E - Next Address of DATA
$7F-$80 - Address of Input or Data
$81-$82 - Last Used Variable's Name
$83-$84 - Last Used Variable's Address
$85-$9A - ???
$9B-$9C - Pointer for $D61A and $F7D9
$9D-$A3 - Floating Point Accumulator (FAC)
$A4     - ???
$A5-$AB - Floating Point Argument Register (ARG)
$AC-$AE - ???
$AF-$B0 - Address of End of BASIC Program
$B1-$B6 - Subroutine to Increase the String Data Pointer
$B7-$BE - Subroutine to Return the Character Pointed to by the String Data
Pointer
$BF-$CD - ???
$CE-$CF - Free Space
$D0-$D3 - ???
$D4     - Error Code Flag
$D5-$D6 - ???
$D7     - Free Space
$D8     - Error Flag (Bit 7 Set if an Error Handler is Used)
$D9     - ???
$DA-$DB - Line Number Where Error Occurred
$DC-$DD - ???
$DE     - Error Code
$DF     - ???
$E0-$E1 - Horizontal Coordinate of HPLOT
$E2     - Vertical Coordinate of HPLOT
$E3     - Free Space
$E4     - HCOLOR Value (0=0, 1=42, 2=85, 3=127, 4=128, 5=170, 6=213, 7=255)
$E5     - ???
$E6     - High Byte of Address of First Byte of Where HGR is Plotted
$E7     - SCALE Value (0 = 256)
$E8-$E9 - Address of Shape Table
$EA     - DRAW/XDRAW Collision Count
$EB-$EF - Free Space
$F0     - ???
$F1     - SPEED Value (Subtracted From 256)
$F2     - ???
$F3     - Text OR Mask for Flashing Text
$F4-$F5 - Address of Error Handler (Line Number after ONERR GOTO)
$F6-$F8 - ???
$F9     - ROT Value
$FA-$FE - Free Space
$FF     - Used by Applesoft's STR$ Function


### ProDOS File Types:

$0 Types: General Files
     $00 UNK Unknown
     $01 BAD Bad Block File
     $02 PCD Pascal Code
     $03 PTX Pascal Text
     $04 TXT ASCII Text
     $05 PDA Pascal Data
     $06 BIN Binary File
     $07 FNT Apple III Font
     $08 FOT HiRes/Double HiRes File
     $09 BA3 Apple III BASIC Program
     $0A DA3 Apple III BASIC Data
     $0B WPF Generic Word Processor File
     $0C SOS SOS System File
     $0F DIR ProDOS Directory

$1 Types: Desktop Publishing
     $10 RPD RPS Data
     $11 RPI RPS Index
     $12 AFD AppleFile Discard
     $13 AFM AppleFile Model
     $14 AFR AppleFile Report
     $15 SCL Screen Library
     $16 PFS PFS Document
     $19 ADB AppleWorks Database
     $1A AWP AppleWorks Word Processor
     $1B ASP AppleWorks Spreadsheet

$2 Types: Program Code
     $20 TDM Desktop Manager File
     $21 IPS Instant Pascal Source
     $22 UPV UCSD Pascal Volume
     $29 3SD SOS Directory
     $2A 8SC Source Code
     $2B 8OB Object Code
     $2C 8IC Interpretted Code
     $2D 8LD Language Data
     $2E P8C ProDOS 8 Code Module

$4 Types: OCR
     $41 OCR Optical Character Recognition File
     $42 FTD File Type Definitions

$5 Types: General File Types
     $50 GWP Apple IIgs Word Processor File
     $51 GSS Apple IIgs Spreadsheet File
     $52 GDB Apple IIgs Database File
     $53 DRW Object Oriented Graphics File
     $54 GDP Apple IIgs Desktop Publishing File
     $55 HMD HyperMedia
     $56 EDU Educational Program Data
     $57 STN Stationery
     $58 HLP Help File
     $59 COM Communications File
     $5A CFG Configuration File
     $5B ANM Animation File
     $5C MUM Multimedia File
     $5D ENT Entertainment Program File
     $5E DVU Development Utility File

$6 Types: PC Transporter
     $60 PRE PC Pre-Boot
     $6B BIO PC BIOS
     $6D DVR PC Driver
     $6E PRE PC Pre-Boot
     $6F HDV PC Hard Disk Image

$7 Types: KES Software
     $70 SN2 Sabine's Notebook 2.0
     $71 KMT /Karen Torrez Tribute/
     $72 SR7 /Sabrina Ramos Tribute/
     $73 BAN Brenda
     $74 CG7 /Chelsea Green Tribute/
     $75 TNJ /Tesla Jarschke Tribute/
     $76 SA7 /Sumie Arnold Tribute/
     $77 KES General File
     $78 JAP Joanna
     $79 CSL Chelsea
     $7A TME Tammy
     $7B TLB /Tammy Bastien Tribute/
     $7C MR7 /Meri Riella Tribute/
     $7D MLR Mylar City
     $7E MMM /Margaux Mertz Tribute/
     $7F JCP /Joanna Pastcan Tribute/

$8 Types: GEOS Files
     $80 GES System File
     $81 GEA Desk Accessory
     $82 GEO Application
     $83 GED Document
     $84 GEF Font
     $85 GEP Printer Driver
     $86 GEI Input Driver
     $87 GEX Auxilary Driver
     $8B GEC Clock Driver
     $8C GEK Interface Card Driver
     $8D GEW Formatting Data

$A Types: Apple IIgs BASIC
     $A0 WP  WordPerfect File
     $AB GSB Apple IIgs BASIC Program
     $AC TDF Apple IIgs BASIC TDF
     $AD BDF Apple IIgs BASIC Data

$B Types: Apple IIgs Files
     $B0 SRC Apple IIgs Source Code
     $B1 OBJ Apple IIgs Object Code
     $B2 LIB Apple IIgs Library
     $B3 S16 Apple IIgs Application Program
     $B4 RTL Apple IIgs Runtime Library
     $B5 EXE Apple IIgs Shell
     $B6 PIF Apple IIgs Perminent INIT
     $B7 TIF Apple IIgs Temporary INIT
     $B8 NDA Apple IIgs New Desk Accessory
     $B9 CDA Apple IIgs Classic Desk Accessory
     $BA TOL Apple IIgs Tool
     $BB DRV Apple IIgs Device Driver
     $BC LDF Apple IIgs Generic Load File
     $BD FST Apple IIgs File System Translator
     $BF DOC Apple IIgs Document

$C Types: Graphics Files
     $C0 PNT Apple IIgs Packed Super HiRes
     $C1 PIC Apple IIgs Super HiRes
     $C2 ANI PaintWorks Animation
     $C3 PAL PaintWorks Palette
     $C5 OOG Object-Oriented Graphics
     $C6 SCR Script
     $C7 CDV Apple IIgs Control Panel
     $C8 FON Apple IIgs Font
     $C9 FND Apple IIgs Finder Data
     $CA ICN Apple IIgs Icon File

$D Types: Sound Files
     $D5 MUS Music File
     $D6 INS Instrument File
     $D7 MDI MIDI File
     $D8 SND Apple IIgs Sound File
     $DB DBM DB Master Document

$E Types: Miscellaneous
     $E0 LBR Archive File
     $E2 ATK AppleTalk Data
     $EE R16 EDASM 816 Relocatable Code
     $EF PAR Pascal Area

$F Types: System Files
     $F0 CMD ProDOS Command File
     $F1 OVL User Defined 1
     $F2     User Defined 2
     $F3     User Defined 3
     $F4     User Defined 4
     $F5 BAT User Defined 5
     $F6     User Defined 6
     $F7     User Defined 7
     $F8 PRG User Defined 8
     $F9 P16 Apple IIgs System File
     $FA INT Integer BASIC Program
     $FB IVR Integer BASIC Variables
     $FC BAS Applesoft BASIC Program
     $FD VAR Applesoft BASIC Variables
     $FE REL EDASM Relocatable Code
     $FF SYS ProDOS System File


### Macintosh Computer Setups that Produce Readable ProDOS Disks:

PowerMac 7100/66 @ 88MHz
    DiskCopy: fails
    Mac Finder: succeeds

iMac 233 (Bondi rev A) @ 266MHz
    DiskCopy: fails
    Mac Finder: succeeds

PowerBook 5300c
    DiskCopy: succeeds
    Mac Finder: succeeds


### Standard Color HiRes Information:

On screen, every 14 columns:

           |G|  |CT1|   |CT1|   |CT1|   |---CT1---|   |CT1|   |CT1|   |CT1|
           v v  v   v   v   v   v   v   v         v   v   v   v   v   v   v
Column:    CGB C00 C01 C02 C03 C04 C05 C06   CGB C07 C08 C09 C10 C11 C12 C13
Bit Value: 128 001 002 004 008 016 032 064   128 001 002 004 008 016 032 064
                                             ^ ^
                                             |G|

In memory, every 2 bytes:

           |G|      |CT2|   |CT2|   |CT2|    |G|  |CT2|   |CT2|   |CT2|
           v v      v   v   v   v   v   v    v v  v   v   v   v   v   v
Column:    CGB C06 C05 C04 C03 C02 C01 C00   CGB C13 C12 C11 C10 C09 C08 C07
Bit Value: 128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001
                ^                                                         ^
                |---------------------------CT1---------------------------|

CT1 bit pairs:
      00 = Black  01 = Blue or Magenta  10 = Orange or Green  11 = White

CT2 bit pairs:
      00 = Black  01 = Orange or Green  10 = Blue or Magenta  11 = White

G (color group) bits:
      0 = Black, White, Magenta, or Green  1 = Black, White, Orange, or Blue

Column values are column on screen modulo 14.

On the two bits that are from two different bytes, if the two bytes have
different color group bits then 01 or 10 will result in some weird colors.
The results I get trying to expiriment with them are often inconsistant.
My first results where like this:

  Color Group Bits As In Memory
        \/      \/
        01      10
+> 01  Brown   Pink
+> 10  Cyan   Purple
|
+- Bit Pair Bits

Just recently, I got different results that were more consistant, but
wackier than my earlier table:

Bit Pair:    Group Bits:    Background Color:    Result:
01           10             Black                Purple
01           01             Black                Cyan
11           10             Black                Aqua
01           10             White                Yellow
01           01             White                Brown
11           01             White                Red

If you think about it for a really long time, it makes sense that:

Bit Pair:    Group Bits:    Result:
01           10             Purple
01           01             Cyan
10           10             Yellow
10           01             Brown
11           10             Aqua
11           01             Red

Which is sacraficing consistancy for being less weird.
There was a program posted on comp.sys.apple2 a long time ago that put all
12 colors on a black background. Looking at it, I can find this:

Bit Pair:    Group Bits:    Start at Column:    Result:
00           00             6                   Black
10           10             6                   Blue
10           00             6                   Magenta
10           11             6                   Light Blue
10           01             6                   Purple
10           10             13                  Brown
10           11             13                  Orange
11           10             13                  Pink
01           00             6                   Green
10           01             13                  Yellow
11           10             6                   Cyan
11           00             6                   White

To work around some of these wacky limitations, you can use the following
subroutines:

Pix^2 Version 1:
  63999 HCOLOR=ZZ : HPLOT (XX*2),(YY*2) TO (XX*2)+1,(YY*2) TO (XX*2)+1,(YY*2)+1
        TO (XX*2),(YY*2)+1:RETURN
Draws bulky square pixels on the screen. XX is loaded with the horizontal
coordinate, a number between 0 and 139. YY is loaded with the vertical
coordinate, a number between 0 and 95. ZZ is loaded with a color number,
which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is
white, 5 is orange, and 6 is blue. Color group conflicts will occur.

Pix^2 Version 2:
  63999 HCOLOR=ZZ : HPLOT (XX*2),YY TO (XX*2)+1,YY : RETURN
Draws rectangular pixels on the screen. XX is loaded with the horizontal
coordinate, a number between 0 and 139. YY is loaded with the vertical
coordinate, a number between 0 and 191. ZZ is loaded with a color number,
which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is
white, 5 is orange, and 6 is blue. Color group conflicts will occur.

Pix^2 Version 3 Beta:
  63990 IF ZZ = 7 THEN ZZ = 3
  63991 IF ZZ = 4 THEN ZZ = 0
  63992 XX = XX*2
  63993 IF ZZ <> 0 AND ZZ <> 3 THEN GOTO 63008
  63994 VTAB INT(YY/8)+1:BA=((PEEK(40)+(256*PEEK(41)))-1024)+8192
  63995 BA=BA+(1024*(YY-(INT(YY/8)*8)))+INT(XX/7)
  63996 IF BA <> INT(BA) THEN BA = INT(BA)
  63997 IF PEEK(BA) > 128 THEN ZZ = ZZ + 4
  63998 XX = XX/2
  63999 HCOLOR=ZZ : HPLOT (XX*2),YY TO (XX*2)+1,YY : RETURN
Draws rectangular pixels on screen. XX is loaded with the horizontal
coordinate, a number between 0 and 139. YY is loaded with the vertical
coordinate, a number between 0 and 191. ZZ is loaded with a color number,
which is from 0 to 7. 0 or 4 is black, 1 is green, 2 is magenta, 3 or 7 is
white, 5 is orange, and 6 is blue. Checks the color group bit of the
existing pixels so that using white or black won't change the color group
bit regardless of whether you use 0, 3, 4, or 7 as the value of ZZ. Since
this subroutine is in beta, don't expect it to work.

These subroutines are backwards compatible. Version 2 does everything
version 1 did, and version 3 does everything version 2 does. Programs that
use version 1 can also use versions 2 and 3 (although the height of the
picture will be shrunken down [up?]), and programs that use version 2 can
also use version 3.


### Video Display Theory:

This came up on comp.sys.apple2 long ago. It was on a thread about a new
Apple II emulator, I think, and they needed help with high-resolution
graphics. Here was my theory. (At least as I remember it. The Deja
archives are temporarily unavailable, and I didn't save it.)

A composite video signal has a chroma and a luma signal. The luma controls
the brightness of a pixel. The chroma is actually two axes on a
two-dimensional surface of color. The x axis goes from magenta to green,
and the y axis goes from orange to blue. At the center of each axis is
white:

+-----------+
|     O     | O=Orange, G=Green,
|           | B=Blue, M=Magenta,
|M    W    G| W=White
|           |
|     B     |
+-----------+

Filling in the corners, we can find the whole spectrum:

+-----------+
|R    O    Y| R=Red, O=Orange,
|           | Y=Yellow, G=Green,
|M    W    G| C=Cyan, B=Blue,
|           | P=Purple, M=Magenta,
|P    B    C| W=White
+-----------+

You'll notice that at the extremes of each axis are the four
high-resolution graphics colors. Someone, I don't remember who, replied
that the hi-res color magenta was actually purple. The Apple people were
confused when purple didn't fit on the color table (as was I), so they
called it magenta in the documentation.

It wasn't in the post (although someone did reply with it) that the color
group bit of each byte of graphics data determined which axis to use for
color, and the two bits of each pair of columns defined the polarity of
the axis at that point.

One explanation for why you get weird colors on byte boundaries was
because the Apple II's composite video output wasn't exactly NTSC (or
PAL). You got what was called "color bleeding." A single point of light
somewhere on the screen showed a variety of colors depending on exactly
where it was. The different color group bits on the bytes at the byte
boundaries pushed and pulled the pixel one way or another, and that's why
you get all sorts of weird colors there. The Apple IIgs has a totally
different video system, but it still uses a slightly-off color-bleeding
composite signal.

The earlier Apple II's used TTL logic and all that off-the-shelf stuff to
display video, so the signals where just switched on and off. The Apple
IIgs has a complicated microchip to handle video, so it can produce all
those 4096 colors you can use. With an RGB monitor, the Apple IIgs doesn't
do a very good job at putting high-resolution and double high-resolution
up on an RGB screen, so you get some bad colors there. Some colors show up
as all black, or all white, or a different color. And, of course, my
favorite; dark green shows up as a flickering green that seems to
stabilize to solid green at some times.

-- 
== Jon Bettenct = Prgmr, Writer, Mathematician, Lisa Simpson Fan ==
= http://dimension18.cjb.net = ICQ76731065 = jonrelay@napanet.net =
The only thing worse than dreaming about your math final is waking
with the realization that you still have to take it. -- Paige Fox