This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mg_notes:cpm:softcard_cpm_ref [2018/07/03 10:52] M.G. [Support of Non-Standard Peripherals and I/O Software] |
mg_notes:cpm:softcard_cpm_ref [2019/09/30 18:29] (current) M.G. [The Apple CP/M Disk Parameter Tables] |
||
---|---|---|---|
Line 3: | Line 3: | ||
Adapted/fixed from [[http://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/os/cpm/Apple%20II%20Softcard%20CPM%20Reference.txt|here]]. | Adapted/fixed from [[http://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/os/cpm/Apple%20II%20Softcard%20CPM%20Reference.txt|here]]. | ||
- | I do not know who the original author is. My only claim is to have fixed some errors/typos and prettied it up for display here. | + | I do not know who the original author is. My only claim is to have fixed some errors/typos, expanded it, and prettied it up for display here. |
===== Peripheral Card Standard Locations ===== | ===== Peripheral Card Standard Locations ===== | ||
Line 28: | Line 28: | ||
| 0 | Not used for I/O | Applesoft or Integer Basic ROM card \\ Language card (used by Apple CP/M) | | | 0 | Not used for I/O | Applesoft or Integer Basic ROM card \\ Language card (used by Apple CP/M) | | ||
| 1 | 2,3,4 | Line printer interface (CP/M LST: device) | | | 1 | 2,3,4 | Line printer interface (CP/M LST: device) | | ||
- | | 2 | 2,3,4 | General purpose I/O (CP/M PUN: and RDR: revices) | | + | | 2 | 2,3,4 | General purpose I/O (CP/M PUN: and RDR: devices) | |
| 3 | 2,3,4 | Console output device (CP/M CRT: or TTY: device) \\ The normal Apple 24x40 screen used if no card here | | | 3 | 2,3,4 | Console output device (CP/M CRT: or TTY: device) \\ The normal Apple 24x40 screen used if no card here | | ||
| 4 | 1 | Disk controller for drives E: and F: \\ Z80 Softcard may be installed here if no disk controller here. | | | 4 | 1 | Disk controller for drives E: and F: \\ Z80 Softcard may be installed here if no disk controller here. | | ||
Line 73: | Line 73: | ||
Turn on your Apple II. | Turn on your Apple II. | ||
+ | ==== DIP Switches ==== | ||
+ | The four DIP switches are normally OFF for CP/M operation. Their functions are: | ||
+ | |||
+ | ^ Switch ^ Function when ON ^ | ||
+ | | 1-1 | Disable address translation. | | ||
+ | | 1-2 | Higher priority DMA devices cause SoftCard to relinguish bus. | | ||
+ | | 1-3 | Pass NMI line to Z80. | | ||
+ | | 1-4 | Pass IRQ line to Z80. | | ||
===== Apple Softcard CP/M specific programs ===== | ===== Apple Softcard CP/M specific programs ===== | ||
Line 144: | Line 152: | ||
Options | Options | ||
- | | ''/filename'' | Loads and executes a basic prgoram files (.BAS default ext) | | + | | ''/filename'' | Loads and executes a basic program files (.BAS default ext) | |
| ''/F:<no_files>'' | Max number of concurrently open files (default=3) \\ Each file requires 166+128 bytes extra | | | ''/F:<no_files>'' | Max number of concurrently open files (default=3) \\ Each file requires 166+128 bytes extra | | ||
| ''/M:<max_mem>'' | Highest mem location used by MBASIC (default all TPA) | | | ''/M:<max_mem>'' | Highest mem location used by MBASIC (default all TPA) | | ||
Line 182: | Line 190: | ||
^ Key ^ Action ^ | ^ Key ^ Action ^ | ||
- | | <key>Ctrl-S</key> | Temporarily stops character output to TTY: Output is resumed when any character is typed | | + | | <key>Ctrl-'S'</key> | Temporarily stops character output to TTY: Output is resumed when any character is typed | |
| <key>Ctrl-P</key> | Sends all character output to LPT: as well as to TTY: \\ This "printer echo" mode remains in effect until another <key>Ctrl-P</key> is typed. | | | <key>Ctrl-P</key> | Sends all character output to LPT: as well as to TTY: \\ This "printer echo" mode remains in effect until another <key>Ctrl-P</key> is typed. | | ||
Line 201: | Line 209: | ||
On a system having the older Monitor ROM, hitting the <key>RESET</key> key will | On a system having the older Monitor ROM, hitting the <key>RESET</key> key will | ||
land you in the Apple Monitor. You can recover by typing <key>Ctrl-Y</key> RETURN, | land you in the Apple Monitor. You can recover by typing <key>Ctrl-Y</key> RETURN, | ||
- | after which the behaviour will be the same as for the Autostart ROM. | + | after which the behavior will be the same as for the Autostart ROM. |
===== Changing CP/M Disks ===== | ===== Changing CP/M Disks ===== | ||
Line 209: | Line 217: | ||
have done so, because certain disk directory information is stored in | have done so, because certain disk directory information is stored in | ||
memory at all times and used to allocate space on the disk. When you | memory at all times and used to allocate space on the disk. When you | ||
- | cahnge disks, this information must be replaced by the corresponding | + | change disks, this information must be replaced by the corresponding |
information for the new disk. | information for the new disk. | ||
Line 256: | Line 264: | ||
| 0E000H-0EFFFH | $C000-$CFFF | 6502 memory mapped I/O | | | 0E000H-0EFFFH | $C000-$CFFF | 6502 memory mapped I/O | | ||
| 0F000H-0FFFFH | $0000-$0FFF | 6502 zero page, stack, Apple screen, CP/M RWTS | | | 0F000H-0FFFFH | $0000-$0FFF | 6502 zero page, stack, Apple screen, CP/M RWTS | | ||
+ | |||
+ | This translation may be turned off by setting DIP switch S1-1 to ON. | ||
+ | |||
===== Apple II Softcard CP/M Memory Usage ===== | ===== Apple II Softcard CP/M Memory Usage ===== | ||
Line 266: | Line 277: | ||
| $C000-$CFFF | 0E000H-0EFFFH | Apple memory mapped I/O | | | $C000-$CFFF | 0E000H-0EFFFH | Apple memory mapped I/O | | ||
| $FFFA-$FFFF | 0DFFAH-0DFFFH | 6502 RESET, NMI and BREAK vectors | | | $FFFA-$FFFF | 0DFFAH-0DFFFH | 6502 RESET, NMI and BREAK vectors | | ||
- | | $D400-$FFF9 | 0C400H-0DFF9H | 56K Langauge Card CP/M (if Lang. Card installed) | | + | | $D400-$FFF9 | 0C400H-0DFF9H | 56K Language Card CP/M (if Lang. Card installed) | |
| $D000-$D3FF | 0C000H-0C3FFH | Top 1K of free RAM with 56K CP/M | | | $D000-$D3FF | 0C000H-0C3FFH | Top 1K of free RAM with 56K CP/M | | ||
| $A400-$BFFF | 9400H-0AFFFH | 44K CP/M (free memory with 56K CP/M) | | | $A400-$BFFF | 9400H-0AFFFH | 44K CP/M (free memory with 56K CP/M) | | ||
Line 404: | Line 415: | ||
|______________| |______________| | |______________| |______________| | ||
F200H | I/O cfg blk | $0200 | Keybd buff | | F200H | I/O cfg blk | $0200 | Keybd buff | | ||
- | | Device driv | |______________| | + | | Device drvr | |______________| |
F300H | Patch area | $0300 | Page 3 | | F300H | Patch area | $0300 | Page 3 | | ||
|______________| |______________| | |______________| |______________| | ||
Line 429: | Line 440: | ||
===== Interrupt handling ===== | ===== Interrupt handling ===== | ||
+ | |||
+ | Interrupts on the Z80 side are normally disabled. Setting DIP switches 1-3 and 1-4 | ||
+ | to the ON position passes the NMI and IQR lines, respectively, to the Z-80 | ||
Because of the way the 6502 is "put to sleep" by the Z-80 SoftCard using the | Because of the way the 6502 is "put to sleep" by the Z-80 SoftCard using the | ||
DMA line on the Apple bus, ALL interrupt processing must be handled by the | DMA line on the Apple bus, ALL interrupt processing must be handled by the | ||
- | 6502. AN interrupt can occur at two times: while in Z-80 mode and while in | + | 6502. An interrupt can occur at two times: while in Z-80 mode and while in |
6502 mode: | 6502 mode: | ||
Line 471: | Line 485: | ||
move the cursor down one line. | move the cursor down one line. | ||
- | Screen function character sequences supported by Apple CP/M mey be of | + | Screen function character sequences supported by Apple CP/M may be of |
two forms: | two forms: | ||
Line 656: | Line 670: | ||
**''LPT:''** The ''LPT:'' device is any standard Apple interface card installed into | **''LPT:''** The ''LPT:'' device is any standard Apple interface card installed into | ||
slot 1 capable of doing output. The character in register C is output | slot 1 capable of doing output. The character in register C is output | ||
- | thothoughguh the List Output vector #1. | + | through the List Output vector #1. |
**''UL1:''** User defined list device. the character in register C is output via | **''UL1:''** User defined list device. the character in register C is output via | ||
Line 667: | Line 681: | ||
==== Patching User Software Via the I/O Vector Table ==== | ==== Patching User Software Via the I/O Vector Table ==== | ||
- | User subroutines can be aptched into the I/O Configuration Block with | + | User subroutines can be patched into the I/O Configuration Block with |
the ''CONFIGIO'' program. Any patches made can also be permanently saved | the ''CONFIGIO'' program. Any patches made can also be permanently saved | ||
onto a CP/M system disk as well with ''CONFIGIO''. | onto a CP/M system disk as well with ''CONFIGIO''. | ||
- | To creade a code tile, use ASM to write the driver software, | + | To create a code file, use ASM to write the driver software, |
and then use ''LOAD'' to create a ''COM'' file. | and then use ''LOAD'' to create a ''COM'' file. | ||
Line 683: | Line 697: | ||
| First byte: | Number of patches to I/O Vector Table to be made | | | First byte: | Number of patches to I/O Vector Table to be made | | ||
- | | Next 2 bytes: | Destinationa ddress of program code | | + | | Next 2 bytes: | Destination address of program code | |
| Next 2 bytes: | Length of program code | | | Next 2 bytes: | Length of program code | | ||
| Repeat for each I/O vector patch to be made: || | | Repeat for each I/O vector patch to be made: || | ||
Line 740: | Line 754: | ||
JSR ROUTINE ;Run the 6502 subroutine | JSR ROUTINE ;Run the 6502 subroutine | ||
STA $C081 ;Make sure ROM is enabled | STA $C081 ;Make sure ROM is enabled | ||
- | SEI ;Disble 6502 interrupts | + | SEI ;Disable 6502 interrupts |
JSR SAVE ;Store 6502 registers into $45 to $49 | JSR SAVE ;Store 6502 registers into $45 to $49 | ||
JMP $3C0 ;Loop back to beginning | JMP $3C0 ;Loop back to beginning | ||
Line 751: | Line 765: | ||
read- and write-enabled. When a 6502 subroutine is called, the Apple | read- and write-enabled. When a 6502 subroutine is called, the Apple | ||
on-board ROM is automatically enabled, making the Apple Monitor | on-board ROM is automatically enabled, making the Apple Monitor | ||
- | available to the 6502 subroutine. However the Langauge Card RAM is | + | available to the 6502 subroutine. However the Language Card RAM is |
write-enabled during a 6502 call, i.e. a write to any location above | write-enabled during a 6502 call, i.e. a write to any location above | ||
- | $D000 will write in the Languae Card RAM. | + | $D000 will write in the Language Card RAM. |
A side effect of read-enabling the on-board Apple ROM's is that the | A side effect of read-enabling the on-board Apple ROM's is that the | ||
Z80 memory from 0C000H to 0EFFFH ($D000-$FFFF on 6502) cannot be | Z80 memory from 0C000H to 0EFFFH ($D000-$FFFF on 6502) cannot be | ||
- | READ by te 6502, unless the appropriate Language Card addresses can be | + | READ by the 6502, unless the appropriate Language Card addresses can be |
accessed. | accessed. | ||
Line 937: | Line 951: | ||
===== Microsoft SoftCard Version 2.23 BIOS ===== | ===== Microsoft SoftCard Version 2.23 BIOS ===== | ||
- | THe Microsoft 2.20B BIOS uses some ingainly fixes to correct a few | + | THe Microsoft 2.20B BIOS uses some ungainly fixes to correct a few |
problems, but still a few problems remain in the area of hardware | problems, but still a few problems remain in the area of hardware | ||
interfacing. Most of these problems are corrected in the SoftCard | interfacing. Most of these problems are corrected in the SoftCard | ||
Line 944: | Line 958: | ||
The hardware interfacing is greatly improved because version 2.23 | The hardware interfacing is greatly improved because version 2.23 | ||
uses Apple Computer's protocols for operating what Apple calls | uses Apple Computer's protocols for operating what Apple calls | ||
- | Formware Cards. Most of the cards that can operate a host of | + | Firmware Cards. Most of the cards that can operate a host of |
peripheral devices and have them do all sorts of neat tricks are | peripheral devices and have them do all sorts of neat tricks are | ||
Firmware Cards. Version 2.20B could not identify Firmware Cards and | Firmware Cards. Version 2.20B could not identify Firmware Cards and | ||
Line 1018: | Line 1032: | ||
| $DD0 | $DE0 | Firmware Card initialization routine, followed by a routine that uses the Apple protocol for firmware I/O | | | $DD0 | $DE0 | Firmware Card initialization routine, followed by a routine that uses the Apple protocol for firmware I/O | | ||
| $DE1 | $DEE | Firmware Card output routine | | | $DE1 | $DEE | Firmware Card output routine | | ||
- | | $DEF | $DFA | Formware Card routine which waits for card to accept I/O | | + | | $DEF | $DFA | Firmware Card routine which waits for card to accept I/O | |
| $E00 | $E02 | CP/M entry to the warm loader routine | | | $E00 | $E02 | CP/M entry to the warm loader routine | | ||
| $E03 | $E08 | Entry to CP/M RWTS routine on Language Card bank 1 | | | $E03 | $E08 | Entry to CP/M RWTS routine on Language Card bank 1 | | ||
Line 1176: | Line 1190: | ||
Addr Old New | Addr Old New | ||
- | 0EF4 A6 00 (corrects the IIe warmboot problem) | + | 0EF4 A6 00 (corrects the IIe warm boot problem) |
27C4 CD 00 | 27C4 CD 00 | ||
27C5 82 00 | 27C5 82 00 | ||
Line 1192: | Line 1206: | ||
Written in 6502 code, resides at $800 - $FFF including buffers. | Written in 6502 code, resides at $800 - $FFF including buffers. | ||
Entry point at $E03 (for BIOS ver 2.20B and 2.23) -- before entry | Entry point at $E03 (for BIOS ver 2.20B and 2.23) -- before entry | ||
- | thes addresses below must be filled with appropriate data. The CP/M | + | these addresses below must be filled with appropriate data. The CP/M |
RWTS use a 256-byte data buffer at $800 by default. | RWTS use a 256-byte data buffer at $800 by default. | ||
Line 1208: | Line 1222: | ||
|$3EA | Error code: $00 no error, $10 write protected, $40 drive error(the CP/M RWTS stores the error code here) | | |$3EA | Error code: $00 no error, $10 write protected, $40 drive error(the CP/M RWTS stores the error code here) | | ||
|$3EB | Command code: $01 read sector, $02 write sector | | |$3EB | Command code: $01 read sector, $02 write sector | | ||
- | |$800-$900 | Default I/O bbuffer area used by the CP/M RWTS | | + | |$800-$900 | Default I/O buffer area used by the CP/M RWTS | |
|$900-$9FF | A nibble buffer used by the CP/M RWTS | | |$900-$9FF | A nibble buffer used by the CP/M RWTS | | ||
Line 1224: | Line 1238: | ||
The first 3 tracks, tracks $00 to $02, are reserved for the boot | The first 3 tracks, tracks $00 to $02, are reserved for the boot | ||
- | routine, the CCP, BDOS and BIOS. Track $03 contian the CP/M | + | routine, the CCP, BDOS and BIOS. Track $03 contain the CP/M |
directory, where only 6 physical sectors contains the directory (CP/M | directory, where only 6 physical sectors contains the directory (CP/M | ||
logical sectors 00H through 0BH). | logical sectors 00H through 0BH). | ||
Line 1259: | Line 1273: | ||
**Apple CP/M has double sector skewing:** the system tracks use CP/M | **Apple CP/M has double sector skewing:** the system tracks use CP/M | ||
physical sector skew while the data tracks uses the logical sector | physical sector skew while the data tracks uses the logical sector | ||
- | skew. The CP/M physiscal sector skew is fastest for reading sectors, | + | skew. The CP/M physical sector skew is fastest for reading sectors, |
while the logical sector skew is a compromise for getting the | while the logical sector skew is a compromise for getting the | ||
fastest sector read skew in conjunction with the fastest sector write | fastest sector read skew in conjunction with the fastest sector write | ||
Line 1299: | Line 1313: | ||
^ Offset ^ Contents ^ Use ^ | ^ Offset ^ Contents ^ Use ^ | ||
- | | 00H | SPT 16b | Total number of sectors per track | | + | | 00H | SPT 16b | Total number of 128-byte sectors per track | |
- | | 02H | BSH 8b | Data allocation block shift factor, determined by the data block allocation size | | + | | 02H | BSH 8b | Data allocation block shift factor, determined by the data block allocation size \\ 3 -> 1K, 4 -> 2K, 5 -> 4K, ... | |
- | | 03H | BLM 8b | Data allocation block mask (2[BSH-1]) | | + | | 03H | BLM 8b | Data allocation block mask (2[BSH-1]) \\ 7 -> 1K, 0FH -> 2K, 01FH -> 4K, ... | |
| 04H | EXM 8b | Extent mask, determined by data block allocation size and number of disk blocks | | | 04H | EXM 8b | Extent mask, determined by data block allocation size and number of disk blocks | | ||
- | | 05H | DSM 16b | Total storage capacity of disk drive | | + | | 05H | DSM 16b | Total storage capacity of disk drive, blocks minus one | |
| 07H | DRM 16b | Total number of directory entries minus one | | | 07H | DRM 16b | Total number of directory entries minus one | | ||
- | | 09H | AL0 8b | Determines reserved directory blocks | | + | | 09H | AL0 8b | Directory allocation bitmap, byte 0. | |
- | | 0AH | AL1 8b | Determines reserved directory blocks | | + | | 0AH | AL1 8b | Directory allocation bitmap, byte 1. | |
| 0BH | CKS 16b | Size of directory check vector | | | 0BH | CKS 16b | Size of directory check vector | | ||
| 0DH | OFF 16b | No of reserved tracks at beginning of logical disk | | | 0DH | OFF 16b | No of reserved tracks at beginning of logical disk | | ||
Line 1325: | Line 1339: | ||
DSM = maximum data block number supported by this particular drive, measured | DSM = maximum data block number supported by this particular drive, measured | ||
- | in BLS (BLock Size) units, or simply "number of allocation blocks on drive". | + | in BLS (Block Size) units, or simply "number of allocation blocks on drive". |
Blocks are counted from 0 to DSM, and thus BLS*(DSM+1) = the number of bytes | Blocks are counted from 0 to DSM, and thus BLS*(DSM+1) = the number of bytes | ||
on the drive (excluding the system tracks). If DSM<256, the disk map in | on the drive (excluding the system tracks). If DSM<256, the disk map in | ||
Line 1336: | Line 1350: | ||
bits 16 bits, bit 0-15, where 0=hi bit of AL0, 7=lo bit of AL0, 8=hi | bits 16 bits, bit 0-15, where 0=hi bit of AL0, 7=lo bit of AL0, 8=hi | ||
bit of AL1, 15=lo bit of AL1. Bits are assigned starting at bit 0 up | bit of AL1, 15=lo bit of AL1. Bits are assigned starting at bit 0 up | ||
- | until bit 15. Suppose nbits is the number of bits seet to 1: | + | until bit 15. Suppose nbits is the number of bits set to 1: |
+ | |||
^ BLS ^ Directory entries ^ | ^ BLS ^ Directory entries ^ | ||
Line 1345: | Line 1361: | ||
| 16384 | 512 * nbits | | | 16384 | 512 * nbits | | ||
- | Example: if DRM=127 (128 directory entries) and BLS=1024 bytes, there | + | Example: |
+ | |||
+ | ^ ^ AL0 ^^^^^^^^ AL1 ^^^^^^^^ | ||
+ | ^ Bit ^ 7 ^ 6 ^ 5 ^ 4 ^ 3 ^ 2 ^ 1 ^ 0 ^ 7 ^ 6 ^ 5 ^ 4 ^ 3 ^ 2 ^ 1 ^ 0 ^ | ||
+ | ^ Value | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ||
+ | |||
+ | If DRM=127 (128 directory entries) and BLS=1024 bytes, there | ||
are 32 directory entries per block, requiring 4 reserved blocks. Thus | are 32 directory entries per block, requiring 4 reserved blocks. Thus | ||
the 4 hi bits if AL0 are set, and AL0=0FH, AL1=00H | the 4 hi bits if AL0 are set, and AL0=0FH, AL1=00H | ||
Line 1411: | Line 1433: | ||
^ Physical format: ^ A ^ B ^ C ^ D ^ | ^ Physical format: ^ A ^ B ^ C ^ D ^ | ||
- | ^ ^ Apple CP/M ^^ Enhanced ^ Standard ^ | + | ^ ^ Apple CP/M ^^ Enhanced CP/M ^ Standard \\ CP/M ^ |
- | ^ ^ 13-sect ^ 16-sect ^ 80-trk/16-sec/2-side ^ 8" SSSD ^ | + | ^ ^ 13-sect ^ 16-sect ^ 80-trk \\ 16-sec \\ 2-side ^ 8" SSSD ^ |
| Bytes/sector | 256 | 256 | 256 | 128 | | | Bytes/sector | 256 | 256 | 256 | 128 | | ||
| Sectors/track | 13 | 16 | 16 | 26 | | | Sectors/track | 13 | 16 | 16 | 26 | | ||
Line 1423: | Line 1445: | ||
* 13-sector disks: hard sector skew | * 13-sector disks: hard sector skew | ||
* 16-sector disks: soft sector skew in 6502 code (CP/M RWTS) | * 16-sector disks: soft sector skew in 6502 code (CP/M RWTS) | ||
- | * (Standard CP/M: disk skew in BIOS - every 6'th sector: 1,7,13,...) | + | * (Standard CP/M: disk skew in BIOS - every 6th sector: 1,7,13,...) |
**Apple CP/M DPB - Disk Parameter Block** | **Apple CP/M DPB - Disk Parameter Block** | ||
- | ^ ^ A ^ B ^ C ^ D ^ ^ | + | ^ ^ A ^ B ^ C ^ D ^ ^ |
+ | ^ ^ Apple CP/M ^^ Enhanced \\ CP/M ^ Standard \\ CP/M ^ ^ | ||
| SPT 16b | 26 | 32 | 32 | 26 | 128-byte Logical Sectors/Track | | | SPT 16b | 26 | 32 | 32 | 26 | 128-byte Logical Sectors/Track | | ||
| BSH 8b | 3 | 3 | 4 | 3 | Block shift factor | | | BSH 8b | 3 | 3 | 4 | 3 | Block shift factor | | ||
Line 1449: | Line 1472: | ||
| ALV | 14 | 17 | 40 | 31 | bytes | | | ALV | 14 | 17 | 40 | 31 | bytes | | ||
| CSV | 12 | 16 | 64 | 16 | bytes | | | CSV | 12 | 16 | 64 | 16 | bytes | | ||
- |