annotate level1/modules/boot_rampak.asm @ 1286:d5839bc79972

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