1187
|
1 ********************************************************************
|
|
2 * Boot - Disto RAMPak Boot Module
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
1287
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
1187
|
8 * ------------------------------------------------------------------
|
1287
|
9 * 5 ????/??/?? Alan DeKok
|
|
10 * Created.
|
|
11 *
|
|
12 * 6 1998/10/20 Boisy G. Pitre
|
|
13 * Fixed small bugs, improved speed.
|
1187
|
14
|
|
15 nam Boot
|
|
16 ttl Disto RAMPak Boot Module
|
|
17
|
|
18 * Disassembled 94/06/25 11:37:47 by Alan DeKok
|
|
19
|
1287
|
20 IFP1
|
1187
|
21 use defsfile
|
|
22 use rbfdefs
|
1287
|
23 ENDC
|
1187
|
24
|
|
25 tylg set Systm+Objct
|
|
26 atrv set ReEnt+rev
|
|
27 rev set $00
|
|
28 edition set 6
|
|
29
|
|
30 mod eom,name,tylg,atrv,start,size
|
|
31
|
|
32 * on-stack buffer to use
|
|
33 org 0
|
|
34 size equ .
|
|
35
|
|
36 name equ *
|
|
37 fcs /Boot/
|
|
38 fcb edition
|
|
39
|
|
40 start orcc #IntMasks ensure IRQ's are off.
|
|
41
|
|
42 pshs x,d save 4 bytes of junk
|
|
43 R.D equ 1
|
|
44 R.X equ 3
|
|
45
|
|
46 lda >MPI.Slct get current slot
|
|
47 pshs a save off
|
|
48 lda >PakSlot,pcr get multipak slot number
|
|
49 bmi cont if >127, invalid slot number
|
|
50 anda #$03 force it to be legal
|
|
51 ldb #$11
|
|
52 mul put it into both nibbles
|
|
53 stb >MPI.Slct go to the desired slot
|
|
54
|
|
55 cont ldd #$0001 request one byte (will round up to 1 page)
|
|
56 os9 F$SRqMem request the memory
|
|
57 bcs L00AE exit on error
|
|
58 * U is implicitely the buffer address to use
|
|
59
|
|
60 ldx #$0000 X=0: got to sector #$0000
|
|
61 bsr GetSect load in LSN0, and point Y to the buffer
|
|
62 bcs L00AE
|
|
63
|
|
64 ldd <DD.BSZ,u size of the bootstrap file
|
|
65 std R.D,s save it on the stack (0,s is junk)
|
|
66 ldx <DD.BT+1,u get starting sector of the bootstrap file
|
|
67
|
|
68 pshs x save the starting sector number
|
|
69 ldd #$0100 one page of memory
|
|
70 os9 F$SRtMem return the copy of LSN0 to free memory
|
|
71
|
|
72 ldd R.X,s get size of boot memory to request
|
1287
|
73 IFGT Level-1
|
1187
|
74 os9 F$BtMem ask for the boot memory
|
1287
|
75 ELSE
|
1187
|
76 os9 F$SRqMem ask for the boot memory
|
1287
|
77 ENDC
|
1187
|
78 puls x restore the starting sector number
|
|
79 bcs L00AE no memory: exit with error
|
|
80
|
|
81 stu R.X,s save start address of memory allocated
|
|
82 std R.D,s and the size of the boot memory
|
|
83 beq L00A7 if no memory allocated, exit
|
|
84
|
|
85 SectLp pshs x,d save sector #, size of boot
|
|
86 bsr GetSect read one sector
|
|
87 bcs L00AC if there's an error, exit
|
|
88 puls x,d restor sector, size of boot
|
|
89
|
|
90 leau $0100,u go up one page in memory
|
|
91 leax $01,x go to the next sector
|
|
92 subd #$0100 take out one sector, need value in B, too.
|
|
93 bhi SectLp loop until all sectors are read
|
|
94
|
|
95 L00A7 puls a
|
|
96 sta >MPI.Slct
|
|
97 clrb clear carry
|
|
98 puls d return size of boot memory to user
|
|
99 bra L00B0 and go exit
|
|
100
|
|
101 L00AC leas $04,s remove X,D off of stack
|
|
102 L00AE puls a
|
|
103 sta >MPI.Slct
|
|
104 leas $02,s kill D off of the stack
|
|
105
|
|
106 L00B0 puls x restore start address of memory allocated
|
|
107 * leas size,s remove the on-stack buffer
|
|
108 clr >DPort stop the disk
|
|
109 L00BA rts
|
|
110
|
|
111 * GetSect: read a sector off of the disk
|
|
112 * Entry: X = sector number to read
|
|
113 GetSect pshs d,x,y
|
|
114 ldy >Address,pcr grab the device address
|
|
115 tfr x,d move 16 bit LSN into 2 8-bit registers
|
|
116 sta 2,y save HB LSN
|
|
117 stb 1,y save LB LSN
|
|
118 leax ,u get buffer address to write into
|
|
119 clrb and start out at byte zero
|
|
120
|
|
121 ReadLp stb ,y save byte number
|
|
122 lda 3,y grab the byte
|
|
123 sta ,x+ save in the buffer
|
|
124 incb go to the enxt byte
|
|
125 bne ReadLp
|
|
126 clrb no errors
|
|
127 puls d,x,y,pc restore registers and return
|
|
128
|
1287
|
129 IFGT Level-1
|
1187
|
130 Pad fill $39,$1D0-6-*
|
1287
|
131 ENDC
|
1187
|
132
|
|
133 Address fdb $FF40 address of the device to boot from
|
|
134 PakSlot fcb $01 multipak slot number
|
|
135
|
|
136 emod
|
|
137 eom equ *
|
|
138 end
|