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