-
Notifications
You must be signed in to change notification settings - Fork 2
/
+Header_Backstart.s
107 lines (105 loc) · 2.23 KB
/
+Header_Backstart.s
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
**********************************************************************
*
* HEADER BACKSTART Programme compile
*
* Ne pas changer le fichier sans verifier que c'est multiple
* de 8
*
**********************************************************************
*
dc.w FinBack-DebBack
*
DebBack move.l #0,d2
move.l #0,d3
BackStart
lea DebPrg(pc),a4
move.l a4,Header_DebPrg-DebPrg(a4)
; Recopie les parametres
move.l d2,ComD2-DebPrg(a4)
move.l d3,ComD3-DebPrg(a4)
; Recopie la ligne de commande
cmp.w #256,d0
bcs.s .skip
move.w #255,d0
.skip move.w d0,ComLong-DebPrg(a4)
lea ComLine-DebPrg(a4),a1
subq.w #1,d0
bmi.s .loopX
.loop move.b (a0)+,(a1)+
dbra d0,.loop
.loopX
; CLI ou WORKBENCH?
move.l $4.w,a6
sub.l a1,a1
jsr FindTask(a6)
move.l d0,a0
tst.l $ac(a0)
beq DDebPrg
; Ca vient du CLI: RUN BACK
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CliBack bset #FHead_Backed,ComD2+3-DebPrg(a4)
; Ouvre le DOS
moveq #0,d0
lea DosName(pc),a1
jsr OpenLib(a6)
move.l d0,a6
tst.l d0
beq.s BackX
; Coupe les segments
lea DDebPrg-8(pc),a2
move.l a2,a1
lea DebBack-8(pc),a0
move.l 4(a0),4(a2)
clr.l 4(a0)
sub.l a0,a1
move.l (a0),d0
move.l a1,(a0)
sub.l a1,d0
move.l d0,(a2)
; Adresse du debut du hunk
addq.l #4,a2
move.l a2,d3
addq.l #4,a2
move.l a2,Header_DebPrg-DebPrg(a4)
; Fait démarrer le processus
lsr.l #2,d3 Segments...
moveq #0,d2
lea FoNom(pc),a0
move.l a0,d1 Faux nom...
move.l #4096,d4 Taille de pile...
jsr -138(a6) Create Proc!
; Ferme le DOS
move.l a6,a1
move.l $4.w,a6
jsr CloseLib(a6)
; Fini!
BackX moveq #0,d0
rts
;---------------------------------------------------------------------
dc.l 0
ds.l 2
;---------------------------------------------------------------------
DDebPrg lea ComLine(pc),a0
move.w ComLong(pc),d0
lea DebPrg(pc),a4
move.l ComD2(pc),d2
move.l ComD3(pc),d3
bsr.s BackIn
move.l $4.w,a6
jsr Forbid(a6)
lea DDebPrg-4(pc),a1
move.l -(a1),d0
jsr FreeMem(a6)
moveq #0,d0
rts
;---------------------------------------------------------------------
Include "+Header.s"
;---------------------------------------------------------------------
ComLong dc.w 0
ComLine ds.b 256
ComD2 dc.l 0
ComD3 dc.l 0
FoNom dc.b "Backstart",0
even
;---------------------------------------------------------------------
FinBack dc.w 0