revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-amiga / wb.tag / wbtag.c
blobb39f11cc362126361b664cbdb24333e3c2a9fb00
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id: wbtag.c
5 Desc: WB1.x C:LoadWB ROM Workbench startup code
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <exec/types.h>
10 #include <exec/resident.h>
11 #include <exec/ports.h>
12 #include <dos/dosextens.h>
13 #include <proto/exec.h>
14 #include <workbench/workbench.h>
15 #include <proto/workbench.h>
17 #define _STR(A) #A
18 #define STR(A) _STR(A)
20 #define NAME "workbench.task"
21 #define VERSION 40
22 #define REVISION 1
23 const TEXT WBTAG_NAME[] = NAME;
24 const TEXT WBTAG_VERSION_STRING[] = NAME " " STR(VERSION) "." STR(REVISION) " (" ADATE ")\n";
26 extern void Init(void);
27 void InitX(void)
29 /* ROMTAG here because jump table must come immediately after it */
30 asm (
31 " .globl WBTAG_NAME\n"
32 " .globl WBTAG_VERSION_STRING\n"
33 " .globl RealInit\n"
34 " .globl wbtag_end\n"
35 " .text\n"
36 " .align 4\n"
37 " .word 0\n"
38 /* ROMTAG */
39 "wbtag: .word 0x4afc\n"
40 " .long wbtag\n"
41 " .long wbtag_end\n"
42 " .byte 0\n"
43 " .byte 40\n"
44 " .byte 1\n"
45 " .byte -123\n"
46 " .long WBTAG_NAME\n"
47 " .long WBTAG_VERSION_STRING\n"
48 " .long Init\n"
49 /* Strange jump table. Do not touch! \n */
50 /* MUST come immediately after ROMTAG! */
51 "Init: .long 0\n"
52 /* Old entry points */
53 " moveq #0,%d0\n"
54 " bra.s Init2\n"
55 " .long 0\n"
56 " moveq #1,%d0\n"
57 " bra.s Init2\n"
58 " .long 0\n"
59 /* KS 1.2/1.3 entry point */
60 " moveq #2,%d0\n"
61 "Init2: move.l %d0,%sp@-\n"
62 " jsr RealInit\n"
63 " addq.l #4,%sp\n"
64 " rts\n"
68 ULONG RealInit(ULONG mode)
70 struct Process *pr = (struct Process*)FindTask(0);
71 struct Message *msg = NULL;
72 struct Library *WorkbenchBase;
73 ULONG rc = 0;
75 D(bug("wb.task %d\n", mode));
76 if (mode == 2) {
77 WaitPort(&pr->pr_MsgPort);
78 msg = GetMsg(&pr->pr_MsgPort);
80 WorkbenchBase = TaggedOpenLibrary(TAGGEDOPEN_WORKBENCH);
81 if (WorkbenchBase) {
82 rc = StartWorkbench(0, 0);
83 CloseLibrary(WorkbenchBase);
85 if (msg)
86 ReplyMsg(msg);
87 D(bug("wb return code = %d\n", rc));
88 return rc;