CODINGDDI-1 Firmware: The Complete CPC 464 DISC Operating System ROM Specification

DDI-1 Firmware: Chapter 2 - CP/M 2.2 and the BIOS (2/3)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Chapter 2 - CP/M 2.2 and the BIOS

2.14 BIOS Jumpblocks
0 SET MESSAGE#BE80

Enable/disable the disc error messages.

Action:

  • When disc error messages are enabled and an error occurs the BIOS will display error messages on the screen and interact with the user. When disabled no messages are displayed.
Entry conditions:
  • A = #000 enable disc error messages A = # FFi) disable disc error messages
Exit conditions:
  • A = previous state
  • All flags HL corrupt All other registers preserved.
Notes:
  • The power-up state is ENABLED.
Related entries:

SET RETRY COUNT

1 SETUP DISC#BE83

Reset various disc parameters.

Action:

  • Sets the values for the motor on, motor off, write current off and head settle times. Sends a SPECIFY command to the floppy disc controller.
Entry conditions:
  • HL = address of parameter block
Format of the parameter block:
  • bytes 0,1 motor on timeout in 20 millisecond units, bytes 2,3 motor off timeout in 20 millisecond units, byte 4 write current off time in 10 microsecond units,
  • byte 5 head settle time in 1 millisecond units,
  • byte 6 step rate time in 1 millisecond units,
  • byte 7 head unload delay (as per /J.PD765A SPECIFY command),
  • byte 8 bits 7.. 1: head load delay, bit 0: non-DMA mode (as per µPD765A SPECIFY command).
Exit conditions:
  • AF BC DE HL corrupt All other registers preserved.
Notes:
  • The values given are used for both drives. When using two differing drives use the slowest of the two times.
  • The power-up values are:
    • motor on timeout 50
    • motor off timeout 250
    • write current off time 175 head settle time 15
    • step rate time 12
    • head load time 1
    • head unload time 1
    • non-DMA mode 1
A motor on time of zero will lock up the system. A motor off time of zero will never turn the motor off.

The standard boot program calls this routine to reset some of the disc parameters as specified in the configuration sector, that is, motor on and off timeouts and the step rate.

2 SELECT FORMAT#BE86

Select an AMSTRAD format, regardless of the actual disc format.

Action:

  • This routine initializes the extended disc parameter block for the given format. Normally the BIOS automatically detects the format of a disc when SELDSK is called by looking at the sector numbers, but for programs such as formatters it is necessary to pre-set the format.
Entry conditions:
  • A = first sector number of required format
    • #41 ⇒ system format
    • #C1 ⇒ data only format
    • #01 ⇒ IBM format
  • E = drive
    • #00 ⇒ A:
    • #01 ⇒ B:
Exit conditions:
  • AF BC DE HL corrupt
  • All other registers preserved.
Notes:
  • Bytes 0..21 of the extended disc parameter block are completely reset, all previous values are lost. Bytes 22..24 (track, align flag, auto-select flag) are not affected. See chapter 2.15.
  • To set a non-AMSTRAD format the user may patch the extended disc parameter block directly.
3 READ SECTOR

#BE89

Read a physical sector from disc.

Action:

  • Read the specified sector into store.
Entry conditions:
  • HL = address of sector buffer
  • E = drive number
    • #00 ⇒ A:
    • #01 ⇒ B:
  • D = track number
  • C = sector number
Exit conditions:

if carry true

  • sector read OK
  • A = 0
  • HL preserved
if carry false
  • failed to read sector correctly
  • A = error status byte as defined above
  • HL = address of error status buffer
always
  • other flags corrupt
  • all other registers preserved
Related entries:

WRITE SECTOR

4 WRITE SECTOR#BE8C

Write a physical sector to disc.

Action:

  • Write the required sector from store.
Entry conditions:
  • HL = address of sector buffer
  • E = drive number
    • #00 ⇒ A:
    • #01 ⇒ B:
  • D = track number
  • C = sector number
Exit conditions:

if carry true

  • sector written OK
  • A = 0
  • HL preserved
if carry false
  • failed to write sector correctly
  • A = error status byte as defined above
  • HL = address of error status buffer
always
  • other flags corrupt
  • all other registers preserved
Notes:
  • Sector buffer may be under ROM.
Related entries:

READ SECTOR

5 FORMAT TRACK#BE8F

Format an entire track.

Action:

  • Format a track.
Entry conditions:
  • HL = address of header information buffer
  • E = drive number
    • #00 ⇒ A:
    • #01 ⇒ B:
  • D = track number
Format of header information:
  • sector entry for first sector sector entry for second sector
  • sector entry for last sector
  • sector entry format:
    • byte 0: track number
    • byte 1: head number
    • byte 2: sector number
    • byte 3: log2 (sector size) - 7
Exit conditions:

if carry true

  • track formatted OK
  • A = 0
  • HL preserved
if carry false
  • failed to format track correctly
  • A = error status byte as defined above
  • HL = address of error status buffer
always
  • other flags corrupt
  • all other registers preserved
Notes:
  • The extended DPB must be preset for the required format (see SELECT FORMAT).
Related entries:

SELECT FORMAT

6 MOVE TRACK#BE92

Unverified move to specified track.

Action:

Move head to specified track.

Entry conditions:

  • E = drive number
    • #00 ⇒ A:
    • #01 ⇒ B:
  • D = track number
Exit conditions:

if carry true

  • moved to track OK
  • A = 0
  • HL preserved
if carry false
  • failed to move track correctly
  • A = error status byte as defined above
  • HL = address of error status buffer
always
  • other flags corrupt
  • all other registers preserved
Notes:
  • This routine is intended as a diagnostic aid and need not normally be used because the read/write/format routines all seek to the correct track automatically.
7 GET DR STATUS#BE95Return status for specified drive.

Action:

This routine returns status register 3 of the floppy disc controller as defined below for the specified drive.

  • bit 7 undefined
  • bit 6 write protect -The write protect line is true,
  • bit 5 drive ready -The ready line is true,
  • bit 4 track zero -The track zero line is true,
  • bit 3 undefined
  • bit 2 head address -alwayszero.
  • bit 1unit select 1 -unit select 1, always zero.
  • bit 0 unit select 0 -currently selected drive.
Entry conditions:
  • A = drive number
    • #00 ⇒ A:
    • #01 ⇒ B:
Exit conditions:

if carry true

  • A = Drive status byte as defined above
  • HL preserved
If carry false
  • HL = address of error status buffer, second byte = Drive status byte as defined above
  • A corrupt
always
  • other flags corrupt
  • all other registers preserved
Notes
  • This routine returns carry to indicate which set of exit conditions have occurred. No other meaning should be attached to the state of carry.
8 SET RETRY COUNT#BE98Action:

Sets the number of times an operation is retried in the event of an error.

Entry conditions:

  • A = new value for retry count
Exit conditions:
  • A = old value of retry count All flags HL corrupt
Notes:

The pattern of retries is as follows. Each ‘Try' counts one. The retry pattern is repeated until either the operation succeeds or the number of tries has reached the retry count:

  • Try
  • Try
  • Move in one track and back again Try *
  • Move out one track and back again Try
  • Move to inner track and back again
  • Try
  • Try
  • Move in one track and back again Try
  • Move out one track and back again Try
  • Move to outer track and back again Repeat
The default value is 16, i.e. twice around the above loop.
9 ENTER FIRMWARE#BE9BCall a firmware routine.

Action:

Calls a firmware routine. The application program must set up all registers as required by the firmware routine to be called, its address being passed as an in-line parameter.

The given routine is run on the BIOS's stack.

The following routines must NEVER be called using ENTER FIRMWARE:

  • ENTER FIRMWARE.
  • SET REG SAVE.
  • All the standard BIOS routines.
See chapter 2.17 for when and why to use this routine.

Entry conditions:

  • AF BC DE HL IX as required by routine to call Return address points to address of routine to call
Exit conditions:
  • AF BC DE HL IX as per routine called all other registers preserved
Related entries:

SET REG SAVE

Example:

To read characters from the keyboard using KM WAIT KEY echoing them to the screen using TXT OUTPUT.

LOOP: CALL ENTERFIRMWARE
DW KMWAITKEY ;in-line parameter
CALL ENTERFIRMWARE
DW TXTOUTPUT ;in-line parameter
JP LOOP

10 SET REG SAVE#BE9ESet/clear saving of the alternate and IY registers.

Action:

Enable or disable the saving of the alternate and IY registers. See chapter 2.17 and the ENTER FIRMWARE routine.

This routine must NEVER be called by using the ENTER FIRMWARE routine.

Entry conditions:

  • A = #00 ⇒ save alternate and IY registers
  • A = #FF ⇒ don't save alternate and IY registers
Exit conditions:
  • A = previous value
  • All flags HL corrupt
  • all other registers preserved
Related entries:

ENTER FIRMWARE

11 SET SIO#BEA1

Reset and initialize the serial interface.

Action:

  • Reset and initialize both channels of the SIO. Initialize the 8253 used as a baud rate generator.
Entry conditions:
  • HL = address of parameter block parameter block format:
    • byte 0 SIO channel A write register 4 (mode register)
    • byte 1 SIO channel A write register 5 (tx register)
    • byte 2 SIO channel A write register 3 (rx register)
    • byte 3 SIO channel B write register 4 (mode register)
    • byte 4 SIO channel B write register 5 (tx register)
    • byte 5 SIO channel B write register 3 (rx register)
    • byte 6,7 8253 timer 0 (SIO channel A tx baud rate)
    • byte 8,9 8253 timer 1 (SIO channel A rx baud rate)
    • byte 10,11 8253 timer 2 (SIO channel B tx and rx baud rate)
Exit conditions:
  • AF BC DE HL corrupt
  • all other registers preserved
Notes:
  • The SIO and 8253 are not included on the DDI-1 interface.
  • Refer to the Zilog SIO and Intel 8253 documentation.
12 SET CMND BUFFER#BEA4

Initialize the initial command buffer.

Action:

  • The buffer supplied is copied into the BIOS's initial command buffer. When the BIOS routine CONIN is called it fetches characters from the command buffer until it is empty, then characters are fetched from the console.
  • Optionally, while characters are being read from the command buffer, hitting a key will empty the command buffer. The character typed will be the next one returned. All subsequent characters will be fetched from the keyboard.
Entry conditions
  • A = #00 ⇒ the command buffer will be junked if a key is pressed
  • A = #FF ⇒ the command buffer is kept even if a key is pressed
  • HL = address of buffer.
Buffer format:
  • byte 0 count of characters 0..128
  • byte 1.. 128 characters
Exit conditions:
  • AF BC DE HL corrupt all other registers preserved
Notes:
  • Although this routine is primarily for use during cold boot, it may be called at any time to refill the buffer.
  • CONST returns the status of the keyboard, not of the initial command buffer. Thus a program which polls for Control-C will not drain the command buffer.
13 DO IN STATUS#BEA7

Test if special character I/O device 0 has a character available.

Action:

  • Test if there is a character available.
Entry conditions:
  • No conditions
Exit conditions:

if A = #FF

  • a character is available for input
if A = #00
  • no character is available for input
always
  • All flags BC DE HL corrupt
Notes:
  • The default device 0 is channel A of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

DO IN
DO OUT STATUS
DO OUT

14 DO IN#BEAAFetch a character.

Action:

  • Input a character from special character I/O device 0. If none is available then wait until one appears.
Entry conditions:
  • No conditions
Exit conditions:
  • A = character input
  • All flags BC DE HL corrupt
  • all other registers preserved
Notes:
  • The default device 0 is channel A of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

DO IN STATUS
DO OUT STATUS
DO OUT

15 DO OUT STATUS#BEADTest if the output is ready.

Action:

  • Test if special character I/O device 0 is ready to output a character.
Entry conditions
  • No conditions
Exit conditions:

if A = #FF

  • output device is ready
if A = #00
  • output device is busy
always
  • All flags BC DE HL corrupt
  • all other registers preserved
Notes:
  • The default device 0 is channel A of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

DO IN STATUS
DO IN
DO OUT

16 DO OUT#BEB0Output a character.

Action:

  • Output a character to special character I/O device 0. If device is busy then wait until it becomes ready.
Entry conditions:
  • C = character to output
Exit conditions:
  • AF BC DE HL corrupt all other registers preserved
Notes:
  • The default device 0 is channel A of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

DO IN STATUS
DO IN
DO OUT STATUS

17 D1 IN STATUS#BEB3

Test if special character I/O device 1 has a character available.

Action:

  • Test if there is a character available.
Entry conditions:
  • No conditions
Exit conditions:

if A = #FF

  • a character is available for input
if A = #00
  • no character is available for input
always
  • All flags BC DE HL corrupt
Notes:
  • The default device 1 is channel B of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

D1 IN
D1 OUT STATUS
D1 OUT

18 D1 IN#BEB6Fetch a character.

Action:

  • Input a character from special character I/O device 1. If none is available then wait until one appears.
Entry conditions:
  • No conditions
Exit conditions:
  • A = character input
  • All flags BC DE HL corrupt
  • all other registers preserved
Notes:
  • The default device 1 is channel B of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

D1 IN STATUS
D1 OUT STATUS
D1 OUT

19 D1 OUT STATUS#BEB9Test if the output is ready.

Action:

  • Test if special character I/O device 1 is ready to output a character.
Entry conditions:
  • No conditions
Exit conditions:

if A = #FF

  • output device is ready
if A = #00
  • output device is busy
always
  • All flags BC DE HL corrupt all other registers preserved
Notes:
  • The default device 1 is channel B of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

D1 IN STATUS
D1 IN
D1 OUT

20 D1 OUT#BEBCOutput a character.

Action:

  • Output a character to special character I/O device 1. If device is busy then wait until it becomes ready.
Entry conditions:
  • C = character to output
Exit conditions:
  • AF BC DE HL corrupt
  • all other registers preserved
Notes:
  • The default device 1 is channel B of the serial interface.
  • This jump may be patched to a RSX driver if required.
Related entries:

D1 IN STATUS D1 IN

D1 OUT STATUS

★ AUTHOR: Paul OVERELL
★ NOTE: RÉF SOFT158A

Page précédente : DDI-1 Firmware: Chapter 2 - CP/M 2.2 and the BIOS (1/3)
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.732-desktop/c
Page créée en 500 millisecondes et consultée 850 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.