Home » Archimedes archive » Archimedes World » AW-1992-09.adf » AWSept92 » !AWSept92/Goodies/Work/c/system

!AWSept92/Goodies/Work/c/system

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1992-09.adf » AWSept92
Filename: !AWSept92/Goodies/Work/c/system
Read OK:
File size: 0532 bytes
Load address: 0000
Exec address: 0000
File contents
/*********************************************************************/
/*                                                                   */
/*  Wimp Routine Library.         General System Calls.              */
/*                                                                   */
/*  Archimedes World 1992                                            */
/*                                                                   */
/*  Written By John Skingley.                                        */
/*                                                                   */
/*********************************************************************/

#include "h.global"
#include "h.swi"
#include "h.swios"


void Beep( void )
{
/*  Issues a 'bell' command.  */

    int  regs[10];

    regs[0] = 7;

    Swi( OS_WriteC, regs );
}


void PixelsToScreenX( int *width, int mode )
{
/*  Converts integer 'width' to screen pixels, according to screen mode. */

    int regs[10];

    regs[0] = mode;
    regs[1] = 4;

    Swi( OS_ReadModeVariable, regs );

    *width <<= regs[2];
}


void PixelsToScreenY( int *height, int mode )
{
/*  Converts integer 'height' to screen pixels, according to screen mode. */

    int regs[10];

    regs[0] = mode;
    regs[1] = 5;

    Swi( OS_ReadModeVariable, regs );

    *height <<= regs[2];
}


00000000  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2f 0a  2f 2a 20 20 20 20 20 20  |******/./*      |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000080  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
00000090  2f 2a 20 20 57 69 6d 70  20 52 6f 75 74 69 6e 65  |/*  Wimp Routine|
000000a0  20 4c 69 62 72 61 72 79  2e 20 20 20 20 20 20 20  | Library.       |
000000b0  20 20 47 65 6e 65 72 61  6c 20 53 79 73 74 65 6d  |  General System|
000000c0  20 43 61 6c 6c 73 2e 20  20 20 20 20 20 20 20 20  | Calls.         |
000000d0  20 20 20 20 20 2a 2f 0a  2f 2a 20 20 20 20 20 20  |     */./*      |
000000e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000110  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
00000120  2f 2a 20 20 41 72 63 68  69 6d 65 64 65 73 20 57  |/*  Archimedes W|
00000130  6f 72 6c 64 20 31 39 39  32 20 20 20 20 20 20 20  |orld 1992       |
00000140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000160  20 20 20 20 20 2a 2f 0a  2f 2a 20 20 20 20 20 20  |     */./*      |
00000170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000001a0  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
000001b0  2f 2a 20 20 57 72 69 74  74 65 6e 20 42 79 20 4a  |/*  Written By J|
000001c0  6f 68 6e 20 53 6b 69 6e  67 6c 65 79 2e 20 20 20  |ohn Skingley.   |
000001d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000001f0  20 20 20 20 20 2a 2f 0a  2f 2a 20 20 20 20 20 20  |     */./*      |
00000200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000230  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
00000240  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000250  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000280  2a 2a 2a 2a 2a 2a 2f 0a  0a 23 69 6e 63 6c 75 64  |******/..#includ|
00000290  65 20 22 68 2e 67 6c 6f  62 61 6c 22 0a 23 69 6e  |e "h.global".#in|
000002a0  63 6c 75 64 65 20 22 68  2e 73 77 69 22 0a 23 69  |clude "h.swi".#i|
000002b0  6e 63 6c 75 64 65 20 22  68 2e 73 77 69 6f 73 22  |nclude "h.swios"|
000002c0  0a 0a 0a 76 6f 69 64 20  42 65 65 70 28 20 76 6f  |...void Beep( vo|
000002d0  69 64 20 29 0a 7b 0a 2f  2a 20 20 49 73 73 75 65  |id ).{./*  Issue|
000002e0  73 20 61 20 27 62 65 6c  6c 27 20 63 6f 6d 6d 61  |s a 'bell' comma|
000002f0  6e 64 2e 20 20 2a 2f 0a  0a 20 20 20 20 69 6e 74  |nd.  */..    int|
00000300  20 20 72 65 67 73 5b 31  30 5d 3b 0a 0a 20 20 20  |  regs[10];..   |
00000310  20 72 65 67 73 5b 30 5d  20 3d 20 37 3b 0a 0a 20  | regs[0] = 7;.. |
00000320  20 20 20 53 77 69 28 20  4f 53 5f 57 72 69 74 65  |   Swi( OS_Write|
00000330  43 2c 20 72 65 67 73 20  29 3b 0a 7d 0a 0a 0a 76  |C, regs );.}...v|
00000340  6f 69 64 20 50 69 78 65  6c 73 54 6f 53 63 72 65  |oid PixelsToScre|
00000350  65 6e 58 28 20 69 6e 74  20 2a 77 69 64 74 68 2c  |enX( int *width,|
00000360  20 69 6e 74 20 6d 6f 64  65 20 29 0a 7b 0a 2f 2a  | int mode ).{./*|
00000370  20 20 43 6f 6e 76 65 72  74 73 20 69 6e 74 65 67  |  Converts integ|
00000380  65 72 20 27 77 69 64 74  68 27 20 74 6f 20 73 63  |er 'width' to sc|
00000390  72 65 65 6e 20 70 69 78  65 6c 73 2c 20 61 63 63  |reen pixels, acc|
000003a0  6f 72 64 69 6e 67 20 74  6f 20 73 63 72 65 65 6e  |ording to screen|
000003b0  20 6d 6f 64 65 2e 20 2a  2f 0a 0a 20 20 20 20 69  | mode. */..    i|
000003c0  6e 74 20 72 65 67 73 5b  31 30 5d 3b 0a 0a 20 20  |nt regs[10];..  |
000003d0  20 20 72 65 67 73 5b 30  5d 20 3d 20 6d 6f 64 65  |  regs[0] = mode|
000003e0  3b 0a 20 20 20 20 72 65  67 73 5b 31 5d 20 3d 20  |;.    regs[1] = |
000003f0  34 3b 0a 0a 20 20 20 20  53 77 69 28 20 4f 53 5f  |4;..    Swi( OS_|
00000400  52 65 61 64 4d 6f 64 65  56 61 72 69 61 62 6c 65  |ReadModeVariable|
00000410  2c 20 72 65 67 73 20 29  3b 0a 0a 20 20 20 20 2a  |, regs );..    *|
00000420  77 69 64 74 68 20 3c 3c  3d 20 72 65 67 73 5b 32  |width <<= regs[2|
00000430  5d 3b 0a 7d 0a 0a 0a 76  6f 69 64 20 50 69 78 65  |];.}...void Pixe|
00000440  6c 73 54 6f 53 63 72 65  65 6e 59 28 20 69 6e 74  |lsToScreenY( int|
00000450  20 2a 68 65 69 67 68 74  2c 20 69 6e 74 20 6d 6f  | *height, int mo|
00000460  64 65 20 29 0a 7b 0a 2f  2a 20 20 43 6f 6e 76 65  |de ).{./*  Conve|
00000470  72 74 73 20 69 6e 74 65  67 65 72 20 27 68 65 69  |rts integer 'hei|
00000480  67 68 74 27 20 74 6f 20  73 63 72 65 65 6e 20 70  |ght' to screen p|
00000490  69 78 65 6c 73 2c 20 61  63 63 6f 72 64 69 6e 67  |ixels, according|
000004a0  20 74 6f 20 73 63 72 65  65 6e 20 6d 6f 64 65 2e  | to screen mode.|
000004b0  20 2a 2f 0a 0a 20 20 20  20 69 6e 74 20 72 65 67  | */..    int reg|
000004c0  73 5b 31 30 5d 3b 0a 0a  20 20 20 20 72 65 67 73  |s[10];..    regs|
000004d0  5b 30 5d 20 3d 20 6d 6f  64 65 3b 0a 20 20 20 20  |[0] = mode;.    |
000004e0  72 65 67 73 5b 31 5d 20  3d 20 35 3b 0a 0a 20 20  |regs[1] = 5;..  |
000004f0  20 20 53 77 69 28 20 4f  53 5f 52 65 61 64 4d 6f  |  Swi( OS_ReadMo|
00000500  64 65 56 61 72 69 61 62  6c 65 2c 20 72 65 67 73  |deVariable, regs|
00000510  20 29 3b 0a 0a 20 20 20  20 2a 68 65 69 67 68 74  | );..    *height|
00000520  20 3c 3c 3d 20 72 65 67  73 5b 32 5d 3b 0a 7d 0a  | <<= regs[2];.}.|
00000530  0a 0a                                             |..|
00000532