AmigaDOS Part II – Startup Sequences

The Amiga startup-sequence is a script file located inside the S: logical device (usually SYS:s) and executed at boot time. This script is responsible for system initialization: patching the rom, adding disk buffers, loading drivers and mounting devices, launching services, making assigns, creating ram folders..

My 1.3 startup-sequence

For my Amiga 500 configuration (on WinUAE) I’m using two hard disks, one for workbench and the other for programs and data. The primary use of this setup is for coding and the main apps installed are the Lattice (C v5, C++ v5.1) and SAS/C (v 6.5) compilers. At the end of my custom startup-sequence I inserted a prompt where the user can make a choice: starting the workbench, initing the environment for one of the installed compilers (making the assigns and updating the path) or do nothing and continue with the shell.

Line 37: FKeys.NewWSH; window switcher Starting the FKeys v1.1[b], a sort of tab-switcher which adds window and screen switching functions to the function keys in conjunction with the left Amiga key.

Lines 39-51: In these lines I’m launching the WShell 2.0[c] console handler and its tools. First I replace the CON: handler with the WShell DisplayHandler: in line 40
AssignCON:REMOVE I remove the CON: device, then in line 43
DHOptsCON:0/0/640/256/New/CLOSEPIP: I mount the WShell handler. In line 46
FComp>NIL: I start the Filename Completion tool and in line 49
SetExecute patches the AmigadDOS
Execute command to use the WShell environment when invoking a shell script. Finally, in line 51
NewWSH"CON://640/256/WShell/CLOSE"FROMS:selector-scriptQUIET a new WShell is created using S:Selector-script as startup.

Let’s see the selector-script contents:

AmigaDOS

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

ExecuteWShell-startup

Echo"Select action:*N"

Echo" 1 - Load Workbench"

Echo" 2 - Init Lattice C V5.0 enviroment"

Echo" 3 - Init Lattice C++ V5.1 enviroment"

Echo" 4 - Init SAS C v6.5 enviroment"

Echo" Enter - Continue*N"

UserChoice

Echo""

IfExistsENV:user_selection_1

Echo"Loading Workbench..."

LoadWBDELAY

EndCli

Quit

EndIf

IfExistsENV:user_selection_2

xDATA:s/lattice-init

Echo""

Quit

EndIf

IfExistsENV:user_selection_3

xDATA:s/lattice-cpp-init

Echo""

Quit

EndIf

IfExistsENV:user_selection_4

xDATA:s/sasc-init

Echo""

Quit

EndIf

On line 1 the WShell-startup script is executed which sets a short alias for the Execute command and the prompt format:

AmigaDOS

1

2

AliasxC:Execute

prompt"%1R(%r) %3%c%1> "

On line 10 the UserChoice command is called. It’s a little C program that I wrote for user interaction inside a script. It reads a number (0-9) from the standard input and sets an environment variable (user_selection_<n>) according to the number written. Then in the selector-script I simply check the existence of the corresponding file for each environment variable in the ENV: folder.

Here is the source of the UserChoice command:

C

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

#include <stdio.h>

#include <proto/dos.h>

intmain()

{

charc;

charcommand[50];

// Clears all the environment variables

Execute("delete env:user_selection_? Q",NULL,NULL);

while(1){

printf("> ");

c=getchar();

if(c=='\n')return0;

if(c<'0'||c>'9'){

while(c!='\n')c=getchar();

}

elsebreak;

}

sprintf(command,"SetEnv user_selection_%c %c",c,c);

Execute(command,NULL,NULL);

return0;

}

Here is a video showing the boot sequence, some script execution, autocompletion and window switching: