chiark / gitweb /
Create readable text `.bas' for each tokenized BASIC `,ffb' file.
[ssr] / StraySrc / Libraries / DLLLib / s / findAll
1 ;
2 ; findall.s
3 ;
4 ; Load an application's DLLs from the stub table
5 ;
6 ; © 1994 Straylight
7 ;
8
9 ;----- Standard stuff -------------------------------------------------------
10
11                 GET     libs:header
12                 GET     libs:swis
13
14 ;----- Other external dependencies ------------------------------------------
15
16                 IMPORT  |x$stack_overflow|
17                 IMPORT  atexit
18                 IMPORT  malloc
19                 IMPORT  |_dll_giveMemory|
20
21 ;----- Main code ------------------------------------------------------------
22
23                 AREA    |DLL$$Code|,CODE,READONLY
24
25 ; --- _dll_findall ---
26 ;
27 ; On entry:     a1 == DLL$$ExternalTable$$Base
28 ;               a2 == DLL$$ExternalTable$$Limit
29 ; On exit:      --
30
31                 EXPORT  |_dll_findall|
32 |_dll_findall|
33                 ROUT
34
35                 ; --- APCS procedure entry ---
36
37                 MOV     ip,sp
38                 STMFD   sp!,{fp,ip,lr,pc}
39                 SUB     fp,ip,#4
40                 CMP     sp,sl
41                 BLLT    |x$stack_overflow|
42
43                 ; --- Find the DLLs in the table ---
44
45                 SWI     DLL_FindFromTable       ;Load DLLs in the app's table
46
47                 ; --- Make sure the DLLs are freed at exit time ---
48
49                 LDR     a1,=|_dll_dying|        ;Point to tidy up routine
50                 BL      atexit                  ;Add tidy-up routine to list
51
52                 ; --- Give the DLLs some application space ---
53
54                 LDMDB   fp,{fp,sp,lr}           ;Find registers again
55                 B       |_dll_giveMemory|       ;Tail-call optimisation :-)
56
57                 LTORG
58
59 ; --- _dll_dying ---
60
61 |_dll_dying|    ROUT
62
63                 MOV     ip,lr                   ;Keep link register safely
64                 SWI     DLL_AppDying            ;Close down the application
65                 MOVS    pc,ip                   ;Return to caller
66
67                 LTORG
68
69 ;----- That's all, folks ----------------------------------------------------
70
71                 END