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