annotate level2/cmds/reboot.asm @ 2122:055c774cb633

Commented out D.SysMAP updating code, as per bug 1783594 on SF
author boisy
date Tue, 28 Aug 2007 19:36:17 +0000
parents 1e312b144f4d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
965
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
1 ********************************************************************
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
2 * ReBoot - Reboot into OS-9 or DECB
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
3 *
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
4 * $Id$
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
5 *
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 965
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
bf6f854a4299 Changed revisions to 0
boisy
parents: 965
diff changeset
7 * Comment
965
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 965
diff changeset
9 * 1 ????/??/?? Alan DeKok
bf6f854a4299 Changed revisions to 0
boisy
parents: 965
diff changeset
10 * Started.
965
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
11
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
12 nam ReBoot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
13 ttl Reboot into OS-9 or DECB
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
14
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
15 ifp1
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
16 use defsfile
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
17 endc
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
18
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
19 tylg set Prgrm+Objct
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
20 atrv set ReEnt+Rev
1255
bf6f854a4299 Changed revisions to 0
boisy
parents: 965
diff changeset
21 rev set $00
965
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
22
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
23 mod eom,name,tylg,atrv,start,size
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
24
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
25 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
26 * On boot-up, OS9p2 does (in order)
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
27 * an I$ChDir to the directory specified in the Init file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
28 * this opens an RBF buffer for the device, and at the minimum,
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
29 * allocates:
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
30 * $0100 1 page by IOMan for the IRQ/VIRQ polling table
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
31 * $0100 1 page by IOMan for the disk driver static storage
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
32 * $0100 1 page by IOMan for the disk PD.BUF buffer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
33 * (the path descriptor comes out of memory allocated already by OS9p1
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
34 * from block 0)
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
35 *
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
36 * Next, OS9p2 does an I$Open to '/term' (or whatever, from the Init module)
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
37 * $0100 1 page allocated for '/term' device static storage
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
38 * $0100 1 page allocated for '/term' PD.BUF buffer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
39 *
1933
1e312b144f4d Major changes:
boisy
parents: 1255
diff changeset
40 * VTIO does an F$Load to get GrfDrv into memory, and we then have
965
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
41 * $0200 2 pages allocated by IOMan via F$AllPrc, for the F$Load
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
42 *------- total
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
43 * $0700 pages UP from $4000, so GrfDrv can load
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
44
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
45 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
46 * The system's memory map is set up as:
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
47 * $0000-$1FFF: block 0, global system memory
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
48 * $2000-$3FFF: this block MUST be free: grfdrv is loaded here on boot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
49 * once booted, process descriptors, etc. get allocated here
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
50 * $4000-$46FF: initial data storage for system prior to loading GrfDrv
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
51 * $4700-$ECFF: OS9Boot file: $A600 maximum size
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
52 * $ED00-$FEFF: kernel, and constant page at $FE00
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
53 * $FF00-$FFFF: hardware, and RAM under block $3F that's unused by everyone!
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
54 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
55
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
56 maxOS9Bt equ $A600 max. size of the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
57
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
58 org 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
59 OS9Boot rmb maxOS9Bt
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
60 Kernel rmb $1200 size of the kernel to use
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
61 PrcDsc rmb $0200 current process descriptor
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
62 param.pt rmb 2 parameter pointer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
63 os9btsz rmb 2 size of the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
64 rbflag rmb 2 -b -r flags
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
65 oflag rmb 1 OS9Boot reload flag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
66 kflag rmb 1 kernel reload flag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
67 gflag rmb 1 GrfDrv reload flag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
68 Param rmb $C000-. shift everything up to $C000
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
69 Stack equ .
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
70 GrfDrv rmb $2000 so we now have all of the memory full
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
71 SIZE equ .
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
72
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
73 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
74 * We'll put all of the 'magic' code in GrfDrv's stack, which doesn't
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
75 * care about being uninitialize
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
76 *
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
77 * Actually, this program puts it at offset $0000 in block $3F,
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
78 * which is $E000 when the system is rebooted. BOOT then copies
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
79 * all of the information down to $1C80 before loading in the new OS9Boot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
80 * file, and copying the original BOOT module back to $ED00+$0130
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
81 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
82 org $1C80 where memory is ALWAYS mapped in
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
83 os9.siz rmb 2 size of the os9boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
84 grf.flg rmb 1 flag: reload GrfDrv?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
85 os9.dat rmb 16 DAT image
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
86 boot rmb $01D0 original BOOT module
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
87
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
88 NAME fcs /ReBoot/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
89 fcb $01
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
90
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
91 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
92 * Start of the program: Move the stack to lower memory, and
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
93 * copy the parameters there, too.
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
94 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
95 Start lds #stack point the stack to somewhere safe
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
96 tfr d,y now Y = size of the parameter area
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
97 ldu #param U=$0000 always in the Coco, so this is OK
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
98
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
99 s.copy lda ,x+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
100 sta ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
101 leay -1,y
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
102 bne s.copy
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
103
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
104 clra
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
105 sta >oflag no os9boot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
106 sta >kflag no kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
107 sta >gflag no GrfDrv
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
108 sta >rbflag default to allowing '-r -b' options
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
109
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
110 ldx #Param point to the start of the parameters again
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
111 stx >param.pt save pointer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
112
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
113 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
114 * Check for more parameters
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
115 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
116 Check ldx >param.pt get the current parameter pointer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
117 check.p ldd ,x
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
118 cmpa #C$SPAC skip leading spaces
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
119 bne Contin
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
120 leax 1,x
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
121 bra check.p
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
122
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
123 Contin cmpa #C$CR simply reboot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
124 bne Hy check for hyphens
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
125 tst >rbflag are the '-r' '-b' options valid?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
126 lbne Finalize no, finalize the boot, and reboot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
127 lbra CrashIt yes, go ahead and crash the system.
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
128
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
129 Hy cmpa #'- hyphen?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
130 lbne Help
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
131 cmpb #'? help?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
132 lbeq Help
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
133 andb #$DF make uppercase
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
134 tst >rbflag are the '-r' '-b' options valid?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
135 bne o.flag no, skip ahead to checking other flags
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
136 cmpb #'B
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
137 lbeq CrashIt
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
138
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
139 cmpb #'R reboot?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
140 lbeq LoadIt
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
141
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
142 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
143 * Only -L -K -G options are valid here
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
144 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
145 o.flag cmpb #'L load the OS9Boot file?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
146 lbeq load.os9 yes, go load it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
147
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
148 cmpb #'K load the kernel file?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
149 lbeq load.krn yes, go load it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
150
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
151 cmpb #'G load GrfDrv?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
152 lbne Help no, print out a help message
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
153
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
154 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
155 * load in GrfDrv
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
156 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
157 load.grf tst >gflag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
158 lbne Help
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
159 stb >gflag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
160 ldu #grfdrv where to put grfdrv
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
161 ldy #$2000 the maximum size it can be
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
162 bsr load.fil
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
163 lbra Check check for more options
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
164
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
165 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
166 * Load in the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
167 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
168 load.krn tst >kflag already loaded the kernel?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
169 lbne Help yes, print error
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
170 stb >kflag we're loading the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
171 ldu #kernel where to put the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
172 ldy #$1200 the size of the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
173 bsr load.fil load in the kernel file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
174 lbra Check check for more options
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
175
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
176 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
177 * load the specified file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
178 * Entry: X = parameter pointer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
179 * Y = maximum size of the file to read
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
180 * U = pointer to load address for the file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
181 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
182 load.fil stb >rbflag don't allow -r -b any more
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
183 leax 2,x skip '-X' option
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
184 lda ,x+ grab the next character
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
185 cmpa #C$SPAC space?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
186 lbne Help no, print help message
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
187
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
188 pshs x save filename for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
189 lda #READ. read-only permissions
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
190 os9 I$Open open the file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
191 lbcs fil.err
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
192
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
193 stx >param.pt save parameter pointer for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
194
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
195 tfr u,x put load address into X
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
196 os9 I$Read read in the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
197 lbcs fil.err
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
198 puls x,pc restore unused X, and exit
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
199
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
200 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
201 * load a new OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
202 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
203 load.os9 tst >oflag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
204 lbne Help
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
205 stb >oflag flag we have an OS9Boot file requested
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
206 stb >rbflag and the '-r' or '-b' options are no longer valid
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
207
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
208 ldu #$0000 where to put the information
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
209 ldy #MaxOS9Bt
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
210 lbsr load.fil go load the file into memory
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
211 sty >os9btsz save the size of the OS9Boot file for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
212 * do some syntax checking on the OS9Boot file...
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
213 lbra Check go check for more parameters
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
214
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
215 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
216 * finalize the crash of the system
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
217 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
218 Finalize lbsr Seek seek /DD to 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
219 os9 F$ID get my ID and process #
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
220 ldx #PrcDsc point to where to put the process descriptor
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
221 os9 F$GPrDsc get it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
222 lbcs Exit
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
223 leax P$DATImg,x point to it's DAT image
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
224
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
225 orcc #IntMasks shut off IRQ's
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
226 lda #$3F block $3F
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
227 sta >$FFA8 map in block $3F
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
228
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
229 lda >oflag do OS9Boot?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
230 bne do.os9bt yup, skip ahead
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
231 lda >gflag OS9Boot OR GrfDrv?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
232 beq do.kern neither one, just do the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
233 lbra Help no OS9Boot, but trying to reload GrfDrv: invalid
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
234
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
235 * copy our DAT image to block 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
236 do.os9bt ldu #$0000 to the start of block $3F
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
237 ldd >os9btsz get the size of the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
238 std ,u++ save it for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
239 lda >gflag do we reload GrfDrv?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
240 sta ,u+ save flag for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
241 ldb #16 copy the whole DAT image...
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
242 dat.lp lda ,x+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
243 sta ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
244 decb
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
245 bne dat.lp
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
246
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
247 lda >kflag do we move the kernel over?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
248 beq no.kern if clear, we don't have a kernel in high memory
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
249
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
250 do.kern pshs u save current pointer to $E000+x
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
251 ldu #$0D00 where to put the new kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
252 ldx #kernel where the new kernel currently is located
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
253 ldy #$1200 the size of the kernel
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
254 bsr bt.lp copy the kernel over a byte at a time
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
255 puls u restore low memory pointer
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
256
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
257 lda >oflag
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
258 ora >gflag OS9Boot OR GrfDrv?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
259 lbeq LoadIt.0 nope, just the kernel: reboot quickly
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
260
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
261 * copy the original BOOT module to block 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
262 no.kern ldx #$0D00+$0130 block 0, offset $0D00+REL
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
263 bsr bt.copy
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
264 leax eom,pc point to the end of the module
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
265 ldu #$0D00+$0130 over top of the original BOOT module
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
266 bsr bt.copy
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
267 lbra LoadIt.0 and go re-load the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
268
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
269 bt.copy ldy #$01D0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
270 bt.lp lda ,x+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
271 sta ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
272 leay -1,y
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
273 bne bt.lp
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
274 rts
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
275
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
276 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
277 * crash the system
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
278 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
279 CrashIt lbsr Seek seek /DD to track 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
280 orcc #IntMasks turn off IRQ's
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
281 clrb
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
282 stb >$FFA8 map in block 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
283 stb >$0071 cold reboot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
284 lda #$38 bottom of DECB block mapping
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
285 sta >$FFA8 map in block zero
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
286 stb >$0071 and cold reboot here, too
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
287 ldu #$0000 force code to go at offset $0000
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
288 leax ReBoot,pc reboot code
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
289 ldy #BtSize
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
290 cit.loop lda ,x+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
291 sta ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
292 leay -1,y
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
293 bne cit.loop
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
294 clr >$FEED cold reboot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
295 clr >$FFD8 go to low speed
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
296 jmp >$0000 jump to the reset code
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
297
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
298 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
299 * reboot the system
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
300 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
301 ReBoot ldd #$3808 block $38, 8 times
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
302 ldx #$FFA0 where to put it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
303 Lp sta 8,x put into map 1
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
304 sta ,x+ and into map 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
305 inca
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
306 decb count down
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
307 bne Lp
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
308
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
309 lda #$4C standard DECB mapping
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
310 sta >$FF90
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
311 clr >$FF91 go to map type 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
312 clr >$FFDE and to all-ROM mode
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
313 ldd #$FFFF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
314 * clrd executes as CLRA on a 6809
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
315 fdb $104F
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
316 tstb is it a 6809?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
317 bne Reset yup, skip ahead
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
318 * ldmd #$00 go to 6809 mode!
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
319 fcb $11,$3D,$00
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
320 Reset jmp [$FFFE] do a reset
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
321 BtSize equ *-Reboot
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
322
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
323 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
324 * reload the OS9Boot file
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
325 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
326 LoadIt lbsr Seek seek /DD to track 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
327 orcc #IntMasks
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
328 LoadIt.0 clr >$FFA8 map in block 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
329 ldu #$0520 somewhere unused
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
330 leax <ReLoad,pc point to code to reboot the system
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
331 ldy #LoadSiz
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
332 lit.loop lda ,x+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
333 sta ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
334 leay -1,y
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
335 bne lit.loop
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
336 jmp >$0520 and jump to it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
337
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
338 ReLoad clr >$FF91 go to map type 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
339 ldx #$ED00 where REL is located
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
340
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
341 RLp leax 1,x to to the next byte (OS...)
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
342 ldd ,x
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
343 cmpd #M$ID12
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
344 bne RLp if not the start of a module
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
345 ldd M$Exec,x get execution address of the module (REL)
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
346 jmp d,x and go to it
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
347 LoadSiz equ *-ReLoad
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
348
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
349 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
350 * print out the help message
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
351 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
352 Help leax HMsg,pc
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
353 ldy #HLen
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
354 Print lda #1 to STDOUT
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
355 os9 I$Write
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
356 ClnExit clrb
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
357 Exit os9 F$Exit
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
358
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
359 HMsg fcc /ReBoot: Reboots the system, or returns to DECB./
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
360 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
361 fcc / use: reboot [-b] [-r] [-k filename] [-l filename]/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
362 fcc / [-g filename]/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
363 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
364 fcc / -b = return to DECB (default)/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
365 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
366 fcc / ( equivalent to <CTRL><ALT><RESET> )/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
367 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
368 fcc / -r = reload OS9Boot/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
369 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
370 fcc / ( equivalent to pressing <RESET> )/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
371 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
372 fcc /** The previous 2 options are mutually exclusive to the/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
373 fcc / next 3.**/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
374 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
375 fcc / -k [filename] = load in a new kernel track from [filename]/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
376 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
377 fcc / -l [filename] = reload the OS9Boot file from [filename]/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
378 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
379 fcc / -g [filename] = load in a new GrfDrv from [filename]/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
380 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
381 fcc / If you reload GrfDrv, you MUST also reload the/
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
382 fcc / OS9Boot file./
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
383 fcb C$CR,C$LF
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
384 HLen equ *-HMsg
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
385
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
386 DD fcs '/DD'
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
387
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
388 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
389 * Seek /DD to sector 0... why not?
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
390 *==================================================================
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
391 Seek leax <DD,pc
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
392 lda #READ.
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
393 os9 I$Open
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
394 bcs seek.ex
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
395 ldx #$0000
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
396 ldu #$0000
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
397 os9 I$Seek restore head on /DD to track 0
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
398 os9 I$Close
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
399 seek.ex rts
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
400
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
401 fil.err puls u restore pointer to filename we had error with
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
402 pshs b,cc save error code, condition
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
403 leax >fil.msg,pc
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
404 ldy #fil.len
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
405 lda #$02 to STDERR
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
406 os9 I$Write
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
407
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
408 * A=$02 still...
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
409 leax ,u
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
410 fil.lp ldb ,u+
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
411 cmpb #C$SPAC
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
412 bhi fil.lp
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
413 ldb #C$CR get a CR
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
414 stb -1,u save for later
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
415
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
416 ldy #$0100 maximum amount of junk to write
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
417 os9 I$WritLn dump out the filename
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
418 puls b,cc restore error code, condition
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
419 os9 F$Exit and exit
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
420
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
421 fil.msg fcc /ReBoot: Error reading file: /
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
422 fil.len equ *-fil.msg
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
423
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
424 fcc 'MAGIC Boot Module is next!'
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
425
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
426 emod
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
427 eom equ *
53553cdc265c New commands added to standard CMDS
boisy
parents:
diff changeset
428 end