This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
mg_notes:cpm:softcard_cpm_ref [2017/11/20 14:15] M.G. [The CPM56.COM map] |
mg_notes:cpm:softcard_cpm_ref [2019/09/30 18:28] 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 439: | Line 453: | ||
Handling the interrupt in Z-80 mode: both processors are interrupted | Handling the interrupt in Z-80 mode: both processors are interrupted | ||
- | when an interrupt occurs in Z_80 mode. Here is a step-by-step process | + | when an interrupt occurs in Z-80 mode. Here is a step-by-step process |
- | for hadling an interrupt while in Z-80 mode: | + | for handling an interrupt while in Z-80 mode: |
- Save any registers that are destroyed on the stack | - Save any registers that are destroyed on the stack | ||
Line 447: | Line 461: | ||
- Return control to the 6502 by performing a write to the address of the Z-80 card (again see Calling of 6502 Subroutines). | - Return control to the 6502 by performing a write to the address of the Z-80 card (again see Calling of 6502 Subroutines). | ||
- When control is returned to the Z-80, restore the previous 6502 subroutine call address. | - When control is returned to the Z-80, restore the previous 6502 subroutine call address. | ||
- | - Restore all used Z_80 registers from the stack. | + | - Restore all used Z-80 registers from the stack. |
- Enable interrupts with an EI instruction. | - Enable interrupts with an EI instruction. | ||
- Return with a RET instruction. | - Return with a RET instruction. | ||
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 536: | Line 550: | ||
routine located in the CP/M BIOS, but they can be altered by the user | routine located in the CP/M BIOS, but they can be altered by the user | ||
to point to his own drivers. Three blocks of 128 bytes each are | to point to his own drivers. Three blocks of 128 bytes each are | ||
- | provided within the I/O COnfig block for user I/O driver software: | + | provided within the I/O Config block for user I/O driver software: |
^ Address ^ Assigned Slot ^ Assigned Logical Device ^ | ^ Address ^ Assigned Slot ^ Assigned Logical Device ^ | ||
- | | 0F200H-0F27FH | 1 | LST: - line pritner device | | + | | 0F200H-0F27FH | 1 | LST: - line printer device | |
| 0F280H-0FF7FH | 2 | PUN: and RDR: - general purpose I/O | | | 0F280H-0FF7FH | 2 | PUN: and RDR: - general purpose I/O | | ||
| 0F300H-0F37FH | 3 | TTY: - the console device | | | 0F300H-0F37FH | 3 | TTY: - the console device | | ||
- | Most APple I/O interface cards have 6502 ROM drivers on the card. | + | Most Apple I/O interface cards have 6502 ROM drivers on the card. |
The easiest way to interface these types of cards to Apple CP/M is to | The easiest way to interface these types of cards to Apple CP/M is to | ||
write Z-80 code to call the 6502 subroutine on the ROM. | write Z-80 code to call the 6502 subroutine on the ROM. | ||
Line 549: | Line 563: | ||
If no card is installed in a particular slot, its allocated 128-byte | If no card is installed in a particular slot, its allocated 128-byte | ||
space can be used for other purposes relating to its assigned logical | space can be used for other purposes relating to its assigned logical | ||
- | device. Thes einclude lower-case input drivers for Apple keyboard, | + | device. These include lower-case input drivers for Apple keyboard, |
cassette tape interface, etc. | cassette tape interface, etc. | ||
- | I/O driver subroutinesa re patched to APple CP/M by patching the | + | I/O driver subroutines are patched to Apple CP/M by patching the |
appropriate I/O vector to point to the subroutine. A table of vector | appropriate I/O vector to point to the subroutine. A table of vector | ||
- | locations and their porposes is shown below: | + | locations and their purposes is shown below: |
^ Vec # ^ Addr ^ Vector Name ^ Description ^ | ^ Vec # ^ Addr ^ Vector Name ^ Description ^ | ||
Line 652: | Line 666: | ||
through Punch Output vector #2. | through Punch Output vector #2. | ||
- | **''IP2:''** User defined ounch #2. This device is physically the same as ''UP1:''. | + | **''IP2:''** User defined punch #2. This device is physically the same as ''UP1:''. |
**''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 | ||
- | thoguh 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 662: | Line 676: | ||
The ''IOBYTE'' can be changed with the ''STAT'' program, or it may be modified | The ''IOBYTE'' can be changed with the ''STAT'' program, or it may be modified | ||
- | from an assembly langauge program using the CP/M ''Get IOBYTE'' | + | from an assembly language program using the CP/M ''Get IOBYTE'' |
and ''Set IOBYTE'' (#7 & #8) functions. | and ''Set IOBYTE'' (#7 & #8) functions. | ||
- | |||
==== 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 684: | 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 741: | 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 752: | 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 811: | Line 824: | ||
device is taken from the IOCB and a jump is made to that address. | device is taken from the IOCB and a jump is made to that address. | ||
- | <code> | + | ^ Start ^ End ^ Use ^ |
- | DA00H - DA32H BIOS vector jump tables | + | | DA00H | DA32H | BIOS vector jump tables | |
- | DA33H - DA92H Disk Parameter Headers for six drives | + | | DA33H | DA92H | Disk Parameter Headers for six drives | |
- | DA93H - DAA1H Disk Parameter Block | + | | DA93H | DAA1H | Disk Parameter Block | |
- | DAA2H - DAC4H Slot init routine, initializes communications and | + | | DAA2H | DAC4H | Slot init routine, initializes communications and serial cards from slot 7 to slot 7. The ACIA is set to 7 data bits, even parity, 2 stop bits, xmit interrupts enabled | |
- | serial cards from slot 7 to slot 7. The ACIA | + | | DAC5H | DACBH | Routine to place En00H in HL where n = slot # passed in E | |
- | is set to 7 data bits, even parity, 2 stop bits, | + | | DACCH | DB07H | WBOOT routine: \\ Init SP \\ Call warm loader at $E00 \\ Init slots \\ Init CP/M BDOS zero page \\ Patch CCP for 2-column or 4-column DIR \\ DAFDH = 1 for 2 cols, 3 for 4 cols \\ Jmp to CCP at accress C400H | |
- | xmit interrupts enabled | + | | DB08H | DB0BH | CONST - Console Status from IOCB at F380H | |
- | DAC5H - DACBH Routine to place En00H in HL where n = slot # passed in E | + | | DB0CH | DB11H | CONST routine for Apple keyboard | |
- | DACCH - DB07H WBOOT routine: | + | | DB12H | DB28H | CONIN - Console Input routine \\ Call input char routine at DB50H \\ Check against redefinition table at F3ACH \\ Return with translated char in A | |
- | Init SP | + | | DB29H | DB3AH | Default address in IOCB for console input \\ Set DE to 3 for slot 3 \\ If 80-col card in slot 3, patch next jump to appropriate routine \\ If no 80-col card, go to Apple kdb input at DB2FH | |
- | Call warm loader at $E00 | + | | DB3BH | DB41H | Routine to set up and make call to the 6502. On entry HL contains 6502 program address | |
- | Init slots | + | | DB42H || Routine to place A into C and fall into CONOUT | |
- | Init CP/M BDOS zero page | + | | DB43H | DB4FH | CONOUT Checks the IOBYTE for the output device then jumps to the selected routine. | |
- | Patch CCP for 2-column or 4-column DIR | + | | DB50H | DB61H | Character input routine, checks IOBYTE then goes to the selected routine | |
- | DAFDH = 1 for 2 cols, 3 for 4 cols | + | | DB62H | DB65H | A jump to the physical PTR: device. May be used by the console input or logical RDR: device | |
- | Jmp to CCP at accress C400H | + | | DB66H | DB74H | LIST The logical LST: device routine, checks IOBYTE then goes to the selected routine | |
- | DB08H - DB0BH CONST - Console Status from IOCB at F380H | + | | DB75H | DB86H | PUNCH The logical PUN: device, checks IOBYTE then goes to the selected routine | |
- | DB0CH - DB11H CONST routine for Apple keyboard | + | | DB87H | DB95H | READER The logical RDR: device, checks IOBYTE then goes to the selected routine | |
- | DB12H - DB28H CONIN - Console Input routine | + | | DB96H | DBB7H | A routine for 80-column cards. Conditions the memory locations and looks to see if an escape sequence is coming. Control is passed to routines to perform specific functions depending on how the output is to be performed. | |
- | Call input char routine at DB50H | + | | DBB8H | DBDFH | Routine to position the cursor in the GOTOXY sequence | |
- | Check against redefinition table at F3ACH | + | | DBE0H | DBF4H | Routine that checks to see if there was a terminal lead-in character sent and calls routines as requires | |
- | Return with translated char in A | + | | DBF5H | DC3DH | Routine that considers all the possible combinations and finally prints the character to the console via physical devices TTY: or UC1: as required | |
- | DB29H - DB3AH Default address in IOCB for console input | + | | DC3EH | DC43H | Physical TTY: device. This is the general console output routine. THe jump address to the specific output routine is patched during the cold boot. Since the output routines are slot-dependent, the slot number of the console is supplied in location DC3FH. The slot number here is 3. | |
- | Set DE to 3 for slot 3 | + | | DC44H | DCDEH | Screen output routine for the standard 40-column Apple screen. This is the routine patched into the former routine if no serial or 80-column card is found in slot 3. | |
- | If 80-col card in slot 3, patch next jump to | + | | DCDFH | DCE9H | The comm card output routine. A status loop runs, and when ACIA is ready, character in C register is transmitted. | |
- | appropriate routine | + | | DCEEH | DD03H | Preparatory routine for setting up a serial card for either input or output. | |
- | If no 80-col card, go to Apple kdb input at DB2FH | + | | DD04H | DD11H | The serial card output routine, performed by calling the 6502 | |
- | DB3BH - DB41H Routine to set up and make call to the 6502. On entry | + | | DD12H | DD1BH | The comm card input routine. Resembles the output routine in structure. | |
- | HL contains 6502 program address | + | | DD1CH | DD2AH | Serial card input routine. | |
- | DB42H Routine to place A into C and fall into CONOUT | + | | DD2BH | DD30H | Physical LPT: device output function. Jump is made to card driver routine. Jump address is loaded during cold boot and depends on card type in slot 1. Since the card routines are slot dependent, this routine supplies the slot number in location DD2CH | |
- | DB43H - DB4FH CONOUT Checks the IOBYTE for the output device then jumps | + | | DD31H | DD3EH | Parallell card output routine | |
- | to the selected routine. | + | | DD3FH | DD44H | Physical PTP: device output function. Jump is made to card driver routine. Jump address is loaded during cold boot and depends on card type found in slot 2. | |
- | DB50H - DB61H Character input routine, checks IOBYTE then goes to the | + | | DD45H | DD4CH | Physical PTR: device output function. Jump to card drive routine. Jump address is loaded during cold boot and depends on card type found in slot 2. | |
- | selected routine | + | | DD4BH | DD55H | HOME A disk routine to select track 0 | |
- | DB62H - DB65H A jump to the physical PTR: device. May be used by the | + | | DD56H | DD5AH | SETTRK A disk routine to select the track in register C | |
- | console input or logical RDR: device | + | | DD5BH | DD6CH | A computational routine used by the peripheral card drivers and disk I/O routines to get needed slot and memory addresses and the numbers passed to them from the physical device routines | |
- | DB66H - DB74H LIST The logical LST: device routine, checks IOBYTE then | + | | DD6DH | DD88H | SELDSK Select the disk drive and set flags to notify the disk I/O routines if the drive has been changed or a nonexistent drive was called | |
- | goes to the selected routine | + | | DD89H | DD8DH | SETSEC Select the 128-byte CP/M sector | |
- | DB75H - DB86H PUNCH The logical PUN: device, checks IOBYTE then goes to | + | | DD8EH | DD92H | SETDMA Select the disk I/O buffer accress | |
- | the selected routine | + | | DD93H | DDA2H | READ Set up the disk read operation according to all the CP/M protocols | |
- | DB87H - DB95H READER The logical RDR: device, checks IOBYTE then goes to | + | | DDA3H | DDF1H | WRITE Perform the disk write operation using CP/M protocols | |
- | the selected routine | + | | DDF2H | DE72H | Used by both READ and WRITE to make sure the CP/M protocols are met. A sector skew is done with the CP/M sector skew table. The data is moved to or from the CP/M RWTS buffer at $800. The read or write operation is then called. | |
- | DB96H - DBB7H A routine for 80-column cards. Conditions the memory | + | | DE73H | DE91H | Do the actual read or write by calling the 6502 CP/M RWTS | |
- | locations and looks to see if an escape sequence is coming. | + | | DE92H | DEA1H | The CP/M logical sector skew table, which relates the 256-byte sector number to the logical 128-byte sector number used by CP/M. | |
- | Control is passed to routines to perform specific functions | + | | F200H | F37FH | The I/O Patch area: space for user provided routines required for special I/O situations. The IOCB must be patched to vector the device I/O to the routines in this area. | |
- | depending on how the output is to be performed. | + | | F380H | F395H | IOCB containing the vectors to the CP/M physical devices | |
- | DBB8H - DBDFH Routine to position the cursor in the GOTOXY sequence | + | | F396H | F3AAH | Table used by the console routines to perform console functions. Can be adapted to a variety of terminals. | |
- | DBE0H - DBF4H Routine that checks to see if there was a terminal lead-in | + | | F3C0H | F3FFH | Space used by the Apple Monitor ROM to vector the interrupts and resets. The vectors under CP/M all points to $3C0, so the Z-80 never loses control of the Apple. | |
- | character sent and calls routines as requires | + | | F800H | F900H | The data buffer used by the CP/M RWTS | |
- | DBF5H - DC3DH Routine that considers all the possible combinations and | + | | FA00H | FFFCH | The CP/M RWTS routines, written in 6502 assembly | |
- | finally prints the character to the console via physical | + | |
- | devices TTY: or UC1: as required | + | |
- | DC3EH - DC43H Physical TTY: device. This is the general console output | + | |
- | routine. THe jump address to the specific output routine | + | |
- | is patched during the cold boot. Since the output routines | + | |
- | are slot-dependent, the slot number of the console is supplied | + | |
- | in location DC3FH. The slot number here is 3. | + | |
- | DC44H - DCDEH Screen output routine for the standard 40-column Apple screen. | + | |
- | This is the routine patched into the former routine if no | + | |
- | serial or 80-column card is found in slot 3. | + | |
- | DCDFH - DCE9H The comm card output routine. A status loop runs, and when | + | |
- | ACIA is ready, character in C register is transmitted. | + | |
- | DCEEH - DD03H Preparatory routine for setting up a serial card for either | + | |
- | input or output. | + | |
- | DD04H - DD11H The serial card output routine, performed by calling the 6502 | + | |
- | DD12H - DD1BH The comm card input routine. Resembles the output routine in | + | |
- | structure. | + | |
- | DD1CH - DD2AH Serial card input routine. | + | |
- | DD2BH - DD30H Physical LPT: device output function. Jump is made to card | + | |
- | driver routine. Jump address is loaded during cold boot and | + | |
- | depends on card type in slot 1. Since the card routines are | + | |
- | slot dependent, this routine supplies the slot number in | + | |
- | location DD2CH | + | |
- | DD31H - DD3EH Parallell card output routine | + | |
- | DD3FH - DD44H Physical PTP: device output function. Jump is made to card | + | |
- | driver routine. Jump address is loaded during cold boot and | + | |
- | depends on card type found in slot 2. | + | |
- | DD45H - DD4CH Physical PTR: device output function. Jump to card drive | + | |
- | routine. Jump address is loaded during cold boot and | + | |
- | depends on card type found in slot 2. | + | |
- | DD4BH - DD55H HOME A disk routine to select track 0 | + | |
- | DD56H - DD5AH SETTRK A disk routine to select the track in register C | + | |
- | DD5BH - DD6CH A computational routine used by the peripheral card drivers | + | |
- | and disk I/O routines to get needed slot and memory addresses | + | |
- | and the numbers passed to them from the physical device routines | + | |
- | DD6DH - DD88H SELDSK Select the disk drive and set flags to notify the disk | + | |
- | I/O routines if the drive has been changed or a nonexistent | + | |
- | drive was called | + | |
- | DD89H - DD8DH SETSEC Select the 128-byte CP/M sector | + | |
- | DD8EH - DD92H SETDMA Select the disk I/O buffer accress | + | |
- | DD93H - DDA2H READ Set up the disk read operation according to all the | + | |
- | CP/M protocols | + | |
- | DDA3H - DDF1H WRITE Perform the disk write operation using CP/M protocols | + | |
- | DDF2H - DE72H Used by both READ and WRITE to make sure the CP/M protocols | + | |
- | are met. A sector skew is done with the CP/M sector skew | + | |
- | table. The data is moved to or from the CP/M RWTS buffer | + | |
- | at $800. The read or write operation is then called. | + | |
- | DE73H - DE91H Do the actual read or write by calling the 6502 CP/M RWTS | + | |
- | DE92H - DEA1H The CP/M logical sector skew table, which relates the 256-byte | + | |
- | sector number to the logical 128-byte sector number used by | + | |
- | CP/M. | + | |
- | F200H - F37FH The I/O Patch area: space for user provided routines required | + | |
- | for special I/O situations. The IOCB must be patched to vector | + | |
- | the device I/O to the routines in this area. | + | |
- | F380H - F395H IOCB containing the vectors to the CP/M physical devices | + | |
- | F396H - F3AAH Table used by the console routines to perform console functions. | + | |
- | Can be adapted to a variety of terminals. | + | |
- | F3C0H - F3FFH Space used by the Apple Monitor ROM to vector the interrupts | + | |
- | and resets. The vectors under CP/M all points to $3C0, so | + | |
- | the Z-80 never loses control of the Apple. | + | |
- | F800H - F900H The data buffer used by the CP/M RWTS | + | |
- | FA00H - FFFCH The CP/M RWTS routines, written in 6502 assembly | + | |
- | </code> | + | |
==== The CPM56.COM map ==== | ==== The CPM56.COM map ==== | ||
Line 1000: | 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 1007: | 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 1081: | 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 1239: | 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 1255: | 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 1271: | 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 1287: | 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 1322: | 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 1362: | 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 1388: | 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 1399: | 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 1408: | 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 ^ | ||
+ | | | 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 1474: | 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 1486: | 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 1512: | 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 | | ||
- |