Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199207.adf » !AWJULY92 » !AWJUL92/Goodies/work/s/swi

!AWJUL92/Goodies/work/s/swi

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 » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199207.adf » !AWJULY92
Filename: !AWJUL92/Goodies/work/s/swi
Read OK:
File size: 071F bytes
Load address: 0000
Exec address: 0000
File contents
; /*********************************************************************/
; /*                                                                   */
; /*  Wimp Routine Library.                                            */
; /*                                                                   */
; /*  Archimedes World 1992                                            */
; /*                                                                   */
; /*  Written By John Skingley, with full acknowledgment to Acorn.     */
; /*                                                                   */
; /*********************************************************************/

; Register names

r0  RN 0
r1  RN 1
r2  RN 2
r3  RN 3
r4  RN 4
r5  RN 5
r6  RN 6
r7  RN 7
r8  RN 8
r9  RN 9
r10 RN 10
r11 RN 11
r12 RN 12
r13 RN 13
r14 RN 14
r15 RN 15

        EXPORT  |Swi|
        EXPORT  |Error|
        AREA    |C$$code|, CODE, READONLY

;   C calling syntax:  swi_error *Swi( int swinumber, int regs[] );

label   DCB     "Swi", 0                     ; Include routine name for trace-back.
        ALIGN
length * . - label
        DCD     &FF000000 + length

Swi     STMDB   r13!, {r4-r9, r14}

        ORR     r0, r0, #&EF000000           ; Add rest of op-code to swi number.
        ORR     r0, r0, #&00020000           ; Add bit for error return.

        ADR     r4, exit
        LDMIA   r4, {r5, r6, r7, r8, r9}
        STMDB   r13!, {r0, r5,r6,r7,r8,r9}   ; Copy swi and exit code onto stack
        MOVS    r12, r1
        LDMNEIA r12, {r0-r9}                 ; Load registers for swi call
        MOV     r15, r13                     ; Carry out Swi operation. 

exit    TEQ     r12, #0
        STMNEIA r12, {r0-r9}
        MOVVC   r0, #0
        ADD     r13, r13, #4*4
        LDMIA   r13!, {r1, r2, r4-r9, r15}^

        END
00000000  3b 20 2f 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 2a 2a  2f 0a 3b 20 2f 2a 20 20  |********/.; /*  |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000090  20 2a 2f 0a 3b 20 2f 2a  20 20 57 69 6d 70 20 52  | */.; /*  Wimp R|
000000a0  6f 75 74 69 6e 65 20 4c  69 62 72 61 72 79 2e 20  |outine Library. |
000000b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000000d0  20 20 20 20 20 20 20 20  20 20 20 2a 2f 0a 3b 20  |           */.; |
000000e0  2f 2a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |/*              |
000000f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000120  20 20 20 20 20 2a 2f 0a  3b 20 2f 2a 20 20 41 72  |     */.; /*  Ar|
00000130  63 68 69 6d 65 64 65 73  20 57 6f 72 6c 64 20 31  |chimedes World 1|
00000140  39 39 32 20 20 20 20 20  20 20 20 20 20 20 20 20  |992             |
00000150  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 2a  |               *|
00000170  2f 0a 3b 20 2f 2a 20 20  20 20 20 20 20 20 20 20  |/.; /*          |
00000180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000001b0  20 20 20 20 20 20 20 20  20 2a 2f 0a 3b 20 2f 2a  |         */.; /*|
000001c0  20 20 57 72 69 74 74 65  6e 20 42 79 20 4a 6f 68  |  Written By Joh|
000001d0  6e 20 53 6b 69 6e 67 6c  65 79 2c 20 77 69 74 68  |n Skingley, with|
000001e0  20 66 75 6c 6c 20 61 63  6b 6e 6f 77 6c 65 64 67  | full acknowledg|
000001f0  6d 65 6e 74 20 74 6f 20  41 63 6f 72 6e 2e 20 20  |ment to Acorn.  |
00000200  20 20 20 2a 2f 0a 3b 20  2f 2a 20 20 20 20 20 20  |   */.; /*      |
00000210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000240  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
00000250  3b 20 2f 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |; /*************|
00000260  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000290  2a 2a 2a 2a 2a 2a 2a 2a  2f 0a 0a 3b 20 52 65 67  |********/..; Reg|
000002a0  69 73 74 65 72 20 6e 61  6d 65 73 0a 0a 72 30 20  |ister names..r0 |
000002b0  20 52 4e 20 30 0a 72 31  20 20 52 4e 20 31 0a 72  | RN 0.r1  RN 1.r|
000002c0  32 20 20 52 4e 20 32 0a  72 33 20 20 52 4e 20 33  |2  RN 2.r3  RN 3|
000002d0  0a 72 34 20 20 52 4e 20  34 0a 72 35 20 20 52 4e  |.r4  RN 4.r5  RN|
000002e0  20 35 0a 72 36 20 20 52  4e 20 36 0a 72 37 20 20  | 5.r6  RN 6.r7  |
000002f0  52 4e 20 37 0a 72 38 20  20 52 4e 20 38 0a 72 39  |RN 7.r8  RN 8.r9|
00000300  20 20 52 4e 20 39 0a 72  31 30 20 52 4e 20 31 30  |  RN 9.r10 RN 10|
00000310  0a 72 31 31 20 52 4e 20  31 31 0a 72 31 32 20 52  |.r11 RN 11.r12 R|
00000320  4e 20 31 32 0a 72 31 33  20 52 4e 20 31 33 0a 72  |N 12.r13 RN 13.r|
00000330  31 34 20 52 4e 20 31 34  0a 72 31 35 20 52 4e 20  |14 RN 14.r15 RN |
00000340  31 35 0a 0a 20 20 20 20  20 20 20 20 45 58 50 4f  |15..        EXPO|
00000350  52 54 20 20 7c 53 77 69  7c 0a 20 20 20 20 20 20  |RT  |Swi|.      |
00000360  20 20 45 58 50 4f 52 54  20 20 7c 45 72 72 6f 72  |  EXPORT  |Error|
00000370  7c 0a 20 20 20 20 20 20  20 20 41 52 45 41 20 20  ||.        AREA  |
00000380  20 20 7c 43 24 24 63 6f  64 65 7c 2c 20 43 4f 44  |  |C$$code|, COD|
00000390  45 2c 20 52 45 41 44 4f  4e 4c 59 0a 0a 3b 20 20  |E, READONLY..;  |
000003a0  20 43 20 63 61 6c 6c 69  6e 67 20 73 79 6e 74 61  | C calling synta|
000003b0  78 3a 20 20 73 77 69 5f  65 72 72 6f 72 20 2a 53  |x:  swi_error *S|
000003c0  77 69 28 20 69 6e 74 20  73 77 69 6e 75 6d 62 65  |wi( int swinumbe|
000003d0  72 2c 20 69 6e 74 20 72  65 67 73 5b 5d 20 29 3b  |r, int regs[] );|
000003e0  0a 0a 6c 61 62 65 6c 20  20 20 44 43 42 20 20 20  |..label   DCB   |
000003f0  20 20 22 53 77 69 22 2c  20 30 20 20 20 20 20 20  |  "Swi", 0      |
00000400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000410  20 49 6e 63 6c 75 64 65  20 72 6f 75 74 69 6e 65  | Include routine|
00000420  20 6e 61 6d 65 20 66 6f  72 20 74 72 61 63 65 2d  | name for trace-|
00000430  62 61 63 6b 2e 0a 20 20  20 20 20 20 20 20 41 4c  |back..        AL|
00000440  49 47 4e 0a 6c 65 6e 67  74 68 20 2a 20 2e 20 2d  |IGN.length * . -|
00000450  20 6c 61 62 65 6c 0a 20  20 20 20 20 20 20 20 44  | label.        D|
00000460  43 44 20 20 20 20 20 26  46 46 30 30 30 30 30 30  |CD     &FF000000|
00000470  20 2b 20 6c 65 6e 67 74  68 0a 0a 53 77 69 20 20  | + length..Swi  |
00000480  20 20 20 53 54 4d 44 42  20 20 20 72 31 33 21 2c  |   STMDB   r13!,|
00000490  20 7b 72 34 2d 72 39 2c  20 72 31 34 7d 0a 0a 20  | {r4-r9, r14}.. |
000004a0  20 20 20 20 20 20 20 4f  52 52 20 20 20 20 20 72  |       ORR     r|
000004b0  30 2c 20 72 30 2c 20 23  26 45 46 30 30 30 30 30  |0, r0, #&EF00000|
000004c0  30 20 20 20 20 20 20 20  20 20 20 20 3b 20 41 64  |0           ; Ad|
000004d0  64 20 72 65 73 74 20 6f  66 20 6f 70 2d 63 6f 64  |d rest of op-cod|
000004e0  65 20 74 6f 20 73 77 69  20 6e 75 6d 62 65 72 2e  |e to swi number.|
000004f0  0a 20 20 20 20 20 20 20  20 4f 52 52 20 20 20 20  |.        ORR    |
00000500  20 72 30 2c 20 72 30 2c  20 23 26 30 30 30 32 30  | r0, r0, #&00020|
00000510  30 30 30 20 20 20 20 20  20 20 20 20 20 20 3b 20  |000           ; |
00000520  41 64 64 20 62 69 74 20  66 6f 72 20 65 72 72 6f  |Add bit for erro|
00000530  72 20 72 65 74 75 72 6e  2e 0a 0a 20 20 20 20 20  |r return...     |
00000540  20 20 20 41 44 52 20 20  20 20 20 72 34 2c 20 65  |   ADR     r4, e|
00000550  78 69 74 0a 20 20 20 20  20 20 20 20 4c 44 4d 49  |xit.        LDMI|
00000560  41 20 20 20 72 34 2c 20  7b 72 35 2c 20 72 36 2c  |A   r4, {r5, r6,|
00000570  20 72 37 2c 20 72 38 2c  20 72 39 7d 0a 20 20 20  | r7, r8, r9}.   |
00000580  20 20 20 20 20 53 54 4d  44 42 20 20 20 72 31 33  |     STMDB   r13|
00000590  21 2c 20 7b 72 30 2c 20  72 35 2c 72 36 2c 72 37  |!, {r0, r5,r6,r7|
000005a0  2c 72 38 2c 72 39 7d 20  20 20 3b 20 43 6f 70 79  |,r8,r9}   ; Copy|
000005b0  20 73 77 69 20 61 6e 64  20 65 78 69 74 20 63 6f  | swi and exit co|
000005c0  64 65 20 6f 6e 74 6f 20  73 74 61 63 6b 0a 20 20  |de onto stack.  |
000005d0  20 20 20 20 20 20 4d 4f  56 53 20 20 20 20 72 31  |      MOVS    r1|
000005e0  32 2c 20 72 31 0a 20 20  20 20 20 20 20 20 4c 44  |2, r1.        LD|
000005f0  4d 4e 45 49 41 20 72 31  32 2c 20 7b 72 30 2d 72  |MNEIA r12, {r0-r|
00000600  39 7d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |9}              |
00000610  20 20 20 3b 20 4c 6f 61  64 20 72 65 67 69 73 74  |   ; Load regist|
00000620  65 72 73 20 66 6f 72 20  73 77 69 20 63 61 6c 6c  |ers for swi call|
00000630  0a 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |.        MOV    |
00000640  20 72 31 35 2c 20 72 31  33 20 20 20 20 20 20 20  | r15, r13       |
00000650  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000660  43 61 72 72 79 20 6f 75  74 20 53 77 69 20 6f 70  |Carry out Swi op|
00000670  65 72 61 74 69 6f 6e 2e  20 0a 0a 65 78 69 74 20  |eration. ..exit |
00000680  20 20 20 54 45 51 20 20  20 20 20 72 31 32 2c 20  |   TEQ     r12, |
00000690  23 30 0a 20 20 20 20 20  20 20 20 53 54 4d 4e 45  |#0.        STMNE|
000006a0  49 41 20 72 31 32 2c 20  7b 72 30 2d 72 39 7d 0a  |IA r12, {r0-r9}.|
000006b0  20 20 20 20 20 20 20 20  4d 4f 56 56 43 20 20 20  |        MOVVC   |
000006c0  72 30 2c 20 23 30 0a 20  20 20 20 20 20 20 20 41  |r0, #0.        A|
000006d0  44 44 20 20 20 20 20 72  31 33 2c 20 72 31 33 2c  |DD     r13, r13,|
000006e0  20 23 34 2a 34 0a 20 20  20 20 20 20 20 20 4c 44  | #4*4.        LD|
000006f0  4d 49 41 20 20 20 72 31  33 21 2c 20 7b 72 31 2c  |MIA   r13!, {r1,|
00000700  20 72 32 2c 20 72 34 2d  72 39 2c 20 72 31 35 7d  | r2, r4-r9, r15}|
00000710  5e 0a 0a 20 20 20 20 20  20 20 20 45 4e 44 0a     |^..        END.|
0000071f