Commit 4ab90446 authored by Neil Turton's avatar Neil Turton
Browse files

Import from cleaned 360 CD

hdr/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
Bit settings for CDFSDriver: (bit numbering starts from 0, ie/ bit 0 = 1, bit 3 = 8 etc; )
Description Bit number Command Length of CDB
---------------------------------------------------------------------
SCSI_READ 6 &28 10
SCSI_SEEK 7 &2b 10
SCSI_INQUIRY 8 &12 6
SCSI_CAPACITY/DISCUSED 9 &25 10
SCSI_READY 10 &00 6
SCSI_STOPOPEN 11 &1b 6
SCSI_CHECK 12 &1d 6
SCSI_STATUS 13 &00 6
SCSI_CONTROL 14 --- -- this calls SWI SCSI_Control
SCSI_PREFETCH 15 &28 10 see SCSI_READ
SCSI_RESET 16 --- -- this calls SWI SCSI_Initialise
CDFSDriver history:
;-----------------------------------------------------------------------------------------------
2.15 01-Mar-93 MEW Eesox Totally rewritten to allow soft-loadable driver support
;-----------------------------------------------------------------------------------------------
2.16 24-Jun-93 MEW Eesox Bug fix: problem with more than one drive type - it didn't
send the discchanged command to the correct driver !
;-----------------------------------------------------------------------------------------------
2.21 05-Jul-94 MEW Eesox CD_ReadAudio added
;-----------------------------------------------------------------------------------------------
2.30 19-Jul-94 MEW Eesox CD_ReadUserData added. 'buffer' extended from 256 to 2340 bytes
;-----------------------------------------------------------------------------------------------
2.30a 19-Sep-94 MEW Eesox Bug fix - removed check to see if soft-load driver can support
the SWI.
;-----------------------------------------------------------------------------------------------
2.31 25-Jan-95 MEW Eesox Added support for CD_GetAudioParms and CD_SetAudioParms
;-----------------------------------------------------------------------------------------------
; CD_Routine Headers
; This contains details of entry and exit conditions for the general routines that all
; soft drivers may use
; Routines defined:
;
; cd_checkdrive
; cd_control
; cd_converttolba
; cd_converttomsf
; cd_discused
; cd_driveready
; cd_drivestatus
; cd_inquiry
; cd_lasterror
; cd_opendrawer
; cd_prefetch
; cd_readdata
; cd_reset
; cd_seekto
; cd_stopdisc
; cd_version
; cd_identify
; cd_register
; cd_unregister
;-----------------------------------------------------------------------------------------------
cd_version
;
; on entry:
; nothing needed
; on exit:
; r0 -> version string ( word 0 = version number * 100, word 1 .. = null term. string )
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_lasterror
;
; on entry:
; nothing needed
; on exit:
; r0 = number of last error, or 0 if none
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_prefetch
;
; on entry:
; r0 = addressing mode
; r1 = block number
; r7 -> control block
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_readdata **** check this with Mark ****
;
; on entry:
; r0 = addressing mode
; r1 = block number
; r2 = number of blocks
; r3 -> where to put data
; r4 = number of bytes from each block wanted
; r7 -> control block
; r12 -> any workspace required
; r13 -> full descending stack
; on exit:
; if error then r0-> error block, else all regs preserved
;
; r8 = scsi device id
; r9 = card number
; r10 = lun
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_seekto
;
; on entry:
; r0 = addressing mode
; r1 = block number
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_inquiry
;
; on entry:
; r0 -> place to put the inquiry data
; r7 -> control block
; on exit:
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_discused
;
; on entry:
; r0 = addressing mode that the disc length should be returned in
; r1 -> storage area to put data in
; r7 -> control block
; on exit:
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_driveready
;
; on entry:
; r7 -> control block
; on exit:
; r0 = 0 if drive is OK, else r0 = 1
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_stopdisc
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_opendrawer
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_converttolba
; on entry:
; r0 = address mode
; r1 = address
; on exit:
; if oVerflow set then r0 -> error block
; r1 = new address
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_converttomsf
; on entry:
; r0 = address mode
; r1 = address
; on exit:
; if oVerflow set then r0 -> error block
; r1 = new address
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_drivestatus
;
; on entry:
; r7 -> control block
; on exit:
; r0 = status { 1=OK, 2=BUSY, 4=NOTREADY, 8=UNAVAILABLE }
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_control
;
; on entry:
; r0 = 0, 1 or 2 to set the level of error response
; r7 -> control block
; on exit:
; usual error stuff
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_reset
;
; on entry:
; r7 -> control block
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
cd_checkdrive
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
; r0 = drive status bits
;-----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
cd_identify
;
; on entry:
; r7 -> control block
; control block + 0 = SCSI device id
; control block + 4 = SCSI card number
; control block + 8 = Logical unit number
; control block + 12 = 0 - drive type not needed
; on exit:
; if oVerflow clear:
; r0 - r1 preserved
; r2 = drive type given by CDFS driver, else -1 if type not recognized
; if oVerflow set:
; r0 -> error block, could be because no drivers loaded
; r1 - r9 preserved
;
;----------------------------------------------------------------------------------------------
; the 'buffer' in workspace is to be used as follows:
; bytes 0 to 7 are to build the inquiry command up
; bytes 8 to 44 are for the returned inquiry data
;--------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
cd_register
;
; on entry:
; r0 -> block
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
; r2 -> workspace for soft-loadable module (this will be R12 in the handler)
;
; r12 -> my workspace pointer
; on exit:
; Overflow flag clear if registered OK, else set and R0->error block.
;
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
cd_unregister
;
; on entry:
; r0 -> block
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
;
; r12 -> my workspace pointer
; on exit:
; Overflow flag clear if registered OK, else set and R0->error block.
;
;----------------------------------------------------------------------------------------------
; r8 = registered count
;----------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------
REM >CDDemo
REM Provides basic details of how to use CD SWIs
REM Copyright Acorn Computers, 1994
REM
REM This code should be used in conjunction with the CDFS SWIs Application Note
REM available from Acorn Developer Support.
REM
REM For further details contact:
REM Technical Support
REM Acorn Computers Ltd
REM Acorn House
REM Vision Park
REM Histon
REM Cambs CB4 4AE
REM
REM Tel: +44 223 254254
REM -----------------------------------------------------------------------------------------------
DriveNumber% = 0 : REM 0 = first, 1 = second etc
END = &8000000
DIM ControlBlock 30
REM -----------------------------------------------------------------------------------------------
REM Initialise the Control Block for subsequent CDFS access
REM -----------------------------------------------------------------------------------------------
PROCInitControlBlock(DriveNumber%)
REM -----------------------------------------------------------------------------------------------
REM User code can be placed after this point eg,.......
REM -----------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------
REM Check the drive status 1=OK, 2=BUSY, 4=NOT READY, 5=UNAVAILABLE
REM -----------------------------------------------------------------------------------------------
SYS "CD_DriveStatus",,,,,,,,ControlBlock TO stat%
REM -----------------------------------------------------------------------------------------------
REM Eject the disc if the drive status is OK, otherwise print an error message
REM -----------------------------------------------------------------------------------------------
IF stat% = 1 THEN
SYS "CD_OpenDrawer",,,,,,,,ControlBlock
ELSE
PRINT "Drive status error : ", stat%
ENDIF
END
REM -----------------------------------------------------------------------------------------------
REM InitControlBlock(drive%)
REM
REM This routine calls the ConvertDriveToDevice SWI, then sets up
REM ControlBlock (defined globally) with the necesary data for further
REM CDFS calls
REM -----------------------------------------------------------------------------------------------
DEFPROCInitControlBlock(drive%)
LOCAL device%, a
SYS "CDFS_ConvertDriveToDevice", drive% TO a,device%
ControlBlock!0 = (device% AND &00000007)
ControlBlock!4 = ((device% >> 3) AND &00000003)
ControlBlock!8 = ((device% >> 5) AND &00000007)
ControlBlock!12 = ((device% >> 8) AND &000000FF)
ControlBlock!16 = ((device% >> 16) AND &0000FFFF)
ENDPROC
****************************************************************************
******************* THE CD-ROM FILING SYSTEM USER GUIDE ********************
****************************************************************************
Copyright © 1990, 1991 Next Technology Corporation Limited. All rights reserved.
Copyright © 1993 Acorn Computers Limited. All rights reserved.
Issue 3, October 1993
The CD-ROM Filing System User Guide
===================================
The product described in this manual is subject to continuous development
and improvement. All information of a technical nature and particulars of
the product and its use (including the information and particulars in this
manual) are given by Acorn Computers Limited in good faith. However,
Acorn Computers Limited cannot accept any liability for any loss or damage
arising from the use of any information or particulars in this manual.
ACORN, the ACORN logo and ARCHIMEDES are trademarks of Acorn
Computers Limited.
All other trademarks are acknowledged.
Copyright © 1990, 1991 Next Technology Corporation Limited. All rights
reserved. Copyright © 1993 Acorn Computers Limited. All rights reserved.
Published by Acorn Computers Limited
Configuring the computer
________________________
The CD-ROM Filing System (CDFS) enables you to access data on a
CD-ROM from the RISC OS desktop. It is usually resident in a ROM
on your SCSI expansion card, and is loaded automatically when you
power on your computer. The CDFS icon bar menu enables you to
configure your computer to suit the CD-ROM system attached to it.
This section tells you how to configure your computer so that you
can use CD-ROMs; you only need to do so when adding or removing
drives.
For details of how to use CDFS once you have configured it, see
Using CD-ROM discs on page 7.
Configuring your RISC OS computer from the desktop
To ensure the fastest boot up time, the following procedure should
be followed:
1 Ensure all the peripherals and cables are connected.
2 Switch on the monitor, then the CD-ROM drive. The CD-ROM
drive should always be switched on before the computer.
3 Switch on the computer. CDFS will look to see if a CD-ROM
drive is connected.
4 The CDFS CD-ROM icon will be displayed on the Icon Bar.
Click on this icon to determine which type of CD-ROM is
currently held in the drive drawer - CD-ROM, Photo CD or
Audio CD.
5 To configure the number of CD-ROM drives you have attached
to your computer, click Menu on the CD-ROM icon. The CDFS
icon bar menu will be displayed:
6 Choose Configure, Drives then enter the number of drives
connected. If only one drive is connected, this step may be left
out, but the boot-up time will be slower:
7 To configure the CD-ROM buffers, click Menu on the CD-ROM
icon. Choose Configure, Buffers then click on the required
buffer size - 16K is normally sufficient, unless you are swapping
discs a lot, in which case 32K or 64K would be better:
8 Reset the computer to implement the new configuration.
Setting up PC Soft to read CD-ROM discs
Many CD-ROM titles are written in PC format, so to get the best out
of these, PC Soft should be used in the computer. (PC Soft used to
be known as the Acorn PC Emulator.) The copy of PC Soft you use
must be version 1.6 or later.
If you are using MS-DOS, you must have version 3.3 or higher, with
CD-ROM extensions.
If you are using DR-DOS, you must have a version with CD-ROM
extensions. At the time of going to press, such versions were not yet
available - but this is likely to change. You should see your supplier
for details of DR-DOS compatibility, availability, and installation.
Loading PC Soft
Load PC Soft as instructed in the PC Soft Guide accompanying it.
Set the configuration of the emulated PC, using the Configure
option from the PC icon bar menu. Choose EGA and ECD for titles
using this screen mode, with 128K of memory for computers with
2MB of RAM, and 256K for those with more RAM. Choose VGA for
titles using this screen mode. (Versions 1.6 and 1.7 do not support
VGA, but you can choose EGA+ for a partial emulation of VGA
mode.)
By default, the CD-ROM drive will be configured as drive F.
Additional drives will be named G, H and so on. However, if you
have four hard disc drives configured (drives C-F) then the CD-ROM
drive will install itself as drive G, and additional drives follow on
from there.
Now run PC Soft. Switch to Single task mode (from the icon bar
menu) to be able to display a full screen, and for faster response.
Loading the MS-DOS CD-ROM support software
PC Soft (version 1.6 or later) when sold with MS-DOS is
accompanied by a CD-ROM Support disc. The software on this disc
enables you to access the CD-ROM drive while you are running
DOS.
The software has its own installation program, to make it easy for
you to install it on your computer. This program alters your DOS
AUTOEXEC.BAT and CONFIG.SYS files and copies Microsoft
MS-DOS CD-ROM extensions and the CD-ROM device driver.
If you usually boot DOS from a floppy disc, you first need to format
a new system floppy disc on which to install the software. To do this,
put a floppy disc in the drive and type:
FORMAT A: /S
When the format completes, remove this disc from the drive.
To install the software, put the disc labelled CD-ROM Support disc
into the drive. Type:
A:
INSTALL
This starts the installation program. Follow the instructions given
on the screen.
When prompted for a drive letter on which to install this software:
* If you boot DOS from a floppy disc, type A. When the
installation program prompts for your boot disc, insert the
newly-formatted system disc, and press Space. When you are
prompted to insert the disc containing MSCDEX.EXE, put the
CD-ROM Support disc back in the drive.
* If you boot DOS from a hard disc, type the hard disc drive letter
(typically C).
When the installation program has finished, reboot DOS from your
hard disc, if you have one, or else put your newly-created system
disc back in the drive and hold down Ctrl and Alt and press Delete
to do this.
During the reboot cycle a message should be displayed on the
screen similar to the following:
MSCDEX Version 2.20
Copyright ) Microsoft Corp. 1986
Drive F: = Driver CDFSEM unit 0
This indicates that the driver is loaded and the CD-ROM drive has
been allocated the letter F: for access purposes from DOS.
Your computer will now behave like a PC with a CD-ROM drive
attached. There is a summary of common PC commands in the
PC Soft Guide.
Recommended changes to configuration files
We recommend that you check that the following statements exist
in the CONFIG.SYS and AUTOEXEC.BAT files and amend or add
them as necessary as some DOS formatted CD-ROM discs require
these settings before they can be used.
In the CONFIG.SYS file we recommend you add these lines:
FILES=20
BUFFERS=20
In the AUTOEXEC.BAT file your PATH should include the
pathnames below, in the order given:
PATH=C:\;C:\DOS;F:\ (Hard drive users.)
PATH=A:\;A:\DOS;F:\ (Floppy drive users.)
Of course, your PATH may also include other pathnames you have
previously added.
Using CD-ROM discs
__________________
You can use CD-ROM drives either with CD-ROM discs formatted for
use with RISC OS, or with CD-ROM discs produced to run under
MS-DOS. For the latter, you will need a copy of PC Soft to get full
benefit.
Using CDFS
CDFS appears to the user very much like ADFS - all the usual
RISC OS Filer commands are available, although you cannot of
course save to a CD-ROM. If a write command is made to the
CD-ROM drive, an error message will be displayed.
To open a directory display on a CD-ROM which has been inserted
in the drive, click on the CD-ROM drive icon on the icon bar. The
contents of the CD-ROM will be displayed by the RISC OS Filer:
RISC OS directory displays can be opened for PC CD-ROMs. PC file
names are translated to a format compatible with the RISC OS
environment. You can view text files using Edit in the same way as
usual, and use ChangeFSI (see page 15) to convert a wide range of
graphics images to RISC OS sprites, which you can then view using
Paint. However, to run the programs included on such discs, you will
need to use PC Soft (see Reading PC-format CD-ROM discs using PC Soft
below).
If you are not using CDFS
CDFS claims some memory each time you power on your computer.
If you are not using CDFS and need this extra memory, you can
disable CDFS by typing
*Unplug CDFS
*Unplug CDFSDriver
*Unplug CDFSFiler
and then resetting your computer. When you need CDFS again, you
can reinstall the three modules by using *RMReInit for each one
in a similar way, and then rebooting.
Reading PC-format CD-ROM discs using PC Soft
Place a CD-ROM disc in the drive, and type
F:
(or whatever drive letter your CD-ROM drive is configured as).
You can now access PC-format discs in the normal way.
Consult the guide that comes with each title for information on
playing CD-ROM discs.
Do not try to access a CD-ROM through RISC OS (including via
CDPlayer) and through PC Soft at the same time.
Performance limitations
VGA images
Version 1.6 and 1.7 of the Acorn PC Emulator (the old name for
PC Soft) do not fully support the VGA Bios. EGA+ is a partial
implementation of VGA, but some VGA images on PC format
CD-ROM discs cannot be displayed fully. The title screens of some
discs are designed to be displayed in VGA mode, so such discs may
not start off very well. This does not, however, necessarily mean that
the rest of the disc cannot be read correctly. Often the application
will continue of its own accord, or require Space or Return to be
pressed. In some cases the lack of VGA support will prevent the disc
from running under the emulator at all.
Version 1.8 of PC Soft does support VGA.
Sound
Titles which attempt to play sound through the computer's own
sound system can cause program errors, unless you first configure
sound in the program to be off. Most titles are able to play
CD-quality sound through a CD-ROM drive, so this problem does
not often arise.
Titles which attempt to mute one audio channel (left or right),
whilst playing the other channel, can cause program errors.
Windows
Certain CD-ROM applications contain their own version of
Windows on the CD-ROM itself. These versions have often been
modified in some way, and do not always work correctly. We
recommend that you do not use a version of Windows supplied on
CD-ROM, but an appropriate Windows application available
separately from a PC dealer.
Note that Windows 3.1 will not run under PC Soft.
CDPlayer
________
The CDPlayer application allows you to play and control audio CDs
using your computer and a CD-ROM drive. CDPlayer simulates all
the functions of a CD audio player with all the normal functions
such as play, stop, track search, cue and review. It also has a very
comprehensive programming facility. All the functions, including
drive select, are controlled using the mouse.
CDPlayer is supplied on floppy disc. It is already set up to use a
CD-ROM drive that has a SCSI ID of 6, and that is connected to the
first SCSI expansion card fitted to your computer. If you wish to use
a drive with a different SCSI ID, or if you have fitted multiple SCSI
expansion cards to your computer, you should first read The Setup
window on page 14.
To start the application, double-click on the CDPlayer icon; this
loads the program and displays its icon on the icon bar. Click on its
icon to display the main CD Player window, used to control the CD:
The main CD Player window
The basic set of controls work in the same way as those of a
conventional audio CD player.
Play starts the audio CD playing.
Pause stops the CD playing, but holds it in its current position.
Stop stops the CD playing, and returns to the start of the CD.
Eject stops the CD and ejects it from the CD player.
Skip backwards and Skip forwards move to the previous or next
tracks respectively.
Rewind and Fast forward move backwards or forwards through the
audio track, speeding up as you hold down the button.
Moving the Slider takes you quickly to any point on the CD.
Track number shows the number of the track currently playing, or
(as above) 00 if nothing is playing.
Playing time gives you three choices of display. It normally shows
the time the disc has been playing. Clicking on this number changes
the display to show the time the individual track has been playing;
clicking again shows the time left on the disc; clicking again returns
to the original display.
Total tracks/time gives the total number of tracks on the CD, and
its total playing time.
Display keypad displays the keypad, the use of which is described
in the next section.
The Keypad window
Clicking on the triangle icon or choosing Keypad from the
CD Player menu will open the Keypad window. You can use this
window to select which tracks on the CD you wish to hear and in
which order you wish to hear them:
To program the player to play a selection of tracks
1 Click on the first track number you wish to hear, and then on
MEM. The Memory window automatically appears, showing the
tracks in the program memory:
2 Repeat this for any other tracks you wish to add to the program
memory.
3 Play the tracks by clicking on Play.
Other program play functions
ALL adds a list of all the audio tracks available on the CD to the
program memory.
RND clears the program memory, and creates a randomly ordered
list of all the audio tracks to the program memory.
RPT continuously repeats the tracks in the program memory until
you click on the Stop key in the CD Player window. If no program has
been set, the CD instead repeats continuously from start to finish.
CLR is used to clear the program memory. To clear all tracks from
the program memory, click Adjust on the CLR button. To clear
individual tracks, highlight the desired tracks and then click Select
on the CLR button.
Notes on playing programs
When CDPlayer is set to play a program, the following restrictions
apply:
* The slider and slider bar cannot be dragged or clicked on.
* The time display will only show the time the disc has been
playing.
* The main CD Player window must be open to allow the
programmed tracks to be played.
When playing a mixed mode CD (mixed audio and data tracks),
using the ALL button guarantees that all the audio tracks will be
played, otherwise the drive will normally stop when it encounters a
data track, even if there are subsequent audio tracks.
The Setup window
Each CDPlayer can be used to control a single CD-ROM drive at one
time, which is selected using the Setup window. CDPlayer is
supplied already set up to use a CD-ROM drive that has a SCSI ID
of 6, and that is connected to the first SCSI expansion card fitted to
your computer. You'll only need to change the Setup if you wish to
use a drive with a different SCSI ID, or if you have fitted multiple
SCSI expansion cards to your computer.
To open the Setup window, choose Setup from CDPlayer's icon bar
menu:
Click on the + and - icons until the correct device, unit and card
numbers are shown for the CD-ROM drive you wish to use. If you're
not sure what the numbers should be for a particular drive, you can
find them out by typing at the command line:
CDFS:CDDevices (see page 22).
It is not advisable to keep switching CDPlayer from one drive to
another using the Setup window. This operation should only be
performed when CDPlayer is first started. If you need to control
more than one drive, you should start the CDPlayer application as
many times as you require and change each copy's setup
individually before use.
Quitting CDPlayer
To quit the CDPlayer application, choose Quit from its icon bar
menu.
ChangeFSI
_________
ChangeFSI is a useful program for converting and displaying image
files of various formats. These images can then be converted into
sprites for viewing with RISC OS applications such as Paint.
In case you're wondering, ChangeFSI stands for `Change Floyd
Steinberg Integer' (ChangeFSI performs Floyd Steinberg error
diffusion dithering).
You should make sure that your conversion and subsequent use of
an image does not infringe on any copyright that the image may be
under.
ChangeFSI provides the ability to read, scale the data to improve
the picture, change the x and/or y size, sharpen the picture and write
the result using error diffusion dithering in one step (so it provides
the best possible quality). All operations are carried out with 32-bit
fixed point numbers (three per pixel in the case of a colour picture).
Using ChangeFSI
ChangeFSI is supplied on floppy disc. Before using the application,
you should copy it either to another floppy disc, or to your
computer's hard disc - if one is fitted.
Double click on the application to start ChangeFSI. Its icon will be
loaded onto the icon bar. Display the file icon for the image you
wish to process, and drag the icon onto the ChangeFSI application
on the icon bar. ChangeFSI will attempt to interpret the file to give a
RISC OS sprite, displaying the result. You can then save the
resultant image as a sprite file.
Picture formats
ChangeFSI will convert many types of images. These include the PC
graphics formats TIFF, PCX, PIC and IMG, the Amiga format IFF, the
Compuserv GIF format and the JPEG JFIF file interchange format.
For a full list of image formats explained in greater detail, you
should read the file FSIInfo provided inside the application (shift
double-click on !ChangeFSI to display the files).
ChangeFSI in more detail
This section describes the ChangeFSI menu trees in detail. Most
users won't need to use these options as ChangeFSI is already set
up to give good results with most types of image files.
If you want to know how ChangeFSI and its options are used in
greater detail you should read the information file, FSIInfo, provided
inside the application (shift double-click on !ChangeFSI to display
the files).
Menu options
Once you have loaded ChangeFSI onto the icon bar, click Menu over
the icon to display the main options menu.
Scaling options
The Scaling options allow you to choose which scale you wish for
your image. You can also transform, rotate or mirror the image.
The option Scale 1:1 1:1 will give you a full sized image.
Choosing Custom allows you to specify your own scaling options. If
you wish the image to `scale to exact pixel size', fill in the left boxes
only and leave the right boxes blank. The Scale to fill option allows
you to scale the image so that it covers the entire screen area; this
may distort the aspect ratio of the image.
The Ignore Source Pixel Size box allows you to ignore any source
information about the pixel size. This can be useful if you have
images that use a non-standard pixel size.
The Rotate and Mirror options perform rotations and mirror
operations on the source image.
Processing options
The Processing options allow you to control the image processing
used in the conversion and display of the image.
You'll notice that all of these options are `off' by default; you will not
normally need to change these settings.
Expand Dynamic Range will expand the range of colours in the
image. This normally brightens the image. It expands the dynamic
range of a picture to full scale.
Histogram Equalisation will most often result in a worse picture
but it can be used to recover detail from an otherwise useless
image. Alternatively you can use it to look at information locked in a
small part of the input scale.
Disable Dithering will disable Floyd-Steinberg dithering. This will
usually result in an inferior image.
Invert Input will result in your colour images having their colours
inverted. Black and white image are also inverted.
Brighten Picture will produce a picture that is slightly brighter than
it should be. Useful if you have dark pictures.
Black Correction is useful if you want to print the image on a laser
printer. You should use a number between zero and 128, though
values between 32 and 64 usually give the best result; experiment.
Images treated in this way will give a poor result when viewed on
screen. Only works for 1 bpp (black and white) output.
Gamma Correction is used to correct the image quality as
displayed on your monitor. Low values of gamma (0 to 1) make
colours darker and high values (above 1) make them lighter. Gamma
correction is most often used to correct images that have been
scanned in with a scanner. Different monitors may need different
Gamma Corrections. A standard value is 2.2 (TV industry standard).
Pre-sharpening is used to sharpen the edges of objects. This is
useful if the dithering process has made the image blurred. A value
of 24 will counteract the general dither blurring. A value of 20 is
noticeably sharp. Values down to nine can be selected.
Output options
The Output options control the screen mode the picture is created
for.
The 1, 2, 4, 8 buttons represent the screen colours that you can use.
The numbers represent bits per pixel. 8 bits represent 256 colours, 4
bits represent 16 colours, 2 bits represent 4 colours and 1 bit
represents 2 colours. The square box represents the square pixel
modes and the oblong box represents the non-square modes. The
actual output mode chosen is displayed in the mode box.
Use current mode outputs the image for display in the current
mode.
Ignore pixel aspect disables all pixel size information and assumes
both source and output pixels are square.
Monochrome and Colour give an image in black and white or
colour.
Special allows the use of special file suffixes. These are explained
fully in the on-line documentation file FSIInfo.
Reprocess
This option reads the file in again and processes it according to any
new options you have set.
Fast
This option speeds up the processing of the image by blanking the
screen during processing.
Save Choices
This option will save any changes you have made to the ChangeFSI
options so that you can use the options again next time you run
ChangeFSI.
Quit
This quits the application, removing it from the icon bar.
Image menu
Once your image has been produced you can click Menu over the
image to display a menu of information about the input and output
image.
Sprite Info gives the information about the Sprite output file.
Source Info gives the information about the source file.
Range Info gives you information about the dynamic range of the
image.
Zoom allows you to change the magnification of the image. This is
not the same as scaling the source image.
Save Sprite allows you to save the image as a Sprite file.
Reprocess allows you to process the image again using any options
you have changed on the main menu.
Using the command line
______________________
CDFS * Commands
CDFS supports all standard RISC OS filing system * Commands that
do not try to write to disc; for details of these, see your RISC OS 3
User Guide. CDFS also provides some new commands of its own,
detailed below. Many of these commands require an optional drive
parameter; if you omit this, CDFS defaults to using its current drive
(initially drive 0).
*CDDevices
*CDDevices displays all the CD devices connected, their product
name, capacity, SCSI ID (displayed as device, LUN, and card) and
firmware revision.
*CDDevices
*CDFS
*CDFS selects the CD-ROM filing system as the current filing
system.
*CDFS
*CDSpeed
*CDSpeed displays or sets the read speed of the given CD-ROM
drive.
*CDSpeed [drive] [speed]
*Configure CDROMBuffers
*Configure CDROMBuffers sets the configured amount of memory
reserved for CD-ROM buffering (maximum 512K).
*Configure CDROMBuffers sizeK
*Configure CDROMDrives
*Configure CDROMDrives sets the configured number of CD-ROM
drives recognised at power on.
*Configure CDROMDrives n
*Eject
*Eject ejects the disc from the given CD-ROM drive.
*Eject [drive]
*Lock
*Lock locks the disc in the given CD-ROM drive, disabling the Eject
button.
*Lock [drive]
*Play
*Play plays from the specified audio track to the end of the disc in
the given CD_ROM drive.
*Play track [drive]
*PlayList
*PlayList lists the tracks - whether audio or data - on the disc in the
given CD-ROM drive, together with their start time and the total CD
time.
*PlayList [drive]
*PlayMSF
*PlayMSF plays a piece of audio from the disc in the given CD-ROM
drive. The start and stop times are specified in minutes, seconds
and frames from the start of the disc.
*PlayMSF mins:secs:frames mins:secs:frames [drive]
*Stop
*Stop stops playing the disc in the given CD-ROM drive.
*Stop [drive]
*Supported
*Supported lists the drive types recognised by CDFS.
*Supported
*Unlock
*Unlock re-enables the Eject button on the given CD-ROM drive,
reversing the effect of any earlier *Lock command.
*Unlock [drive]
*WhichDisc
*WhichDisc displays the unique ID number for the current CD-ROM
drive.
*WhichDisc
Configuring CD-ROM drives from the command line
To configure the number of CD-ROM drives, type:
*Configure CDROMDrives n
where n is the number of drives (from 0 to 28). You can set n to 0,
which obviously sets the configuration to 0 CD-ROM drives.
You may want to configure the size of the CD-ROM buffers,
especially if you expect to be using a variety of CDs. Type:
*Configure CDROMBuffers sizeK
where size represents the size of the buffers in KB, a number in the
range 0-512.
The configuration chosen will be stored in the CMOS RAM; reset the
computer to implement it. The computer should boot up into the
desktop. A `CD-ROM' icon should appear in the icon bar, the
number of icons representing the number of CD-ROM drives
attached.
Important: Incorrectly setting the number of drives causes the boot
up procedure to take longer.
Altering the default configuration of your system under
PC Soft
The device driver
The DOS device driver CDFS_DRV.SYS is configured by entering a
statement such as this in CONFIG.SYS:
DEVICE = C:\DRIVERS\CDFS_DRV.SYS /D:MSCD001 /N:1
Parameter switches are:
Parameter
Use
/N:
This restricts the number of drives that can be
used from PC Soft, for example, if you have 4
CD-ROM drives and you use the switch /N:2,
then only the first two drives will be usable
from PC Soft. If this switch is not specified
then all of the drives will be accessible.
/D:
This switch allows the device driver name to
be changed. You are advised not to change
this switch as it must then also be changed
for MSCDEX.EXE.
MS-DOS CD-ROM Extensions
The file containing the MS-DOS CD-ROM extensions is called
MSCDEX.EXE. This is configured by entering a statement such as
this in AUTOEXEC.BAT:
C:\DRIVERS\MSCDEX /D:MSCD001 /L:F
Parameter switches are:
Parameter
Use
/D:
Specifies the CD-ROM device driver name -
for example MSCD001 - which must match
that used in CONFIG.SYS.
/L:
Specifies the drive letter of the first CD-ROM
drive
/M:
Specifies the number of cache buffers for
MSCDEX.EXE (8 - 15), the default being 8.
/V:
Displays verbose message during boot-up,
detailing memory usage and diagnostic
information.
/S:
Instructs MSCDEX.EXE to patch DOS to allow
CD-ROM drive sharing on an MS-NET based
network server.
This parameter is not used by PC Soft.
/E:
Instructs MSCDEX.EXE to use extended
memory if available.
Interfacing CDs and RISC OS
___________________________
Introduction
CDFS is made up from three modules: the CDFS module itself, the
CDFSDriver module, and the CDFSFiler module. In general, the
SWIs provided by these modules are reserved for internal use, and
you must not use them in your own code, otherwise unpredictable
results may occur. You should access files stored on CD-ROMs
using the same * Commands and SWI calls with which you would
access any other filing system; see the FileSwitch chapter of the
RISC OS 3 Programmer's Reference Manual.
However, RISC OS itself does not provide any facilities for you to
use the audio facilities of a CD-ROM drive; these facilities are
instead provided by the CDFS and CDFSDriver SWIs detailed below.
You should only use these SWIs for accessing audio, and you must
not use any other CDFS or CDFSDriver SWIs.
The SWI calls
All SWIs conform to the RISC OS standard insofar as:
* Any registers not explicitly defined as result parameters are
preserved.
* The processor flags N, Z and C are preserved.
* Errors are indicated by setting V and returning with R0 pointing
at an error block. (If the bit 17 clear version is called, control
passes to the error handler instead.)
* The SWI cannot be called from the background unless this is
specifically documented.
* All SWIs may be called from interrupt and event routines.
but:
* No CDFSDriver SWIs preserve the interrupt state.
* No CDFSDriver SWIs are re-entrant.
CDFS SWI calls
CDFS_ConvertDriveToDevice (SWI &41E80)
Converts a logical drive number to a physical drive number.
On entry
R0 = logical drive number
On exit
R0 preserved
R1 = physical drive number
Use
This call converts a logical drive number to a physical drive number.
You can then use the physical drive number to produce a CDFS
control block, which you have to pass when calling CDFSDriver
SWIs. For details of how to construct the block, see below.
This call returns an error if the logical drive is not known.
CDFSDriver SWI calls
CDFS control blocks
Before you can access a CD-ROM drive using any of the CDFSDriver
SWIs, you need to set up a CDFS control block, as described below.
When you call any of the SWIs, you pass a pointer to the block in R7.
A CDFS control block describes a physical device to the
CDFS_Driver module, so that it can use the correct routines.
Consequently there must be one block for each CD-ROM drive to be
accessed. Once set up, the block remains valid until the next CDFS
initialisation. CDFS may alter a block's contents, but you must not
do so yourself, nor must you save a block and use it in another
session.
Each CDFS control block is five words long. To construct a block for
a particular logical drive, you must:
1 Allocate memory for the block.
2 Call CDFS_ConvertDriveToDevice to convert that drive's logical
number to a physical drive number.
3 Copy the returned physical drive number into the block as
follows:
Bits from Place Word Bits of CDFS control block
physical drive in:
number
0 - 2 0 0-2
3 - 4 1 0-1
5 - 7 2 0-2
8 - 15 3 0-7
16 - 31 4 0-15
All bits of the control block not mentioned above must be
initialised to zero. The whole process can be done as follows:
word 0 = (drive_number AND 7)
word 1 = (drive_number AND &18) >> 3
word 2 = (drive_number AND &E0) >> 5
word 3 = (drive_number AND &FF00) >> 8
word 4 = (drive_number AND &FFFF0000) >> 16
Addressing modes
Locations on a CD are specified as one word addresses. You can use
three different addressing modes:
Addressing mode Meaning
0 Logical block addressing
1 Red Book addressing
2 Physical block addressing
Logical block addressing
A logical block address gives an offset in blocks from the start of the
CD's data area.
Red Book addressing
A Red Book address gives a time offset from the CD's first frame,
made up as follows from the MM:SS:FF location defined in the Red
Book:
Byte Mnemonic Meaning
0 FF Frame number (0 - 74)
1 SS Seconds (0 - 59)
2 MM Minutes (0 - 99)
3 Undefined
There are 75 frames per second.
Physical Block Addressing
A physical block address gives an offset in blocks from the first block
on the CD.
CD_OpenDrawer (SWI &41247)
Stops the CD spinning, opens the drawer and ejects the caddy
On entry
R7 = pointer to CDFS control block
On exit
R7 preserved
Use
This call stops the CD spinning, opens the drawer and ejects the
caddy. The call fails and returns an error if the drawer has previously
been locked using CD_EjectButton or *Lock.
CD_EjectButton (SWI &41248)
Enables or disables CD ejection
On entry
R0 = 0 (to enable ejection) or 1 (to disable ejection)
R7 = pointer to CDFS control block
On exit
R0, R7 preserved
Use
This call enables or disables CD ejection. It is used by the *Lock
command.
CD_EnquireAddress (SWI &41249)
Returns the current address of the head
On entry
R0 = addressing mode, for returned head location
R7 = pointer to CDFS control block
On exit
R0 = head address
R7 preserved
Use
This call returns the current address of the head. You can use it
while playing audio to determine which section of audio is playing.
CD_PlayAudio (SWI &4124B)
Attempts to play a section of a CD as audio, specified by address
On entry
R0 = addressing mode, of parameters
R1 = start address of play section
R2 = end address of play section
R7 = pointer to CDFS control block
On exit
R0-R2, R7 preserved
Use
This call attempts to play a section of a CD as audio, specified by
address. If the section contains non-audio information, the results
are drive-dependent; you will not necessarily get an error returned,
and some drives may still attempt to play the data. We therefore
recommend you first use calls to CD_EnquireTrack to find if the
section you wish to play consists entirely of audio.
CD_PlayTrack (SWI &4124C)
Attempts to play a section of a CD as audio, specified by track
On entry
R0 = track number at which to start playing (1 - 99)
R1 = 255 to play to end of CD, or 254 to play to end of track
R7 = pointer to CDFS control block
On exit
R0, R1, R7 preserved
Use
This call attempts to play a section of a CD as audio, specified by
track. If the section contains non-audio information, an error is
returned.
CD_AudioPause (SWI &4124D)
Controls pausing of audio playing
On entry
R0 = 0 to turn off pausing, if pause was in effect, or 1 to turn on
pausing, if audio was playing
R7 = pointer to CDFS control block
On exit
R0, R7 preserved
Use
This call controls pausing of audio playing.
CD_EnquireTrack (SWI &4124E)
Returns the track range of a CD, or information on a specified track
On entry
R0 = 0 to return track range, or a valid track number
R1 = pointer to 5 byte block
R7 = pointer to CDFS control block
On exit
R0, R1, R7 preserved
Use
This call returns the track range of a CD, or information on a
specified track. The information is returned in the block pointed to
by R1.
If R0 = 0 on entry, the track range is returned in the block as follows:
Byte Contents
0 First track on CD (1-99)
1 Last track on CD (1-99)
2-4 Corrupted
Track numbers do not necessarily start at 1.
If R0 is a valid track number on entry, then information about that
track is returned in the block:
Byte Contents
0-3 Logical block address of track start (ie Mode 0
address)
4 Audio control bits specifying the type of
information the track holds:
Bits Meaning
0 0 -> audio information, 1 -> data information
1 0 -> 4 channel sound, 1 -> 2 channel sound
2-7 Reserved
CD_StopDisc (SWI &41252)
Stops a CD playing
On entry
R7 = pointer to CDFS control block
On exit
R7 preserved
Use
This call stops a CD playing. You can use it to stop prematurely an
audio play request.
CD_DiscUsed (SWI &41253)
Returns the size of the CD currently in the drive
On entry
R0 = addressing mode, for returned size
R1 = pointer to 8 byte block
R7 = pointer to CDFS control block
On exit
R0 preserved
R1 corrupted
R7 preserved
Use
This call returns the size of the CD currently in the drive. The call
works with audio CDs as well as with CD-ROMs. The size is returned
in the block pointed to by R1 on entry:
Bytes Contents
0-3 Size of CD
4-7 Size of blocks on CD, in bytes (usually 2048)
Note that R1 may be corrupted on exit.
CD_AudioStatus (SWI &41254)
Returns the current audio status of the drive
On entry
R7 = pointer to CDFS control block
On exit
R0 = audio status
R7 preserved
Use
This call returns the current audio status of the drive, which may
have one of the following values:
Value Meaning
0 Currently playing audio
1 Currently paused
2 Reserved (has no meaning at present)
3 Audio play successfully completed
4 Error occurred during last audio play
5 Audio play has not been requested
To maintain drive independence, you should always treat values 3
and 5 in the same way.
Soft-loadable Drivers
A soft-loadable driver must register itself with the CDFS_Driver
module before it can be used. Once the driver has been registered,
CDFS will make a SCSI_Inquiry command to obtain information
about a SCSI device at a specific SCSI address (i.e. device id, LUN,
card). The results of this Inquiry command are then passed to the
soft-loaded driver to check if it recognises the drive. If the
soft-loaded driver does recognise the drive, then it must return
without an error, in which case CDFS will allocate this soft-loaded
driver as the code which is called each time information is required
from the device.
For soft-loadable drivers which are not SCSI, the same procedure
must be followed. In this case however, CDFS, when passing the
Inquiry command, will pass an error block pointed to by R0 instead
for any SCSI address which is not occupied by a device. The
soft-loaded driver will check for this error block, and when seen will
return a non-error as above. CDFS will then allocate the driver as
before. Thus the non-SCSI soft-loaded CD-ROM device driver is
effectively allocated a SCSI address which is not occupied by any
other device. CDFS will then access the driver in the usual manner,
passing the SCSI address in the control block to the specific driver
which can handle the command in the most appropriate way for the
specific hardware regardless of its type.
SWI handler entry conditions
When the soft-loadable driver registers itself with the CDFSDriver, it
passes the address of a handler for SWI calls. CDFSDriver passes
`CD_' SWIs to this handler with the following entry conditions:
On entry
R0 - R6 = Whatever values the various CD_ SWIs use
R7 = pointer to a control block
Offset Meaning
0 SCSI device id (0-7)
4 SCSI card number (0-3, usually 0)
8 Logical Unit Number (0-7, usually 0)
12 Drive type for this module
R11= the number of the CD_SWI, i.e. 0 -> CD _ReadData,
1 -> CD_SeekTo etc
R12 = pointer to the workspace for this module
R13 = pointer to a full descending stack, approx. 1024 bytes
R14 = address to return to
On exit
R0 - R12 and R14 corrupted
CD_Register (SWI & 41260)
Registers the soft-loadable driver with the CDFSDriver module.
On entry
R0 = pointer to a block
Offset Meaning
0 Information word for CDFSDriver module:
Bits Meaning
0 - 5 The number of CD commands recognised,
currently 31, maximum 63
6 If set then use the SCSI 1 read data
command
7 If set then use the SCSI 1 seek command
9 - 31 Reserved (must be zero)
4 Number of times registered (should be set to zero
and will be updated by CDFSDriver)
8 Number of drive types recognised by this driver
12 Unused (must be zero)
16 Unused (must be zero)
R1 = pointer to a 1-word special tag (&EE5OEE50), followed by
handler code
R2 = pointer to workspace for the soft-loadable module (passed in
R12 to the handler)
On exit
Offset Meaning
12 A pointer to a routine to convert logical blocks to
minutes, seconds, frames
16 A pointer to a routine to convert minutes, seconds,
frames to logical blocks
Use
This call registers the soft-loadable driver with the CDFSDriver
module. The block pointed to by R0 on entry must be in RAM,
whereas anything else, i.e. the code for each CD _SWI, can be in
ROM. The block must stay put in the memory so that CDFSDriver
can check it when detecting drive types.
CD_Unregister (SWI &41261)
Removes the soft-loadable driver from the CDFSDriver module.
On entry
R0 = pointer to a block
Offset Meaning
0 Information word for CDFSDriver module block
Bits Meaning
0-5 The number of CD commands recognised,
currently 31, maximum 63
6 If set then use all SCSI 2 commands and
ignore bits 7 and 8
7 If set then use the SCSI 2 read data
command
8 If set then use the SCSI 2 seek command
9-31 RESERVED (must be zero)
4 Number of times registered (should be sent to 1 to
indicate that it has been registered already)
8 UNUSED
R1 = pointer to a special tag (&EE5OEE50 = 1 word) followed by the
handler code.
On exit
-
Use
Removes the soft-loadable driver from the CDFSDriver module. The
block pointed to by R0 on entry must be in RAM, whereas anything
else, i.e. the code for each CD _ SWI, can be in the ROM.
CD_ByteCopy (SWI &41262)
Fast memory copy routine.
On entry
R1 = pointer to the source
R2 = pointer to the destination
R3 = number of bytes to copy
On exit
All registers preserved
Use
Fast memory copy routine which provides an efficient way of
copying any number of bytes, word-aligned or not.
CD_Identify (SWI & 41263)
Identifies the drive type of a CD-ROM drive.
On entry
R7 = pointer to CDFS control block
(as obtained from SWI CDFS_ConvertDriveToDevice)
On exit
R0 - Rl preserved
R2 = drive type given by CDFS driver, or - 1 if type not recognised
Use
This call gets the drive type of a CD-ROM drive, so that other
CD_SWIs can be made. It can be made by CDFS, the PCEmulator
driver or !CDPlayer.
; -> Notes for CDFSDriver
General flow of driver:
-----------------------
eg/ after SWI CD_..
1. Entry with R11 = SWI number AND 63
R12 -> workspace
R13 -> stack
R14 = return address
2. Is SWI CD_.. a known SWI ? ( eg/ R11 is too big )
3. Check control block if needed
4. Clear Command Descriptor Block ( thats the bit sent through SCSI_Op )
5. Clear misc. vars.
6. Put opcode for Command Descriptor Block in.
7. Put parametersize, numberofbytesreturned, r/w/nodata and storagearea in
8. Jump to routine for each SWI, if nec.
9. Use either the Acorn conforming SCSI_Op or the Oak one
Either way registers need to be set
10. On error branch to error handler - see ( 13 )
11. Jump to routine for each SWI, if nec.
12. Go 'Home' or 'PreHome' END basically
Error !
13. If error is 'Unit attention' or 'Check condition' THEN setdischaschanged
14. If error THEN jump to routine for each SWI if nec.
15. Return error to caller of SWI with overflow set and R0 -> error block
Operating System works out the rest
( ie/ if XCD_.. was called instead of CD_.. )
Meaning of number returned by CD_Supported
Bits Description: ( if set )
---- -----------------------
0 - 2 Level to which CD_AudioControl is supported ( 0 to 7 )
0 = no support at all
1 = supported to level 0
7 = supported to level 6
3 CD_Prefetch supported
4 CD_CloseDrawer supported
5 CD_AudioLevel supported
6 - 31 RESERVED ( 0 )
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# Copyright 1996 Acorn Computers Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for CDFS Driver
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 25-May-94 AMcC Created.
# 23-Feb-95 AMcC Resources now copied to CDFSRes
#
#
# Paths
#
EXP_HDR = <export$dir>
#
# Generic options:
#
MKDIR = cdir
AS = aasm
CP = copy
RM = remove
CFLAGS = -c -depend !Depend -IC:
AFLAGS = -depend !Depend -Stamp -quit -module
CPFLAGS = ~cfr~v
#
# Program specific options:
#
COMPONENT = CDFSDriver
EXPORTS = ${EXP_HDR}.CDROM ${EXP_HDR}.CDErrors
SOURCE = s.Main
TARGET = rm.CDFSDriver
RDIR = Resources
LDIR = ${RDIR}.${LOCALE}
CDFSRES = <src$dir>.OS_Core.FileSys.CDFS.CDFSRes
RESDIR = ${CDFSRES}.Resources.${Locale}.Resources.CDFSDriver.${COMPONENT}
#
# Generic rules:
#
rom: ${TARGET}
@echo ${COMPONENT}: rom module built
export: ${EXPORTS}
@echo ${COMPONENT}: export complete
install_rom: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
resources:
@echo ${COMPONENT}: Resources are in CDFSRes
clean:
${RM} ${TARGET}
@echo ${COMPONENT}: cleaned
${TARGET}: ${SOURCE}
${AS} ${AFLAGS} -To $@ -From ${SOURCE}
${EXP_HDR}.CDROM: hdr.CDROM
${CP} hdr.CDROM $@ ${CPFLAGS}
${EXP_HDR}.CDErrors: hdr.CDErrors
${CP} hdr.CDErrors $@ ${CPFLAGS}
# Dynamic dependencies:
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine clean
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine rom
; > Version
GBLA Version
GBLS VString
GBLS Date
Version SETA 233 ; CDFSDriver
VString SETS "2.33"
Date SETS "03 Feb 1995"
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; >Hdr.CDFSErrors
; *********************************************************************************************
; ** CDFS Driver errors **
; *********************************************************************************************
^ &00803400
CDFSDRIVERERROR__UNUSED # 1 ; 0
CDFSDRIVERERROR__BAD_ALIGNMENT # 1 ; 1
CDFSDRIVERERROR__DRIVE_NOT_SUPPORTED # 1 ; 2
CDFSDRIVERERROR__BAD_MODE # 1 ; 3
CDFSDRIVERERROR__INVALID_PARAMETER # 1 ; 4
CDFSDRIVERERROR__NOT_AUDIO_TRACK # 1 ; 5
CDFSDRIVERERROR__NO_CADDY # 1 ; 6
CDFSDRIVERERROR__NO_DRIVE # 1 ; 7
CDFSDRIVERERROR__INVALID_FORMAT # 1 ; 8
CDFSDRIVERERROR__BAD_MINUTES # 1 ; 9
CDFSDRIVERERROR__BAD_SECONDS # 1 ; 10
CDFSDRIVERERROR__BAD_BLOCKS # 1 ; 11
CDFSDRIVERERROR__PHYSICAL_BLOCK_ERROR # 1 ; 12
CDFSDRIVERERROR__DRAWER_LOCKED # 1 ; 13
CDFSDRIVERERROR__WRONG_DATA_MODE # 1 ; 14
CDFSDRIVERERROR__CHANNEL_NOT_SUPPORTED # 1 ; 15
CDFSDRIVERERROR__BAD_DEVICE_ID # 1 ; 16
CDFSDRIVERERROR__BAD_CARD_NUMBER # 1 ; 17
CDFSDRIVERERROR__BAD_LUN_NUMBER # 1 ; 18
CDFSDRIVERERROR__NO_SUCH_TRACK # 1 ; 19
CDFSDRIVERERROR__FAULTY_DISC # 1 ; 20
CDFSDRIVERERROR__NO_SUCH_BLOCK # 1 ; 21
CDFSDRIVERERROR__DRIVE_DOES_NOT_SUPPORT_THAT # 1 ; 22
CDFSDRIVERERROR__DRIVER_NOT_PRESENT # 1 ; 23
CDFSDRIVERERROR__SWI_NOT_SUPPORTED # 1 ; 24
CDFSDRIVERERROR__TOO_MANY_DRIVERS # 1 ; 25
CDFSDRIVERERROR__NOT_REGISTERED # 1 ; 26
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
;; -> macros
;; =============================================
;; Macros should be kept in ALPHABETICAL order !
;; =============================================
;;
;; CDFSDriverError
;; CLV
;; Debug
;; Debug0
;; DebugDisplay
;; DebugWaitForAKey
;;
;************************************
; This allows nice errors from CDFS driver
;************************************
MACRO
$label CDFSDriverError $name, $message
$name DCD CDFSDriverErrorNumber
= "$message"
= 0
CDFSDriverErrorNumber SETA CDFSDriverErrorNumber + 1
ALIGN
MEND
; *******************************************
; *** Clear overflow flag - will set nzCv ***
; *******************************************
; Note: (AMcC 02-Feb-95)
; Not the same as CLRV Macro in Global Hdr CPU.Generic26
;
MACRO
$label CLV $cond
$label EORVSS pc, pc, # Overflow_Flag
MEND
; **********************************************************
; This will print a message if 'debug' = ON.
; **********************************************************
MACRO
$label Debug $string,$nl
$label [ debug=ON
STASH r14
[ hostvdu=ON
SWI XHostFS_HostVdu
]
SWI XOS_WriteS
= "$string"
[ "$nl"="NL"
= 13,10
]
= 0
ALIGN
[ hostvdu=ON
SWI XHostFS_TubeVdu
]
GRAB r14
]
MEND
; **********************************************************
; This will perform a XOS_Write0 if 'debug' = ON.
; **********************************************************
MACRO
$label Debug0 $string,$nl
$label [ debug=ON
STASH r14
[ hostvdu=ON
SWI XHostFS_HostVdu
]
SWI XOS_Write0
[ "$nl"="NL"
SWI XOS_NewLine
]
[ hostvdu=ON
SWI XHostFS_TubeVdu
]
GRAB r14
]
MEND
; **********************************************************
; This will perform a Display if 'debug' = ON.
; **********************************************************
MACRO
$label DebugDisplay $string,$nl
$label [ debug=ON
STASH r14
[ hostvdu=ON
SWI XHostFS_HostVdu
]
Display $string,$nl
[ hostvdu=ON
SWI XHostFS_TubeVdu
]
GRAB r14
]
MEND
; **********************************************************
; This will perform a wait-for-key if 'debug' = ON.
; **********************************************************
MACRO
$label DebugWaitForAKey
$label [ debug=ON
STASH "r0-r2,r14"
MOV R0, #122
01
SWI XOS_Byte
CMP R1, #&FF
BEQ %BT01
GRAB "r0-r2,r14"
]
MEND
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
SUBT Exported CDROM Driver constants
OldOpt SETA {OPT}
OPT OptNoList+OptNoP1List
; ***********************************
; *** C h a n g e L i s t ***
; ***********************************
; Date Name Description
; ---- ---- -----------
; 20-Dec-94 AMcC Created
; 04-Jan-95 AMcC Undocumented SWIs commented as Private
; (some may cause damage to drive if used incorrectly)
; Not marked as NOPs 'cause some are used by CDFSDriver
;
SWIClass SETS CDROMSWI_Name
^ CDROMSWI_Base ; &41240
AddSWI Version ; +0
AddSWI ReadData ; +1
AddSWI SeekTo ; +2
AddSWI DriveStatus ; +3
AddSWI DriveReady ; +4
AddSWI GetParameters ; +5 Private
AddSWI SetParameters ; +6 Private
AddSWI OpenDrawer ; +7
AddSWI EjectButton ; +8
AddSWI EnquireAddress ; +9
AddSWI EnquireDataMode ; +10 Private
AddSWI PlayAudio ; +11
AddSWI PlayTrack ; +12
AddSWI AudioPause ; +13
AddSWI EnquireTrack ; +14
AddSWI ReadSubChannel ; +15 Private
AddSWI CheckDrive ; +16
AddSWI DiscChanged ; +17 Private
AddSWI StopDisc ; +18
AddSWI DiscUsed ; +19
AddSWI AudioStatus ; +20
AddSWI Inquiry ; +21
AddSWI DiscHasChanged ; +22 Private
AddSWI Control ; +23
AddSWI Supported ; +24 Private
AddSWI Prefetch ; +25
AddSWI Reset ; +26
AddSWI CloseDrawer ; +27 Private
AddSWI IsDrawerLocked ; +28 Private
AddSWI AudioControl ; +29 Private
AddSWI LastError ; +30
AddSWI AudioLevel ; +31 Private
AddSWI Register ; +32
AddSWI Unregister ; +33
AddSWI ByteCopy ; +34 Private
AddSWI Identify ; +35
AddSWI ConvertToLBA ; +36
AddSWI ConvertToMSF ; +37
AddSWI ReadAudio ; +38
AddSWI ReadUserData ; +39
AddSWI SeekUserData ; +40
AddSWI GetAudioParms ; +41
AddSWI SetAudioParms ; +42
OPT OldOpt
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; Hash defines
X_bit * 1:SHL:17
XCD_BaseNumber * (CDROMSWI_Base:OR:X_bit)
; ***************************************************************************
; *** Reason codes passed to soft-load drivers ***
; ***************************************************************************
^ 0
DRIVER__ReadData # 1 ; 0
DRIVER__SeekTo # 1 ; 1
DRIVER__DriveStatus # 1 ; 2
DRIVER__DriveReady # 1 ; 3
DRIVER__GetParameters # 1 ; 4
DRIVER__SetParameters # 1 ; 5
DRIVER__OpenDrawer # 1 ; 6
DRIVER__EjectButton # 1 ; 7
DRIVER__EnquireAddress # 1 ; 8
DRIVER__EnquireDataMode # 1 ; 9
DRIVER__PlayAudio # 1 ; 10
DRIVER__PlayTrack # 1 ; 11
DRIVER__AudioPause # 1 ; 12
DRIVER__EnquireTrack # 1 ; 13
DRIVER__ReadSubChannel # 1 ; 14
DRIVER__CheckDrive # 1 ; 15
DRIVER__DiscChanged # 1 ; 16
DRIVER__StopDisc # 1 ; 17
DRIVER__DiscUsed # 1 ; 18
DRIVER__AudioStatus # 1 ; 19
DRIVER__Inquiry # 1 ; 20
DRIVER__DiscHasChanged # 1 ; 21
DRIVER__Control # 1 ; 22
DRIVER__Supported # 1 ; 23
DRIVER__Prefetch # 1 ; 24
DRIVER__Reset # 1 ; 25
DRIVER__CloseDrawer # 1 ; 26
DRIVER__IsDrawerLocked # 1 ; 27
DRIVER__AudioControl # 1 ; 28
DRIVER__AudioLevel # 1 ; 29
DRIVER__Identify # 1 ; 30
DRIVER__ReadAudio # 1 ; 31
DRIVER__ReadUserData # 1 ; 32
DRIVER__SeekUserData # 1 ; 33
DRIVER__GetAudioParms # 1 ; 34
DRIVER__SetAudioParms # 1 ; 35
;***************************************************************************
OAK * 1
ACORN * 0
ON * 1
OFF * 0
TRUE * 1
FALSE * 0
hostvdu * ON ; debug to host
debug * OFF ; prints debugging information
commanddebug * OFF ; Keeps a list of SWI's called
CheckConfiguredDrives * ON ; don't start up if no drives configured
;------------------------------------------------------------------
RESERVED * 0
CONTROLBYTE * 0
LBAFormat * 0
MSFFormat * 1
PBFormat * 2
SmallestMode * 1
LargestMode * 2
;*********************************************************************************************
; Details on data modes (mode 1, mode 2 form 1, mode 2 form 2)
;*********************************************************************************************
mode1datasize * 2048
mode2datasize * 2340
mode1datasizeHBLB * &00080000 ; high/byte low/byte of above
mode2datasizeHBLB * &20090000 ;
MODE2__HEADER_M * 0
MODE2__HEADER_S * 1
MODE2__HEADER_F * 2
MODE2__HEADER_MODE * 3
MODE2__HEADER_SIZE * 4
MODE2__SUB_HEADER_FILE * 0 ; These fields are repeated at 4,5,6,7
MODE2__SUB_HEADER_CHANNEL * 1 ;
MODE2__SUB_HEADER_SUBMODE * 2 ;
MODE2__SUB_HEADER_CODING * 3 ;
MODE2__SUB_HEADER_SIZE * 8
MODE2__TOTALHEADERSIZE * MODE2__HEADER_SIZE + MODE2__SUB_HEADER_SIZE
SUBMODE__FORM * (1:SHL:5)
USERDATA__MODE2FORM1 * 2048
USERDATA__MODE2FORM2 * 2324
;*********************************************************************************************
bit17 * 2_100000000000000000
MaxNumberOfSeconds * 59
MinNumberOfSeconds * 2
MaxNumberOfBlocks * 74
MaxSCSIcardnumber * 3
MaxLUN * 3
MaxSCSIdeviceID * 6
PhysicalBlockDifference * 2 * ( MaxNumberOfBlocks + 1 ) ; 2 seconds
SWIBaseNumber * CDROMSWI_Base
ErrorBlock * &00803400
HARDRAMLOCATION * &8A
BITSUSEDBYDRIVENUMBER * 2_11111
BITSUSEDBYBUFFER * 2_11100000
;******************* Used for macro to allow nice error blocks ***********
GBLA CDFSDriverErrorNumber
CDFSDriverErrorNumber SETA ErrorBlock
;******************* SCSI error numbers ***************************
SCSIErrorNumber * &00020100
^ SCSIErrorNumber
NoRoom # 1 ; 0
UnknownSCSISWI # 1 ; 1
UnknownReason # 1 ; 2
FailedBusReset # 1 ; 3
InvalidHostId # 1 ; 4
InvalidDeviceId # 1 ; 5
gap # 3 ; 6 - 8
DeviceNotIdle # 1 ; 9
TimeoutSelection # 1 ; 10
TimeoutOther # 1 ; 11
CommandQueueError # 1 ; 12
CommandQueFull # 1 ; 13
ReservationError # 1 ; 14
InvalidParameters # 1 ; 15
ParameterError # 1 ; 16
NotFromIRQ # 1 ; 17
OperationAborted # 1 ; 18
UnexpectedDisconnect # 1 ; 19
;***************** SCSI sense numbers ( TargetError )**********************
SCSISenseNumber * &201C0
^ SCSISenseNumber
NoSense # 1 ; 0
RecoveredError # 1 ; 1
NotReady # 1 ; 2
MediumError # 1 ; 3
HardwareError # 1 ; 4
IllegalRequest # 1 ; 5
UnitAttention # 1 ; 6
DataProtect # 1 ; 7
BlankCheck # 1 ; 8
VendorUnique # 1 ; 9
CopyAborted # 1 ; 10
AbortedCommand # 1 ; 11
Equal # 1 ; 12
VolumeOverflow # 1 ; 13
Miscompare # 1 ; 14
ReservedSenseKey # 1 ; 15
;***************** SCSI status byte numbers *******************************
SCSIStatusNumber * &20180
^ SCSIStatusNumber
CheckCondition # 1
Busy # 1
Unknown # 1
;***************************** Values for SCSI_Op ************************
accesskey * 1
readdata * 2_01000000000000000000000000
;writedata * 2_10000000000000000000000000
nodata * 2_00000000000000000000000000 ; = 0
scatterliston * 2_100000000000000000000000000
scatterlistoff * 2_000000000000000000000000000 ; = 0
escapepollon * 2_0000000000000000000000000000 ; = 0
escapepolloff * 1:SHL:27
retryoff * 2_00000000000000000000000000000 ; = 0
retryon * 2_10000000000000000000000000000
backgroundon * 2_100000000000000000000000000000
backgroundoff * 2_000000000000000000000000000000 ; = 0
;I_bit * &08000000
FIRQ_Flag * 1:ROL:26
IRQ_Flag * 1:ROL:27
Overflow_Flag * 1:ROL:28
Carry_Flag * 1:ROL:29
Zero_Flag * 1:ROL:30
Negative_Flag * 1:ROL:31
;------------------------------------------------------------------
; Structure of r7 -> control block
;------------------------------------------------------------------
^ 0
SdeviceIDoffset # 4
LScardnumberoffset # 4
LUNoffset # 4
drivetypeoffset # 4
control_block_size # 0
;------------------------------------------------------------------
; Structure of register control block
;------------------------------------------------------------------
^ 0
RCB_INFOWORD # 4
RCB_REGISTERED # 4
RCB_DRIVETYPES # 4
;----------------------------------------------------------------------------------------------
; The information word when registering
;----------------------------------------------------------------------------------------------
USE_SCSI_READ * 1<<6
USE_SCSI_SEEK * 1<<7
USE_SCSI_INQUIRY * 1<<8
USE_SCSI_CAPACITY * 1<<9
USE_SCSI_READY * 1<<10
USE_SCSI_STOPOPEN * 1<<11
USE_SCSI_CHECK * 1<<12
USE_SCSI_STATUS * 1<<13
USE_SCSI_CONTROL * 1<<14
USE_SCSI_PREFETCH * 1<<15
USE_SCSI_RESET * 1<<16
USE_PROPRIETARY_RUD * 1<<17 ; = 1 if support own method of reading data
USE_COMPLEX_RUD * 1<<18 ; = 1 if want SCSI scatter list method of reading data
USE_PROPRIETARY_SUD * 1<<19 ; = 1 if support own method of seeking to data
USE_COMPLEX_SUD * 1<<20 ; = 1 if want SCSI scatter list method of seeking to data
;----------------------------------------------------------------------------------------------
; Maximum number of soft-loadable device drivers
; REMEMBER that each soft-load driver can have 4 sub values and that all of this must fit into
; 1 byte (see PC driver and CDFS). ie/ 2 bits for sub-value, 6 bits for main value
;----------------------------------------------------------------------------------------------
MAX_NUMBER_OF_DRIVERS * 64
;----------------------------------------------------------------------------------------------
; CD_Supported values
;
; Meaning of number returned by CD_Supported
; Bits Description: ( if set )
; ---- -----------------------
; 0 - 2 Level to which CD_AudioControl is supported ( 0 to 7 )
; 0 = no support at all
; 1 = supported to level 0
; 7 = supported to level 6
; 3 CD_Prefetch supported
; 4 CD_CloseDrawer supported
; 5 CD_AudioLevel supported
; 6 - 13 Number of different speeds supported by the drive - 1.
; ie/ Standard drives support 1 speed, so will return 0.
; The Sony 561 supports 2 speeds, so will return 1.
; 14 CD_ReadAudio supported
; 15 CD_Get/Set AudioParms supported
; 16 - 31 RESERVED ( 0 )
;----------------------------------------------------------------------------------------------
NOAUDIOCONTROLSUPPORT * 0
AUDIOCONTROLSUPPORT1 * 2_1
AUDIOCONTROLSUPPORT2 * 2_10
AUDIOCONTROLSUPPORT3 * 2_11
AUDIOCONTROLSUPPORT4 * 2_100
AUDIOCONTROLSUPPORT5 * 2_101
AUDIOCONTROLSUPPORT6 * 2_110
AUDIOCONTROLSUPPORT7 * 2_111
SUPPORT__PREFETCH * 2_1000
SUPPORT__CLOSE_DRAWER * 2_10000
SUPPORT__AUDIO_LEVEL * 2_100000
SUPPORT__SPEED_MULTIPLIER * 2_1000000
SUPPORT__READ_AUDIO * 1:SHL:14
SUPPORT__AUDIO_PARMS * 1:SHL:15
;----------------------------------------------------------------------------------------------
END
*
!.gitignore
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; -> ByteCopy.s
; This provides the CD_ByteCopy routine
;**************************************************************************
; This is a highly optimised routine to move blocks of memory
; It will deal with unword-aligned source and destinations
; copied from pages 1000 to 1005 of PRM
; R1 -> source RCM was ere
; R2 -> destination
; R3 = number of bytes to copy
;**************************************************************************
cd_bytecopyinternal ROUT
STASH "r0-r11, r14"
cd_bytecopy
;--------------------------
; Any bytes to copy ?
;--------------------------
TEQ r3, #0
GRABS "r0-r11, pc", EQ
;--------------------------
copy_bytes
TST r2, #3
BNE MovByt100 ; destination not word aligned
MovByt20 ; destination now word aligned. branched back to from below
TST r1, #3
BNE MovByt200 ; source not word aligned
; source & destination are now both word aligned
; count is a byte value ( may not be a whole number of words )
; Quick sort out of what we've got left to do
SUBS r3, r3, #4 * 4 ; Four whole words to do (or more) ?
BLT MovByt40 ; no
SUBS r3, r3, #8 * 4 - 4 * 4 ; Eight whole words to do (or more) ?
BLT MovByt30
MovByt25
LDMIA r1!, { r0, r4 - r9, r14 } ; NB. Order ! (?)
STMIA r2!, { r0, r4 - r9, r14 }
SUBS r3, r3, #8 * 4
BGE MovByt25 ; do another 8 words
CMP r3, #-8 * 4 ; Quick test rather that chaining down
GRABS "r0-r11, pc", EQ ; finished
MovByt30
ADDS r3, r3, #8 * 4 - 4 * 4 ; Four whole words to do ?
BLT MovByt40
LDMIA r1!, { r0, r4 - r5, r14 } ; NB. Order ! (?)
STMIA r2!, { r0, r4 - r5, r14 }
GRABS "r0-r11, pc", EQ ; finished
SUB r3, r3, #4 * 4
MovByt40
ADDS r3, r3, #4 * 4 - 2 * 4 ; Two whole words to go ?
BLT MovByt50
LDMIA r1!, { r0, r14 } ; NB. Order ! (?)
STMIA r2!, { r0, r14 }
GRABS "r0-r11, pc", EQ ; finished
SUB r3, r3, #2 * 4
MovByt50
ADDS r3, r3, #2*4-1*4 ; One whole word to do ?
BLT MovByt60
LDR r0, [ r1 ], #4
STR r0, [ r2 ], #4
GRABS "r0-r11, pc", EQ ; finished
SUB r3, r3, #1 * 4
MovByt60
ADDS r3, r3, #1*4 - 0*4 ; No more to do ?
GRABS "r0-r11, pc", EQ ; finished
LDR r0, [ r1 ] ; store remaining 1,2 or 3 bytes
MovByt70
STRB r0, [ r2 ], #1
MOV r0, r0, LSR #8
SUBS r3, r3, #1
BGT MovByt70
GRABS "r0-r11, pc" ; finished
;Initial destination not word aligned.Loop doing bytes(1,2, or 3 )until it is
MovByt100
LDRB r0, [ r1 ], #1
STRB r0, [ r2 ], #1
SUBS r3, r3, #1
GRABS "r0-r11, pc", EQ ; finished
TST r2, #3
BNE MovByt100
B MovByt20 ; Back to mainline code
MovByt200;destination now word aligned,but source isn't. just r14 stacked here
AND r12, r1, #3 ; offset
BIC r1, r1, #3 ; Align source
MOV r12, r12, LSL #3 ; rshft = 0, *, 16 or 24 only
RSB r11, r12, #32 ; lshft = 32, 24, 16 or 8 only
LDR r0, [ r1 ], #4
MOV r0, r0, LSR r12 ; Always have r0 prepared
; Quick sort out of what we've got left to do
SUBS r3, r3, #4 * 4 ; Four whole words to do (or more) ?
BLT MovByt240 ; no
SUBS r3, r3, #8*4-4*4 ; Eight whole words to do (or more) ?
BLT MovByt230 ; no
MovByt225
LDMIA r1!, { r4 - r10, r14 } ; NB. Order !
ORR r0, r0, r4, LSL r11
MOV r4, r4, LSR r12
ORR r4, r4, r5, LSL r11
MOV r5, r5, LSR r12
ORR r5, r5, r6, LSL r11
MOV r6, r6, LSR r12
ORR r6, r6, r7, LSL r11
MOV r7, r7, LSR r12
ORR r7, r7, r8, LSL r11
MOV r8, r8, LSR r12
ORR r8, r8, r9, LSL r11
MOV r9, r9, LSR r12
ORR r9, r9, r10, LSL r11
MOV r10, r10, LSR r12
ORR r10, r10, r14, LSL r11
STMIA r2!, { r0, r4 - r10 }
MOV r0, r14, LSR r12 ; keep r0 prepared
SUBS r3, r3, #8 * 4
BGE MovByt225 ; do another 8 words
CMP r3, #-8 * 4 ; Quick test
GRABS "r0-r11, pc", EQ
MovByt230
ADDS r3, r3, #8*4 - 4*4 ; Four whole words to do ?
BLT MovByt240
LDMIA r1!, { r4 - r6, r14 } ; NB. Order !
ORR r0, r0, r4, LSL r11
MOV r4, r4, LSR r12
ORR r4, r4, r5, LSL r11
MOV r5, r5, LSR r12
ORR r5, r5, r6, LSL r11
MOV r6, r6, LSR r12
ORR r6, r6, r14, LSL r11
STMIA r2!, { r0, r4 - r6 }
GRABS "r0-r11, pc", EQ
SUB r3, r3, #4*4
MOV r0, r14, LSR r12 ; keep r0 prepared
MovByt240
ADDS r3, r3, #2*4 ; Two whole words to do ?
BLT MovByt250
LDMIA r1!, { r4, r14 } ; NB. Order !
ORR r0, r0, r4, LSL r11
MOV r4, r4, LSR r12
ORR r4, r4, r14, LSL r11
STMIA r2!, { r0, r4 }
GRABS "r0-r11, pc", EQ
SUB r3, r3, #2*4
MOV r0, r14, LSR r12 ; keep r0 prepared
MovByt250
ADDS r3, r3, #2*4 - 1*4 ; One whole word to go ?
BLT MovByt260
LDR r14, [ r1 ], #4
ORR r0, r0, r14, LSL r11
STR r0, [ r2 ], #4
GRABS "r0-r11, pc", EQ
SUB r3, r3, #1*4
MOV r0, r14, LSR r12 ; keep r0 prepared
MovByt260
ADDS r3, r3, #1*4 - 0*4
GRABS "r0-r11, pc", EQ
LDR r14, [ r1 ] ; store remaining 1..3 bytes
ORR r0, r0, r14, LSL r11
MovByt270
STRB r0, [ r2 ], #1
MOV r0, r0, LSR #8
SUBS r3, r3, #1
BGT MovByt270
GRABS "r0-r11, pc"
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; -> CD_Routs
; This contains the general routines that all soft drivers may use (if they're lazy)
; Routines in here:
; cd_checkdrive
; cd_control
; cd_converttolba
; cd_converttomsf
; cd_discused
; cd_driveready
; cd_drivestatus
; cd_inquiry
; cd_lasterror
; cd_opendrawer
; cd_prefetch
; cd_readdata
; cd_readuserdata
; cd_reset
; cd_seekto
; cd_stopdisc
; cd_version
;-----------------------------------------------------------------------------------------------
cd_version ROUT
;
; on entry:
; nothing needed
; on exit:
; r0 -> version string ( word 0 = version number * 100, word 1 .. = null term. string )
;
;-----------------------------------------------------------------------------------------------
GRAB "r0-r11, r14"
ADR r0, VersionMessage
BICS pc, r14, #Overflow_Flag
VersionMessage DCD Version
= "$VString", " CD_SWI control module by Eesox", 0
ALIGN
;-----------------------------------------------------------------------------------------------
cd_lasterror ROUT
;
; on entry:
; nothing needed
; on exit:
; r0 = number of last error, or 0 if none
;
;-----------------------------------------------------------------------------------------------
GRAB "r0-r11, r14"
LDR r0, LastErrorNumber
BICS pc, r14, #Overflow_Flag
;-----------------------------------------------------------------------------------------------
cd_prefetch ROUT
;
; on entry:
; r0 = addressing mode
; r1 = block number
; r7 -> control block
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
MOV r2, #1
ADR r3, buffer + 32
MOV r4, #1 ; Allow to run on
;-----------------------------------------------------------------------------------------------
cd_readdata ROUT
;
; on entry:
; r0 = addressing mode
; r1 = block number
; r2 = number of blocks
; r3 -> where to put data
; r4 = number of bytes from each block wanted
; r7 -> control block
; r12 -> my workspace
; r13 -> full descending stack
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
; r8 = scsi device id
; r9 = card number
; r10 = lun
STASH "r0-r4"
Debug "cd_readdata",NL
01
LDMIA r7, { r8, r9, r10 }
MUL r4, r2, r4
;---------------------
; Set up the cdb block
;---------------------
MOV r5, #&28
ORR r5, r5, r10, LSL #8+5
MOV r6, r2, LSR #8 ; Number of blocks
MOV r6, r6, LSL #24 ;
AND r14, r2, #255 ;
ADR r2, buffer
STMIA r2, { r5, r6, r14 }
; R0 = address mode, R1 = address, RETURNS R1 = address
BL ConvertToLBA
;------------------
; put in start pos
;------------------
STRVCB r1, buffer + 5
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 4
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 3
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 2
;--------------------
; Do the SCSI command
;--------------------
ORRVC r0, r8, r9, LSL #3 ; card number
ORRVC r0, r0, r10, LSL #5 ; lun
ORRVC r0, r0, #escapepolloff + readdata ; prevent 'escape key'
; r1 = size of cdb
MOVVC r1, #10
; r2 -> cdb
; r3 -> put data here
; r4 = number of bytes returned
MOVVC r5, #0
MOVVC r8, #1
SWIVC XSCSI_Op
GRAB "r1-r5"
GRABS "r0-r11, pc", VC
LDR r6, [ r0 ]
;-----------------------------------------------
; If the error is 'Busy' because playing audio
; then StopDisc and try again
;-----------------------------------------------
LDR r14, =Busy
TEQ r6, r14
STASH "r1-r5", EQ
SWIEQ XCD_StopDisc
LDMEQFD r13, { r0 - r4 }
BEQ %BT01
;-----------------------------------------------
; If the error is "Illegal Request", "DataProtect" or "Blank check"
; THEN make it WrongDataMode
;-----------------------------------------------
LDR r14, =IllegalRequest
SUBS r6, r6, r14
SUBNES r6, r6, #(DataProtect - IllegalRequest)
SUBNES r6, r6, #(BlankCheck - DataProtect)
addr r0, WrongDataMode, EQ
;-----------------------------------------------
BEQ error_handler_lookup
B error_handler
;-----------------------------------------------------------------------------------------------
cd_seekto ROUT
;
; on entry:
; r0 = addressing mode
; r1 = block number
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
STASH "r0-r1"
Debug "cd_seekto",NL
01
LDMIA r7, { r8, r9, r10 }
;---------------------
; Set up the cdb block
;---------------------
MOV r4, #&2b
ORR r4, r4, r10, LSL #8+5
MOV r5, #0
MOV r6, #0
ADR r2, buffer
STMIA r2, { r4, r5, r6 }
; R0 = address mode, R1 = address, RETURNS R1 = address
BL ConvertToLBA
;------------------
; put in start pos
;------------------
STRVCB r1, buffer + 5
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 4
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 3
MOVVC r1, r1, LSR #8
STRVCB r1, buffer + 2
;--------------------
; Do the SCSI command
;--------------------
BLVC space_saver
; r1 = size of cdb
MOVVC r1, #10
; r2 -> cdb
; r4 = number of bytes returned
MOVVC r4, #0
SWIVC XSCSI_Op
GRAB "r1-r2"
GRABS "r0-r11, pc", VC
;-----------------------------------------------
; If the error is 'Busy' because playing audio
; then StopDisc and try again
;-----------------------------------------------
LDR r14, =Busy
LDR r6, [ r0 ]
TEQ r6, r14
STASH "r1-r2", EQ
SWIEQ XCD_StopDisc
LDMEQFD r13, { r0 - r1 }
BEQ %BT01
;-----------------------------------------------
B error_handler
;-----------------------------------------------------------------------------------------------
cd_inquiry ROUT
;
; on entry:
; r0 -> place to put the inquiry data
; r7 -> control block
; on exit:
;
;-----------------------------------------------------------------------------------------------
Debug "cd_enquiry",NL
; r3 -> store here
MOV r6, r0
BL space_saver
MOV r3, r6
;--------------------------------
; SCSI Inquiry command
;--------------------------------
ORR r0, r0, #escapepolloff + readdata ; prevent 'escape key'
ADR r14, cdb_inquiry
LDMIA r14, { r4, r5 }
ORR r4, r4, r10, LSL #8+5
STMIA r2, { r4, r5 }
MOV r4, #36
MOV r5, #0
SWI XSCSI_Op
BVS error_handler
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_discused ROUT
;
; on entry:
; r0 = addressing mode that the disc length should be returned in
; r1 -> storage area to put data in
; r7 -> control block
; on exit:
;
;-----------------------------------------------------------------------------------------------
; r3 -> store here
;--------------------------------
; SCSI ReadCapacity command
;--------------------------------
Debug "cd_discused",NL
BL space_saver
ORR r0, r0, #escapepolloff + readdata ; prevent 'escape key'
MOV r1, #10
MOV r4, #&25
ORR r4, r4, r10, LSL #8+5
MOV r6, #0
STMIA r2, { r4, r5, r6 }
ADR r3, buffer + 12
MOV r4, #8
SWI XSCSI_Op
BVS error_handler
;----------------------------------------------
; Convert the disc length into the correct mode
;----------------------------------------------
; get r0 and r1 original values
LDMFD r13, { r0-r11, r14 }
ADR r5, buffer + 12
LDMIA r5, { r3, r6 }
MOV r5, #255
ORR r5, r5, r5, LSL #16
AND r2, r5, r3, ROR #24 ; CHANGE REGISTER FROM MSB/LSB TO LSB/HSB
AND r4, r5, r3
ORR r2, r2, r4, ROR #8 ; R2 = number of blocks on a disc
AND r7, r5, r6, ROR #24 ; CHANGE REGISTER FROM MSB/LSB TO LSB/HSB
AND r4, r5, r6
ORR r7, r7, r4, ROR#8 ; R7 = size of a block
STR r7, [ r1, #4 ]
; If not in mode 0 then convert to other
TEQ r0, #LBAFormat
ADDNE r2, r2, #( MaxNumberOfBlocks + 1 ) * 2 + 1 ; ie point to lead out address
TEQ r0, #MSFFormat
STRNE r2, [ r1 ]
GRABS "r0-r11, pc", NE
;------------------------
; Convert from LBA to MSF
;------------------------
MOV r0, #LBAFormat
MOV r3, r1
MOV r1, r2
BL ConvertToMSF
BVS error_handler
; save the important bits in the users area
STR r1, [ r3 ]
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_driveready ROUT
;
; on entry:
; r7 -> control block
; on exit:
; r0 = 0 if drive is OK, else r0 = 1
;
;-----------------------------------------------------------------------------------------------
Debug "cd_driveready",NL
; r3 -> store here
;--------------------------------
; SCSI TestUnitReady command
;--------------------------------
BL space_saver
MOV r4, r10, LSL #8+5
STMIA r2, { r4, r5 }
MOV r4, #8
SWI XSCSI_Op
GRAB "r0-r11, r14", VC
MOVVC r0, #0
BICVCS pc, r14, #Overflow_Flag
;------------------------------------------
; If UnitAttention then update disc changed
;------------------------------------------
LDR r1, [ r0 ]
LDR r2, =UnitAttention
TEQ r2, r1
LDRNE r2, =CheckCondition
TEQNE r2, r1
BEQ error_handler
;------------------------------------------
GRAB "r0-r11, r14"
MOV r0, #1
BICS pc, r14, #Overflow_Flag
;-----------------------------------------------------------------------------------------------
cd_stopdisc ROUT
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
;
;-----------------------------------------------------------------------------------------------
Debug "cd_stopdisc",NL
;--------------------------------
; SCSI Stop disc command
;--------------------------------
BL space_saver
MOV r4, #&1b
ORR r4, r4, r10, LSL #8+5
STMIA r2, { r4, r5 }
MOV r4, #0
SWI XSCSI_Op
BVS error_handler
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_opendrawer ROUT
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
;
;-----------------------------------------------------------------------------------------------
Debug "cd_opendrawer",NL
;--------------------------------
; SCSI Start/Stop unit command
;--------------------------------
BL space_saver
MOV r4, #&1b
ORR r4, r4, r10, LSL #8+5
MOV r14, #2
STMIA r2, { r4, r14 }
MOV r4, #8
SWI XSCSI_Op
GRABS "r0-r11, pc", VC
;--------------------------------------------------
; If Illegal Request then the drawer must be locked
;--------------------------------------------------
LDR r1, [ r0 ]
LDR r2, =IllegalRequest
TEQ r1, r2
addr r0, DrawerLocked, EQ
BEQ error_handler_lookup
B error_handler
;-----------------------------------------------------------------------------------------------
cd_converttolba ROUT
; on entry:
; r0 = address mode
; r1 = address
; on exit:
; if oVerflow set then r0 -> error block
; r1 = new address
;
;-----------------------------------------------------------------------------------------------
BL ConvertToLBA
BVS error_handler
STR r1, [ r13, #4 ]
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_converttomsf ROUT
; on entry:
; r0 = address mode
; r1 = address
; on exit:
; if oVerflow set then r0 -> error block
; r1 = new address
;
;-----------------------------------------------------------------------------------------------
BL ConvertToMSF
BVS error_handler
STR r1, [ r13, #4 ]
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_drivestatus ROUT
;
; on entry:
; r7 -> control block
; on exit:
; r0 = status { 1=OK, 2=BUSY, 4=NOTREADY, 8=UNAVAILABLE }
;-----------------------------------------------------------------------------------------------
Debug "cd_drivestatus",NL
; r3 -> store here
;--------------------------------
; SCSI TestUnitReady command
;--------------------------------
BL space_saver
MOV r4, r10, LSL #8+5
STMIA r2, { r4, r5 }
MOV r4, #8
SWI XSCSI_Op
;---------------
; Everything OK
;---------------
GRAB "r0-r11, r14", VC
MOVVC r0, #1
BICVCS pc, r14, #Overflow_Flag
;---------------------
; What error occured ?
;---------------------
LDR r1, [ r0 ]
; Not ready
LDR r14, =NotReady
SUBS r14, r1, r14
SUBNES r14, r14, #&201d0 - NotReady ; Unknown error
GRAB "r0-r11, r14", EQ
MOVEQ r0, #4
BICEQS pc, r14, #Overflow_Flag
; Busy
LDR r14, =Busy
TEQ r1, r14
LDRNE r14, =NoSense
TEQNE r1, r14
GRAB "r0-r11, r14", EQ
MOVEQ r0, #2
BICEQS pc, r14, #Overflow_Flag
; No drive - unavailable
LDR r14, =TimeoutSelection
TEQ r1, r14
GRAB "r0-r11, r14", EQ
MOVEQ r0, #8
BICEQS pc, r14, #Overflow_Flag
;-----------------
; Some other error
;-----------------
B error_handler
;-----------------------------------------------------------------------------------------------
cd_control ROUT
;
; on entry:
; r0 = 0, 1 or 2 to set the level of error response
; r7 -> control block
; on exit:
; usual error stuff
;-----------------------------------------------------------------------------------------------
;--------------------
; Only 0 to 2 allowed
;--------------------
CMP r0, #2
addr r0, InvalidParameter, CS
BCS error_handler_lookup
MOV r2, r0
LDMIA r7, { r1, r3, r8 }
ORR r1, r1, r3, LSL #3
ORR r1, r1, r8, LSL #5
MOV r0, #4
MOV r8, #accesskey
SWI XSCSI_Control
BVS error_handler
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_reset ROUT
;
; on entry:
; r7 -> control block
; on exit:
; if error then r0-> error block, else all regs preserved
;
;-----------------------------------------------------------------------------------------------
LDMIA r7, { r1, r2, r3 }
ORR r1, r1, r2, LSL #3
ORR r1, r1, r3, LSL #5
MOV r0, #1
MOV r8, #1
SWI XSCSI_Initialise
BVS error_handler
GRABS "r0-r11, pc"
;-----------------------------------------------------------------------------------------------
cd_checkdrive ROUT
;
; on entry:
; r7 -> control block
; on exit:
; usual error stuff
; r0 = drive status bits
;-----------------------------------------------------------------------------------------------
Debug "cd_checkdrive",NL
;--------------------------------
; SCSI SendDiagnostics command
;--------------------------------
BL space_saver
MOV r4, #&1d
ORR r4, r4, r10, LSL #8+5
ORR r4, r4, #1:SHL:10
STMIA r2, { r4, r5 }
MOV r4, #0
SWI XSCSI_Op
;-------------------------
; Is it a hardware error ?
;-------------------------
TEQVC r0, r0
LDRVS r1, [ r0 ]
LDRVS r2, =HardwareError
TEQVS r1, r2
BNE error_handler ; [ no ]
;-------------------------
GRAB "r0-r11, r14"
MOVVC r0, #0
MOVVS r0, #15
BICS pc, r14, #Overflow_Flag
;-----------------------------------------------------------------------------------------------
cd_readuserdata ROUT
;
; The purpose of this call: is to load just user data from mode 2 form 1 or 2 blocks. This
; part will also work out if it is possible to use a 'complex' scatter list method to improve
; performance.
;
; on entry:
; r0 = addressing mode (0, 1 or 2)
; r1 = start block
; r2 = number of bytes to load (also indicates size of 'r3' buffer)
; r3 -> put data here
; r4 = byte offset in start block to start from
; r7 -> control block
; on exit:
; usual error stuff
; r1 = last block loaded
; r4 = byte offset in last block of next byte
;-----------------------------------------------------------------------------------------------
;---------------------------------------------
; Does this SCSI card support scatter lists ?
;---------------------------------------------
B cd_readuserdata_plain
;---------------------------------------------
; Convert block to logical block address
;---------------------------------------------
; BL ConvertToLBA
; BVS error_handler
;-----------------------------------------------------------------------------------------------
cd_readuserdata_plain ROUT
;
; The purpose of this call: is to load just user data from mode 2 form 1 or 2 blocks. This
; 'plain' method will use normal CD_ReadData commands. SCSI and non-SCSI drives should work
; this way.
;
; on entry:
; r0 = addressing mode
; r1 = start block
; r2 = number of bytes to load (also indicates size of 'r3' buffer)
; r3 -> put data here
; r4 = byte offset in start block to start from
; r7 -> control block
; on exit:
; usual error stuff
; r1 = last block loaded
; r4 = byte offset in last block of next byte
;-----------------------------------------------------------------------------------------------
;---------------------------------------------
; Convert block to logical block address
;---------------------------------------------
BL ConvertToLBA
BVS error_handler
[ debug=ON
Debug "StartBlock = &"
MOV r6, r1
DebugDisplay r6
SWI XOS_NewLine
Debug "StartByte = &"
DebugDisplay r4
SWI XOS_NewLine
Debug "NBytes = &"
DebugDisplay r2
SWI XOS_NewLine
]
MOV r6, r4
MOV r4, r1
MOV r5, r3
; r0 =
; r1 =
; r2 = number of bytes to load
; r3 =
; r4 = block
; r5 -> memory
; r6 = byte offset in first block
; r7 -> control block
; Alogorithm:
; REPEAT
; work out number of blocks that can be loaded
; load the number of blocks
; shuffle blocks
; UNTIL <= 1 block left to load
;
; Load last block into my buffer
; Copy out last bytes
RUDP_Repeat
;----------------------
; REPEAT
;----------------------
;------------------------------------------------------------------
; work out number of bytes storage space available
;------------------------------------------------------------------
MOV r10, r2
;------------------------------------------------------------------
; work out number of blocks that can be loaded
;------------------------------------------------------------------
LDR r9, =mode2datasize
DivRem r8, r10, r9, r14
TEQ r8, # 0
BEQ RUDP_LastBlock
;------------------------------------------------------------------
; load the number of blocks
;------------------------------------------------------------------
; r0 = addressing mode
; r1 = block number
; r2 = number of blocks
; r3 -> where to put data
; r4 = number of bytes from each block wanted
; r7 -> control block
STASH "r1 - r5"
MOV r0, # LBAFormat
MOV r1, r4
MOV r2, r8
MOV r3, r5
LDR r4, =mode2datasize
SWI XCD_ReadData
GRAB "r1 - r5"
BVS error_handler
;------------------------------------------------------------------
; shuffle blocks
;------------------------------------------------------------------
; r0 =
; r1 = memory to copy from
; r2 = memory to copy to
; r3 = USERDATA_MODE2FORM2
; r4 = block
; r5 -> memory to copy to
; r6 = number of blocks left to shuffle
; r7 -> control block
; r8 = mode2datasize
; r9 = number of bytes loaded
; r10 = byte offset in first block
STASH "r0-r4, r6-r8, r10"
MOV r10, r6
MOV r6, r8
LDR r8, =mode2datasize
ADD r1, r5, # MODE2__TOTALHEADERSIZE
ADD r1, r1, r10
MOV r2, r5
MOV r9, # 0
RUDP_ShuffleBlocks
MOV r4, # USERDATA__MODE2FORM1
; Is the data in mode 2 form 2 ?
SUB r14, r1, r10
LDRB r14, [ r14, # (MODE2__HEADER_SIZE + MODE2__SUB_HEADER_SUBMODE) - MODE2__TOTALHEADERSIZE ]
TST r14, # SUBMODE__FORM
ADDNE r4, r4, # USERDATA__MODE2FORM2 - USERDATA__MODE2FORM1
SUB r3, r4, r10
BL cd_bytecopyinternal
ADD r1, r1, r8
SUB r1, r1, r10
ADD r2, r2, r3
; count number of bytes copied
ADD r9, r9, r3
MOV r10, # 0
SUBS r6, r6, # 1
BGT RUDP_ShuffleBlocks
MOV r5, r2
GRAB "r0-r4, r6-r8, r10"
MOV r6, # 0
; r0 = drive number
; r1 =
; r2 = number of blocks
; r3 =
; r4 = block
; r5 -> memory
; r6 = byte offset in block to start from (0 at the moment)
; r7 -> control block
Debug " CopiedLots = &"
DebugDisplay r9
ADD r4, r4, r8
SUB r2, r2, r9
;------------------------------------------------------------------
; UNTIL <= 1 block left to load
;------------------------------------------------------------------
LDR r14, =mode2datasize
CMP r2, r14
BGT RUDP_Repeat
;------------------------------------------------------------------
; Load last block into my buffer
;------------------------------------------------------------------
RUDP_LastBlock
;------------------------------------------------------------------
; Copy out last bytes
;------------------------------------------------------------------
STASH "r0-r4"
CLV
MOVS r9, r2
MOV r0, # LBAFormat
MOV r1, r4
MOV r2, # 1
ADR r3, buffer
LDR r4, =mode2datasize
; r0 = addressing mode
; r1 = block number
; r2 = number of blocks
; r3 -> where to put data
; r4 = number of bytes from each block wanted
; r7 -> control block
SWIGT XCD_ReadData
BVS error_handler
; r1 = memory to copy from (buffer + 12 + byte offset)
ADR r1, buffer + MODE2__TOTALHEADERSIZE
; r2 = memory to copy to
MOV r2, r5
MOV r14, # USERDATA__MODE2FORM1
; Is the data in mode 2 form 2 ?
LDRB r3, [ r1, # (MODE2__HEADER_SIZE + MODE2__SUB_HEADER_SUBMODE) - MODE2__TOTALHEADERSIZE ]
TST r3, # SUBMODE__FORM
ADDNE r14, r14, # USERDATA__MODE2FORM2 - USERDATA__MODE2FORM1
SUB r14, r14, r6
ADD r1, r1, r6
CMP r9, r14
MOVGT r9, r14
; r3 = 2324 - byte offset, or bytes left to copy, whichever is smaller
MOVS r3, r9
ADD r5, r5, r3
BLGT cd_bytecopyinternal
GRAB "r0-r4"
SUBS r2, r2, r9
MOVGT r6, # 0
ADDGT r4, r4, # 1
BGT RUDP_LastBlock
; return values
; r1 = last block loaded
; r4 = byte offset in last block of next byte
ADDS r9, r9, r6
LDR r14, =USERDATA__MODE2FORM2
MOVEQ r9, r14
CMP r9, r14
MOVGE r9, # 0
ADDGE r4, r4, # 1
ADDLT r9, r9, # 1
STR r9, [ r13, # 4*4 ]
STR r4, [ r13, # 4*1 ]
[ debug=ON
SWI XOS_NewLine
SWI XOS_NewLine
]
GRAB "r0-r11, r14"
BICS pc, r14, #Overflow_Flag
;-----------------------------------------------------------------------------------------------
cd_seekuserdata ROUT
;
; The purpose of this call is to find where a particular byte of user data starts in a
; consecutive number of mode 2 form 1 or 2 blocks. The drive is not expected to seek or load
; any information, just report at what block, and what offset the byte occurs. This will try
; to use a SCSI scatter list to improve performance.
;
; on entry:
; r0 = addressing mode (0, 1 or 2)
; r1 = start block (starting from byte 0 of this block)
; r2 = byte offset to search for (first position is 0)
; r7 -> control block
; on exit:
; usual error stuff
; r1 = block found at (in addressing mode of r0 on entry)
; r2 = byte offset in block
; all other registers preserved
;-----------------------------------------------------------------------------------------------
;---------------------------------------------
; Does this SCSI card support scatter lists ?
;---------------------------------------------
B cd_seekuserdata_plain
;---------------------------------------------
; Convert block to logical block address
;---------------------------------------------
; BL ConvertToLBA
; BVS error_handler
;-----------------------------------------------------------------------------------------------
cd_seekuserdata_plain ROUT
;
; The purpose of this call is to find where a particular byte of user data starts in a
; consecutive number of mode 2 form 1 or 2 blocks. The drive is not expected to seek or load
; any information, just report at what block, and what offset the byte occurs. Being 'plain'
; it has to make do with current CD_ SWIs so that SCSI and non-SCSI commands work.
;
; on entry:
; r0 = addressing mode (0, 1 or 2)
; r1 = start block (starting from byte 0 of this block)
; r2 = byte offset to search for (first position is 0)
; r7 -> control block
; on exit:
; usual error stuff
; r1 = block found at (in addressing mode of r0 on entry)
; r2 = byte offset in block
; all other registers preserved
;-----------------------------------------------------------------------------------------------
;---------------------------------------------
; Convert block to logical block address
;---------------------------------------------
BL ConvertToLBA
BVS error_handler
;-------------------------------------------------------------------
; Byte offset of less than 2048 means it must be in the first block
;-------------------------------------------------------------------
CMP r2, # USERDATA__MODE2FORM1
GRAB "r0-r11, r14", LT
BICLTS pc, r14, #Overflow_Flag
;---------------------------------------------
; Assume mode 2 form 2 ?
;---------------------------------------------
LDR r3, =USERDATA__MODE2FORM2
DivRem r4, r2, r3, r14
ADD r1, r1, r4
; r0 = addressing format
; r1 = block
; r2 = byte offset
TEQ r0, # MSFFormat
MOVEQ r0, # LBAFormat
BLEQ ConvertToMSF
TEQ r0, # PBFormat
ADDEQ r1, r1, # 75*2
STR r1, [ r13, # 4*1 ]
STR r2, [ r13, # 4*2 ]
GRAB "r0-r11, r14"
BICS pc, r14, #Overflow_Flag
;-----------------------------------------------------------------------------------------------
; Routine to load default values and save space
;-----------------------------------------------------------------------------------------------
space_saver ROUT
LDMIA r7, { r8, r9, r10 }
ORR r0, r8, r9, LSL #3 ; card number
ORR r0, r0, r10, LSL #5 ; lun
ORR r0, r0, #escapepolloff + nodata ; prevent 'escape key'
MOV r1, #6
ADR r2, buffer
MOV r3, #0
MOV r5, #0
MOV r8, #1
MOV pc, r14
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------
END
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
;----------------------------------------------------------------------------------------------
; Convert addressing modes
;----------------------------------------------------------------------------------------------
; IF addressmode = LBAFormat THEN EXIT ( already done )
; IF addressmode = PBFormat THEN address = address - 2 seconds of data
; IF addressmode = MSFFormat THEN change address to minute,second,frame
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
ConvertToLBA ROUT
; on entry:
; r0 = address mode
; r1 = address
; on exit:
; if oVerflow set then r0 -> error block
; r1 = new address
;
; Errors can occur, eg/ invalid mode number
; When this is called, 'address' should contain the address on the disc
; in whatever format is being used. 'addressmode' should contain the number
; of the type of addressing being used. Eg LBAFormat, MSFFormat, PBFormat
;
;----------------------------------------------------------------------------------------------
BIC r14, r14, #Overflow_Flag
;--------------------------------------------------
; If already in LBA format then exit straight away
;--------------------------------------------------
TEQ r0, #LBAFormat
MOVEQS pc, r14
STASH "r0, r2 - r5, r14"
;--------------------------------------------------
; Check for allowable addressing mode
;--------------------------------------------------
CMP r0, #3
GRAB "r0, r2 - r5, r14", CS
addr r0, InvalidFormat, CS
ORRCSS pc, r14, #Overflow_Flag
;--------------------------------------------------
; Branch to routines to convert from each mode to LBA
;--------------------------------------------------
; R0 = address mode
; R1 = address
TEQ r0, #1
BEQ ChangeFromMSFFormat
;--------------------------------------------------
; Change from Physical Block TO Logical Block Address
; Subtract 2 seconds worth of blocks to give LBA
;--------------------------------------------------
ChangeFromPBFormat
SUBS r1, r1, #( MaxNumberOfBlocks + 1 ) * 2
GRAB "r0, r2 - r5, r14", LT
addr r0, PhysicalBlockError, LT
ORRLTS pc, r14, #Overflow_Flag
GRABS "r0, r2 - r5, pc"
;----------------------------------------------------------------------------------------------
; Change Minutes, Seconds, Frame TO LBA
ChangeFromMSFFormat ; R1 = address, RETURNS R1 = address
;----------------------------------------------------------------------------------------------
; R1 = address
;-----------------------------------------
; R3 = frames
;-----------------------------------------
MOV r14, #255
AND r3, r1, r14
;-----------------------------------------
; R4 = seconds
;-----------------------------------------
AND r4, r14, r1, LSR #8
;-----------------------------------------
; R5 = minutes
;-----------------------------------------
AND r5, r14, r1, LSR #16
;-----------------------------------------
; Make sure that seconds are ( 0 - 59 )
;-----------------------------------------
CMP r4, #MaxNumberOfSeconds + 1
GRAB "r0, r2 - r5, r14", CS
addr r0, BadSeconds, CS
ORRCSS pc, r14, #Overflow_Flag
;-----------------------------------------
; Make sure that frames are ( 0 - 74 )
;-----------------------------------------
CMP r3, #MaxNumberOfBlocks + 1
GRAB "r0, r2 - r5, r14", CS
addr r0, BadBlocks, CS
ORRCSS pc, r14, #Overflow_Flag
;-----------------------------------------
; minutes = minutes * 60 + seconds
;-----------------------------------------
MOV r14, r5, LSL #6 ; R14 = minutes * 64
SUB r5, r14, r5, LSL #2 ; R5 = R14 - ( minutes * 4 )
ADD r5, r5, r4
;-----------------------------------------
; minutes = minutes * 75 + blocks
;-----------------------------------------
MOV r14, #MaxNumberOfBlocks + 1
MLA r5, r14, r5, r3
;-----------------------------------------
; minutes = minutes - 2 seconds
;-----------------------------------------
SUB r1, r5, #( MaxNumberOfBlocks + 1 ) * 2
;-----------------------------------------
GRABS "r0, r2 - r5, pc"
;----------------------------------------------------------------------------------------------
ConvertToMSF ROUT
; Convert from LBA or PB to MSF format
; IF addressmode = MSFFormat THEN EXIT ( already done )
;
; IF addressmode = LBAFormat THEN ...
;
;
; on entry:
; r0 = address mode
; r1 = address
;
; on exit:
; if oVerflow clear THEN r1 = new address ELSE r0->error block
;
; flags preserved
;----------------------------------------------------------------------------------------------
BIC r14, r14, #Overflow_Flag
;-----------------------------------------
; If already in MSF format then exit straight away
;-----------------------------------------
TEQ r0, #MSFFormat
MOVEQS pc, r14
STASH "r0, r2 - r5, r14"
;-----------------------------------------
; Check for allowable addressing mode
;-----------------------------------------
CMP r0, #3
GRAB "r0, r2 - r5, r14", CS
addr r0, InvalidFormat, CS
ORRCSS pc, r14, #Overflow_Flag
;-----------------------------------------
; Branch to routines to convert from each mode to MSF
;-----------------------------------------
; r0 = address mode
; r1 = address
TEQ r0, #0
BEQ ConvertLBAtoMSF
;-----------------------------------------
ConvertPBtoMSF
; R1 = address
;-----------------------------------------
; address = address - 150 ( error if < 0 )
SUBS r1, r1, #( MaxNumberOfBlocks + 1 ) * 2
GRAB "r0, r2 - r5, r14", LT
addr r0, BadSeconds, LT
ORRLTS pc, r14, #Overflow_Flag
;-----------------------------------------
ConvertLBAtoMSF
; R1 = address
;-----------------------------------------
; R3 = Frames
; R4 = seconds
; R5 = minutes
;-----------------------------------------
; Frame = address MOD ( MaxNumberOfBlocks + 1 )
; R3 = R3 MOD ( MaxNumberOfBlocks + 1 )
;-----------------------------------------
;-----------------------------------------
; Seconds = ( address DIV 75 ) MOD 60
; R4
;-----------------------------------------
MOV r3, r1 ; r2 = address DIV 75
;
DivRem r2, r3, #MaxNumberOfBlocks + 1, r14 ; r3 = address MOD 75
DivRem r4, r2, #MaxNumberOfSeconds + 1, r14 ; r4 = r2 DIV 60
;
; r2 = r2 MOD 60
; R4 = minutes
; R3 = frames
; R2 = seconds
;-----------------------------------------
; Push results together into one word
; Minutes << 16 + Seconds << 8 + Frames
;-----------------------------------------
ORR r3, r3, r2, LSL #8
ORR r1, r3, r4, LSL #16
GRABS "r0, r2 - r5, pc"
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment