annotate level1/modules/boot_rampak.asm @ 1724:f389c6bca482

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