home *** CD-ROM | disk | FTP | other *** search
-
- SpriteOps a FORTRAN SpriteOps subroutine library. 18 Nov 1991
-
- ************************************************************************
- C O P Y R I G H T N O T I C E
-
- Copyright D.J & K.M. Crennell,
- P.O. Box 64, Didcot, Oxon, OX11 0TH.
-
- This software is in the Public Domain and may not be sold or included in any
- program that will be sold, without written permission from the authors.
-
- The authors must be given credit in any publications using this software.
-
- The software may be copied and distributed as long as no changes are made
- and this copyright notice is included. Please send any suggested
- improvements to the authors.
-
- In no circumstances shall the authors be liable for any damage, loss of
- profits, or any indirect or consequential loss arising out of the use of
- this software or inability to use this software, even if they have been
- advised of the possibility of such loss.
-
- The authors do their best to ensure that this library is distributed virus
- free.
- ************************************************************************
-
- The source of this library is assembler, and is not included.
- The library is %.lib.SpriteOp
-
- Notes:
- 1. These emulate the OS_SpriteOp n commands (SWI &2E), which all have
- different numbers of arguments, so a separate routine is included for each
- one e.g. for OS_SpriteOp 9 use SPOP09 and OS_SpriteOp 24 use SPOP24
-
- 2. The routines may be used as LOGICAL FUNCTIONS, in which case they
- return .TRUE. if there is an error, .FALSE. if no error. They can also be
- called as SUBROUTINEs when errors can be detected by including a special
- return in the subroutine call of the form: *label
- (e.g. CALL SPOP02('FILE',0,*990) will GOTO 990 on an error)
- Details of the error can be found by calling subroutine SPOPER.
-
- 3. All variables are INTEGERS, except for sprite and file names which are
- CHARACTER. E.g. 'SNAME' in this document.
-
- 4. Sprites are stored either in a user area, or in the system area. The
- routines decide which one to use by looking at the contents of the first
- word of the sprite area ISTOR:
- =0, system area;
- >0, user area (when it will add 256 to the SpriteOp number).
- Sprites in the system area must be called by name (CHARACTER).
- Sprites in a user area may be called by name (CHARACTER) or address
- (INTEGER) when the routine adds another 256 (512 in all) to the Op code.
- (See page 383 P.R.M.).
- The sprite addresses are found using SpriteOps 14, 16 & 24.
-
- ******************************
-
- SPOP02(FILENM,IPAL) (page 395 P.R.M.)
- Screen save to file 'FILENM' with the palette if IPAL =1, or without if
- IPAL =0
-
- SPOP03(FILENM) (page 396 P.R.M.)
- Screen load from file 'FILENM', changing mode and palette to that of the
- file.
-
- SPOP08(ISTOR,ISPSIZ,NSPRIT,ISPR1,IFREE) (page 397 P.R.M.)
- Finds the characteristics of the sprite area ISTOR. Results are:
- ISPSIZ: size of sprite area (bytes)
- NSPRIT: number of sprites
- ISPR1 : offset to first sprite (bytes)
- IFREE : offset to first free area
-
- SPOP09(ISTOR) (page 398 P.R.M.)
- Initialises the array ISTOR as a sprite area. ISTOR must be a large enough
- array with word 1 containing the area size in bytes, and word 3 equal to 16
- (start of sprite storage).
-
- SPOP10(ISTOR,FILENM) (page 399 P.R.M.)
- Loads the sprite area ISTOR from the file 'FILENM'
-
- SPOP11(ISTOR,FILENM) (page 400 P.R.M.)
- Merges the sprite area from the file 'FILENM' onto the sprite area in ISTOR.
-
- SPOP12(ISTOR,FILENM) (page 401 P.R.M.)
- Saves the sprite area ISTOR to the file 'FILENM'
-
- SPOP13(ISTOR,ISPRIT,SNAME,LENGTH) (page 402 P.R.M.)
- Finds the 'SNAME' of the ISPRITth sprite in the area ISTOR. The character
- string returned has length LENGTH.
-
- SPOP14(ISTOR,SNAME,IPAL,ISADD) (page 403 P.R.M.)
- Defines the sprite 'SNAME' in area ISTOR to be the part of the screen
- defined by the recangle from the old to the current cursor positions.
- If IPAL =0 no palette data stored; if =1, stores palette data.
- Returns the sprite address in ISADD
-
- SPOP15(ISTOR,SNAME,IPAL,IWID,IHITE,MODE) (page 404 P.R.M.)
- Reserve space for the sprite named 'SNAME' in array ISTOR.
- If IPAL =0 no palette data stored; if =1, stores palette data.
- IWID,IHITE are the width and height of the sprite in pixels
- MODE is the MODE to be used for this sprite
-
- SPOP16(ISTOR,SNAME,IPAL,IX1,IY1,IX2,IY2,ISADD) (page 405 P.R.M.)
- Defines the sprite 'SNAME' in area ISTOR to be the part of the screen
- defined by the recangle from (IX1,IY1) to (IX2,IY2), where IX1,IY1 are less
- than IX2,IY2.
- If IPAL =0 no palette data stored; if =1, stores palette data.
- Returns the sprite address in ISADD
-
- SPOP24(ISTOR,SNAME,ISADD) (page 406 P.R.M.)
- Selects the sprite 'SNAME' in array ISTOR for plotting. Returns the sprite
- address in ISADD.
-
- SPOP25(ISTOR,SNAME) (page 407 P.R.M.)
- Deletes sprite 'SNAME' from area ISTOR
-
- SPOP26(ISTOR,SNAME,SNNEW) (page 408 P.R.M.)
- Renames the sprite 'SNAME' in area ISTOR as 'SNNEW'. (N.B. these names can
- not be addresses as in note 4)
-
- SPOP27(ISTOR,SNAME,SNNEW) (page 409 P.R.M.)
- Copies the sprite 'SNAME' in area ISTOR to 'SNNEW'. (N.B. these names can
- not be addresses as in note 4)
-
- SPOP28(ISTOR,SNAME,IACT) (page 410 P.R.M.)
- Plots sprite 'SNAME in area ISTOR at graphics cursor. IACT is similar to
- the 1st argument of GCOL, but must be set to 8 to use the mask while
- plotting.
-
- SPOP29(ISTOR,SNAME) (page 412 P.R.M.)
- Creates a mask for sprite 'SNAME' in area ISTOR. Initially all the pixels
- are set opaque.
-
- SPOP30(ISTOR,SNAME) (page 413 P.R.M.)
- Deletes the mask for sprite 'SNAME' in area ISTOR.
-
- SPOP31(ISTOR,SNAME,IROW) (page 414 P.R.M.)
- Inserts a row of colour zero at IROW in the sprite 'SNAME' in area ISTOR.
- All rows above it are shifted up.
-
- SPOP32(ISTOR,SNAME,IROW) (page 415 P.R.M.)
- Deletes the row at IROW in the sprite 'SNAME' in area ISTOR. All rows below
- it are shifted down.
-
- SPOP33(ISTOR,SNAME) (page 416 P.R.M.)
- Flips the sprite 'SNAME' in area ISTOR about its X-axis.
-
- SPOP34(ISTOR,SNAME,IX,IY,IACT) (page 417 P.R.M.)
- Plots sprite named 'SNAME' from area ISTOR at graphics co-ordinates IX,IY
- IACT is similar to the 1st argument of GCOL, but must be set to 8 to use
- the mask while plotting.
-
- SPOP35(ISTOR,'SNAM1','SNAM2',IHORIZ) (page 419 P.R.M.)
- Adds the sprite 'SNAM2' to 'SNAM1' in area ISTOR. 'SNAM2' is then deleted.
- If IHORIZ is 0, 'SNAM2' is added to the right of 'SNAM1'.
- If IHORIZ is 1, 'SNAM2' is added below 'SNAM1'.
- The two sprites must be of the same height (or width) if IHORIZ is 0 (1).
-
- SPOP36(ISTOR,SNAME,IBITS,IX,IY,ISCALE,IPXTR) (page 421 P.R.M.)
- Sets the pointer shape from sprite 'SNAME' in area ISTOR.
- IBITS - a word of bits (0 to 6)specifying the functionality:
- 0-3 pointer shape number (currently in range 1 to 4)
- 4 if clear, set the pointer shape data
- 5 if clear, set the palette from the sprite
- 6 if clear, program the pointer shape number
- (IX,IY) give the offset to the active point from the origin of the sprite.
- ISCALE may be zero when the natural size is taken, or it is an array of 4
- integers specifying the scale factors:
- 1 multiplier for X
- 2 multiplier for Y
- 3 divider for X
- 4 divider for Y
- IPXTR is a BYTE array which allows logical colours to be used when plotting
- the sprite. Pixel of colour N in the sprite is translated to the colour
- given by the Nth byte in IPXTR.
-
- SPOP40(ISTOR,SNAME,IWIDTH,IHITE,MASK,MODE) (page 423 P.R.M.)
- Gets sprite information of sprite 'SNAME' in area ISTOR. returns:
- IWIDTH,IHITE give the size in pixels
- MASK is 0 for no mask, 1 for mask
- MODE is the defined graphics mode.
-
- SPOP41(ISTOR,SNAME,IX,IY,ICOL,ITINT) (page 424 P.R.M.)
- Reads the colour of the pixel at (IX,IY) for sprite 'SNAME' in area ISTOR
- into ICOL and ITINT (ITINT will be set to zero for <256 colour modes).
-
- SPOP42(ISTOR,SNAME,IX,IY,ICOL,ITINT) (page 425 P.R.M.)
- Sets the pixel IX,IY of sprite 'SNAME' in area ISTOR to the colour ICOL
- (and ITINT for 256 colour modes).
-
- SPOP43(ISTOR,SNAME,IX,IY,MASK) (page 426 P.R.M.)
- Reads the state of the mask at pixel (IX,IY) for sprite 'SNAME' in area
- ISTOR into MASK. (MASK =0 is transparent, =1 is solid)
-
- SPOP44(ISTOR,SNAME,IX,IY,IMASK) (page 427 P.R.M.)
- Sets mask pixel (IX,IY) to transparent when IMASK is 0, opaque when 1
-
- SPOP45(ISTOR,SNAME,ICOLM) (page 428 P.R.M.)
- Inserts a column of colour zero at ICOLM in the sprite 'SNAME' in area
- ISTOR. All columns to the right of it are shifted.
-
- SPOP46(ISTOR,SNAME,ICOLM) (page 429 P.R.M.)
- Deletes the column at ICOLM in the sprite 'SNAME' in area ISTOR. All
- columns beyond it are shifted back.
-
- SPOP47(ISTOR,SNAME) (page 430 P.R.M.)
- Flips the sprite 'SNAME' in ISTOR about its Y-axis.
-
- SPOP48(ISTOR,SNAME) (page 431 P.R.M.)
- Plots the mask of sprite 'SNAME' in area ISTOR at the graphics cursor
- position with the background colour and action.
-
- SPOP49(ISTOR,SNAME,IX,IY) (page 432 P.R.M.)
- Plots the mask of sprite 'SNAME' in area ISTOR at the position (IX,IY) with
- the background colour and action.
-
- SPOP50(ISTOR,SNAME,IX,IY,ISCALE) (page 433 P.R.M.)
- Plots the scaled mask of sprite 'SNAME' in area ISTOR at the position
- (IX,IY) with the background colour and action. If you don't want it scaled,
- use SPOP49.
- ISCALE is an array of 4 integers specifying the scale factors:
- 1 multiplier for X
- 2 multiplier for Y
- 3 divider for X
- 4 divider for Y
-
- SPOP51(ICHAR,IX,IY,ISCALE) (page 434 P.R.M.)
- Plots the ASCII character ICHAR scaled at the position (IX,IY)
- ISCALE is an array of 4 integers specifying the scale factors:
- 1 multiplier for X
- 2 multiplier for Y
- 3 divider for X
- 4 divider for Y
-
- SPOP52(ISTOR,SNAME,IX,IY,IACT,ISCALE,IPXTR) (page 435 P.R.M.)
- Plots scaled sprite named 'SNAME' from area ISTOR at graphics co-ordinates
- IX,IY IACT is similar to the 1st argument of GCOL, but must be set to 8 to
- use the mask while plotting.
- ISCALE is an array of 4 integers specifying the scale factors:
- 1 multiplier for X
- 2 multiplier for Y
- 3 divider for X
- 4 divider for Y
- IPXTR is a BYTE array which allows logical colours to be used when plotting
- the sprite. Pixel of colour N in the sprite is translated to the colour
- given by the Nth byte in IPXTR.
-
- SPOP53(ISTOR,SNAME,IX,IY,ISCALE,IPXTR) (page 437 P.R.M.)
- Plots scaled sprite named 'SNAME' from area ISTOR at graphics co-ordinates
- IX,IY. Anti-aliasing is performed on the sprite as it is scaled, and the
- colours of the pixels must lie on a linear grey scale. Note: this can be
- quite slow.
- ISCALE is an array of 4 integers specifying the scale factors:
- 1 multiplier for X
- 2 multiplier for Y
- 3 divider for X
- 4 divider for Y
- IPXTR is a BYTE array which allows logical colours to be used when plotting
- the sprite. Pixel of colour N in the sprite is translated to the colour
- given by the Nth byte in IPXTR.
-
- SPOP54(ISTOR,SNAME) (page 439 P.R.M.)
- Removes the left hand wastage from the sprite 'SNAME' in area ISTOR.
-
- SPOP60(ISTOR,SNAME,ISAVE,IREGS) (page 440 P.R.M.)
- Switches VDU output to the selected sprite 'SNAME' in ISTOR. The register
- values are returned in IREGS(1:4) so that they can be used later with NPOP60
- to go back to the previous state e.g. normally VDU commands output to the
- screen.
- ISAVE detemines how/if the vdu parameters of the screen are to be saved:
- 0: not saved (the state of the screen will be lost, e.g. graphics
- cursor position, windows etc.).
- 1: use the system area (do not use this option, see page 440 PRM)
- other: ISAVE is an array of length at least that given in bytes by SPOP62.
-
- Note: There are 2 routines for OS_SpriteOp 60, NPOP60 restores the previous
- output state.
-
- NPOP60(IREGS)
- Resets the VDU output to that given by the arguements (see SPOP60)
-
- SPOP61(ISTOR,SNAME,ISAVE,IREGS) (page 442 P.R.M.)
- Switches VDU output to the selected mask of sprite 'SNAME' in ISTOR. The
- register values are returned in IREGS(1:4) so that they can be used later
- with NPOP60 to go back to the previous state e.g. normally VDU commands
- output to the screen.
- ISAVE detemines how/if the vdu parameters of the screen are to be saved:
- 0: not saved (the state of the screen will be lost, e.g. graphics
- cursor position, windows etc.).
- 1: use the system area (do not use this option, see page 440 PRM)
- other: ISAVE is an array of length at least that given in bytes by SPOP62.
-
- SPOP62(ISTOR,SNAME) (page 444 P.R.M.)
- Finds the size of the save area (in BYTES) of sprite 'SNAME' in area ISTOR
- which is needed in sprite_ops 60 and 61 when a user ISAVE array is used.
-
- SPOPER(IERR,ERRTXT,LENTXT)
- If there is an error (detected by one of the SPOP functions returning .TRUE.)
- this subroutine will return the error number (IERR) and LENTXT characters of
- text in 'ERRTXT'. If the CHARACTER size of 'ERRTXT' is too small for the
- whole message, it will be truncated.
-