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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
IDNT SysCDisk
SECTION text,CODE
INCLUDE "MyExec.i"
INCLUDE "exec/macros.i"
INCLUDE "dos/dos.i"
XREF _DOSBase,@CheckFile
;CRUNCH
XREF _RawPrintfFunc
XREF ReplyPacket
IFD CRUNCH
XREF PPDecrunch
ENDC
XDEF InitDiskFunc ; Disk-System initialisieren
XDEF SetNoDiskHandlerFunc
XDEF ProcessNextRequest ; Wird von SendPacket() aufgerufen
***************************************************************************
** **
** I N I T D I S K - Disk-System init, Recalibrate, Timer alloc ... **
** **
** Parameter : nix **
** **
***************************************************************************
InitDiskFunc: movem.l d0/a0,-(SP)
clr.l InsertDiskRoutine
*** DiskRequest-Liste initialisieren
lea meb_DiskList(a6),a0
SYSJSR NewList
movem.l (SP)+,d0/a0
rts
***************************************************************************
** **
** S E T N O D I S K H A N D L E R - NoDisk-Handler setzen **
** **
** Parameter : A0.L: InsertDisk-Handler oder 0 **
** **
***************************************************************************
SetNoDiskHandlerFunc:
move.l a0,InsertDiskRoutine
rts
**************************************************************************
*** Nächsten Request aus Diskliste verarbeiten
ProcessNextRequest:
movem.l d0-d7/a0-a5,-(SP)
lea meb_DiskList(a6),a0
jsr meb_RemHead(a6) ; setzt CCR
beq .EndProcReq ; Kein Request pending --->
movea.l d0,a2 ; A2 : Aktuelles Packet
IFD DEBUG
moveq #0,d0
move.b dp_Flags(a2),d0 ; für SMSG
SMSG <"Loading '%s' (flags=$%02lx) ... ">,dp_FileName(a2),d0
ENDC
*** Packet bearbeiten
movea.l a6,a5 ; A5 : MyExecBase
movea.l dp_FileName(a2),a0
bsr @CheckFile
move.l d0,d2 ; D2 : File-Länge
bne 1$ ; OK -->
SMSG <"'%s': file not found!">,dp_FileName(a2)
bra .Error
1$:
btst.b #DPB_ALLOCMEM,dp_Flags(a2) ; CHIP-Alloc gewünscht ?
beq.s .NoChipAlloc ; nein --->
move.l d2,d0 ; File-Länge
movea.l a5,a6 ; MyExecBase
SYSJSR AllocMem
bra.s .AllocCont ; --->
.NoChipAlloc:
btst.b #DPB_ALLOCFASTMEM,dp_Flags(a2) ; FAST-Alloc gewünscht?
beq.s .NoFastAlloc ; nein --->
move.l d2,d0 ; File-Länge
movea.l a5,a6 ; MyExecBase
SYSJSR AllocFastMem
.AllocCont: move.l d0,dp_Address(a2) ; Adresse ins Packet
.NoFastAlloc:
move.l dp_FileName(a2),d1
move.l #MODE_OLDFILE,d2
movea.l _DOSBase,a6
JSRLIB Open
move.l d0,d7
bne.s 2$
.Error: movea.l a5,a6 ; MyExecBase
jmp meb_ColdReboot(a6) ; Raus hier!
2$: move.l d7,d1
move.l dp_Address(a2),d2
move.l #10000000,d3
JSRLIB Read
SMSG <"Loaded %ld bytes at $%08lx">,d0,d2
move.l d7,d1
JSRLIB Close
.DoReply
movea.l a2,a0
movea.l a5,a6 ; MyExecBase
bsr ReplyPacket ; Packet (A0) beantworten
.EndProcReq: movem.l (SP)+,d0-d7/a0-a5
rts
**************************************************************************
* D A T E N (auch im CODE-Segment wegen PC-relativ) *
**************************************************************************
InsertDiskRoutine: ds.l 1 ; User's InsertDisk handler
END
|