comparison 3rdparty/booters/boot_rampak.asm @ 45:2ce754e62499

Moved booters to 3rdparty directory
author boisy
date Sat, 20 Apr 2002 13:36:45 +0000
parents
children 20e8c354b914
comparison
equal deleted inserted replaced
44:0f2f6f3a0113 45:2ce754e62499
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 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
68 os9 F$BtMem ask for the boot memory
69 puls x restore the starting sector number
70 bcs L00AE no memory: exit with error
71
72 stu R.X,s save start address of memory allocated
73 std R.D,s and the size of the boot memory
74 beq L00A7 if no memory allocated, exit
75
76 SectLp pshs x,d save sector #, size of boot
77 bsr GetSect read one sector
78 bcs L00AC if there's an error, exit
79 puls x,d restor sector, size of boot
80
81 leau $0100,u go up one page in memory
82 leax $01,x go to the next sector
83 subd #$0100 take out one sector, need value in B, too.
84 bhi SectLp loop until all sectors are read
85
86 L00A7 puls a
87 sta >MPI.Slct
88 clrb clear carry
89 puls d return size of boot memory to user
90 bra L00B0 and go exit
91
92 L00AC leas $04,s remove X,D off of stack
93 L00AE puls a
94 sta >MPI.Slct
95 leas $02,s kill D off of the stack
96
97 L00B0 puls x restore start address of memory allocated
98 * leas size,s remove the on-stack buffer
99 clr >$FF40 stop the disk
100 L00BA rts
101
102 * GetSect: read a sector off of the disk
103 * Entry: X = sector number to read
104 GetSect pshs d,x,y
105 ldy >Address,pcr grab the device address
106 tfr x,d move 16 bit LSN into 2 8-bit registers
107 sta 2,y save HB LSN
108 stb 1,y save LB LSN
109 leax ,u get buffer address to write into
110 clrb and start out at byte zero
111
112 ReadLp stb ,y save byte number
113 lda 3,y grab the byte
114 sta ,x+ save in the buffer
115 incb go to the enxt byte
116 bne ReadLp
117 clrb no errors
118 puls d,x,y,pc restore registers and return
119
120 fcc / JABBERWOCKY. /
121 fcb $0D
122 fcc /'Twas brillig, and the slithy toves/
123 fcb $0D
124 fcc / Did gyre and gimble in the wabe:/
125 fcb $0D
126 fcc /All mimsy were the borogroves,/
127 fcb $0D
128 fcc / And the mome raths outgrabe./
129 fcb $0D
130 fcb $0D
131 fcc /"Beware the Jabberwock, my son!/
132 fcb $0D
133 fcc / The jaws that bite, the claws that catch!/
134 fcb $0D
135 fcc /Beware the Jubjub bird, and shun/
136 fcb $0D
137 fcc / The frumious Bandersnatch"/
138 fcb $0D
139
140 Address fdb $FF40 address of the device to boot from
141 PakSlot fcb $01 multipak slot number
142
143 emod
144 eom equ *
145 end