comparison 3rdparty/packages/sierra/objs/sierra.asm @ 989:979b7f290efc

First pass disassembly and comments. Comments from 1992 disasm included. Requires Level 2 defs set Level equ 2 in this file should be in a defsfile.
author pwz
date Fri, 21 Feb 2003 04:34:39 +0000
parents fd9d07c31d20
children 3c51c59f97c4
comparison
equal deleted inserted replaced
988:cf18a377dd4b 989:979b7f290efc
1 * Kings Quest III - Sierra module. 1 ********************************************************************
2 * 2 * SIERRA - Kings Quest III set up module
3 * Patch to correct use of wrong register when determining monitor type. 3 *
4 * Game will now start up in the same mode (RGB or composite) that was 4 * $Id$
5 * active when the game was started. The -R option also works now. 5 *
6 * Ed. Comments Who YY/MM/DD
7 * ------------------------------------------------------------------
8 * 0 Disassembly of original distribution and PWZ 03/01/31
9 * merged in comments from disasm dated 1992
10
11 * Header for : sierra
12 * Module size: $561 #1377
13 * Module CRC : $E178D8 (Good)
14 * Hdr parity : $4C
15 * Exec. off : $0014 #20
16 * Data size : $1FFF #8191
17 * Edition : $00 #0
18 * Ty/La At/Rv: $11 $81
19 * Prog mod, 6809 Obj, re-ent, R/O
20
21
22 ***** The following patch is NOT included in this disassembly *****
23 ***** Will be included in the next revision *****
24 * Patch to correct use of wrong register when determining monitor
25 * type. Game will now start up in the same mode (RGB or composite)
26 * that was active when the game was started.
27 * The -R option also works now.
6 * 28 *
7 * l sierra 29 * l sierra
8 * c 177 a7 e7 30 * c 177 a7 e7
9 * c 17b 84 c4 31 * c 17b 84 c4
10 * c 17d b7 f7 32 * c 17d b7 f7
11 * v 33 * v
12 34
13 L0000 fcb $87,$CD,$05,$61,$00,$0D,$11,$81 .M.a.... 35
14 L0008 fcb $4C,$00,$14,$1F,$FF,$73,$69,$65 L....sie 36 * Required Level 2 definitions
15 L0010 fcb $72,$72,$E1,$00,$16,$00,$66,$16 rra...f. 37 Level equ 2
16 L0018 fcb $00,$C1,$00,$41,$47,$49,$20,$28 .A.AGI ( 38
17 L0020 fcb $63,$29,$20,$63,$6F,$70,$79,$72 c) copyr 39 *Monitor defs
18 L0028 fcb $69,$67,$68,$74,$20,$31,$39,$38 ight 198 40 COMP equ 0
19 L0030 fcb $38,$20,$53,$49,$45,$52,$52,$41 8 SIERRA 41 RGB equ 1
20 L0038 fcb $20,$4F,$6E,$2D,$4C,$69,$6E,$65 On-Line 42 MONO equ 2
21 L0040 fcb $43,$6F,$43,$6F,$33,$20,$76,$65 CoCo3 ve 43
22 L0048 fcb $72,$73,$69,$6F,$6E,$20,$62,$79 rsion by 44
23 L0050 fcb $20,$43,$68,$72,$69,$73,$20,$49 Chris I 45 * I/O path definitions
24 L0058 fcb $64,$65,$6E,$00,$55,$73,$61,$67 den.Usag 46 StdIn equ 0
25 L0060 fcb $65,$3A,$20,$53,$69,$65,$72,$72 e: Sierr 47 StdOut equ 1
26 L0068 fcb $61,$20,$2D,$52,$67,$62,$20,$2D a -Rgb - 48 StdErr equ 2
27 L0070 fcb $4D,$75,$6C,$74,$69,$74,$61,$73 Multitas 49
28 L0078 fcb $6B,$69,$6E,$67,$0D,$1F,$40,$83 king..@. 50 nam sierra
29 L0080 fcb $04,$FF,$DD,$00,$8D,$16,$17,$00 ..]..... 51 ttl program module
30 L0088 fcb $91,$DC,$00,$27,$52,$FC,$FF,$A9 .\.'R..) 52
31 L0090 fcb $DD,$0A,$86,$00,$97,$11,$9E,$24 ]......$ 53 * Disassembled 03/01/29 23:22:42 by Disasm v1.6 (C) 1988 by RML
32 L0098 fcb $BD,$06,$59,$39,$A6,$80,$81,$0D =.Y9&... 54
33 L00A0 fcb $27,$38,$81,$2D,$26,$F6,$A6,$80 '8.-&v&. 55 ifp1
34 L00A8 fcb $8A,$20,$81,$72,$27,$14,$81,$6D . .r'..m 56 use os9defs
35 L00B0 fcb $27,$20,$86,$01,$30,$8D,$FF,$A4 ' ..0..$ 57 use scfdefs
36 L00B8 fcb $10,$8E,$00,$21,$10,$3F,$8C,$5F ...!.?._ 58 endc
37 L00C0 fcb $20,$1D,$34,$10,$86,$01,$C6,$92 .4...F. 59 tylg set Prgrm+Objct
38 L00C8 fcb $8E,$00,$01,$10,$3F,$8E,$35,$10 ....?.5. 60 atrv set ReEnt+rev
39 L00D0 fcb $20,$CA,$86,$01,$A7,$8D,$FF,$42 J..'..B 61 rev set $01
40 L00D8 fcb $20,$C2,$39,$17,$00,$55,$5F,$10 B9..U_. 62 mod eom,name,tylg,atrv,start,size
41 L00E0 fcb $3F,$06,$00,$0C,$02,$2E,$06,$09 ?....... 63
42 L00E8 fcb $04,$20,$10,$1B,$11,$3D,$17,$29 . ...=.) 64 u0000 rmb 2 holds size of data area
43 L00F0 fcb $33,$3F,$00,$08,$14,$18,$20,$28 3?.... ( 65 u0002 rmb 1 MMU block # mapped into block #2 -org
44 L00F8 fcb $22,$38,$07,$0B,$16,$1F,$27,$2D "8....'- 66 u0003 rmb 1 MMU block # mapped into block #3 -org
45 L0100 fcb $37,$3F,$00,$00,$00,$00,$53,$68 7?....Sh 67 u0004 rmb 2 Hi res screen start address
46 L0108 fcb $64,$77,$0D,$53,$63,$72,$6E,$0D dw.Scrn. 68 u0006 rmb 2 Hi res screen end address ?????
47 L0110 fcb $4D,$6E,$4C,$6E,$0D,$00,$00,$00 MnLn.... 69 u0008 rmb 1 disasm as u0008 rmb 2
48 L0118 fcb $00,$00,$17,$00,$23,$17,$00,$8F ....#... 70 u0009 rmb 1 MMU Block # SIERRA is in -org
49 L0120 fcb $17,$00,$D7,$17,$02,$F3,$25,$11 ..W..s%. 71 u000A rmb 1 double byte MMU Task 1 block 1
50 L0128 fcb $17,$00,$FE,$25,$09,$17,$01,$3B ...%...; 72 u000B rmb 1 value actually resides here
51 L0130 fcb $25,$01,$39,$17,$02,$00,$17,$02 %.9..... 73 u000C rmb 1
52 L0138 fcb $37,$17,$03,$81,$17,$02,$49,$39 7.....I9 74 u000D rmb 1
53 L0140 fcb $8E,$00,$02,$CC,$00,$00,$ED,$81 ...L..m. 75 u000E rmb 1
54 L0148 fcb $9C,$00,$25,$FA,$A6,$8D,$FE,$CA ..%z&..J 76 u000F rmb 1
55 L0150 fcb $B7,$01,$73,$CC,$06,$CE,$DD,$53 7.sL.N]S 77 u0010 rmb 1
56 L0158 fcb $DD,$55,$86,$5C,$B7,$01,$01,$86 ]U.\7... 78 u0011 rmb 3
57 L0160 fcb $17,$B7,$01,$D8,$86,$0F,$B7,$02 .7.X..7. 79 u0014 rmb 2 Hi res screen start address
58 L0168 fcb $3F,$CC,$00,$00,$DD,$4F,$86,$01 ?L..]O.. 80 u0016 rmb 2 Hi res screen end address ???
59 L0170 fcb $C6,$92,$10,$3F,$8D,$1F,$10,$E7 F..?...' 81 u0017 rmb 4
60 L0178 fcb $8D,$FF,$9E,$C4,$01,$F7,$05,$53 .....7.S 82 u001C rmb 2
61 L0180 fcb $8E,$00,$01,$86,$01,$C6,$92,$10 .....F.. 83 u001E rmb 4
62 L0188 fcb $3F,$8E,$86,$32,$B7,$02,$46,$CC ?..27.FL 84 u0022 rmb 1
63 L0190 fcb $60,$00,$DD,$46,$86,$15,$B7,$02 `.]F..7. 85 u0023 rmb 1
64 L0198 fcb $48,$86,$FF,$C6,$0F,$8E,$05,$32 H..F...2 86 u0024 rmb 2
65 L01A0 fcb $8D,$01,$39,$A7,$80,$5A,$26,$FB ..9'.Z&. 87 u0026 rmb 2
66 L01A8 fcb $39,$EF,$81,$5A,$26,$FB,$39,$1A 9o.Z&.9. 88 u0028 rmb 2
67 L01B0 fcb $50,$8E,$00,$02,$9F,$22,$B6,$FF P...."6. 89 u002A rmb 2 saves stack pointer of caller to sub659
68 L01B8 fcb $AF,$97,$08,$7F,$FF,$A9,$FC,$20 /...). 90 u002C rmb 2
69 L01C0 fcb $50,$84,$1F,$C3,$20,$43,$DD,$43 P..C C]C 91 u002E rmb 16
70 L01C8 fcb $F6,$20,$50,$C4,$E0,$54,$54,$54 v PD`TTT 92 u003E rmb 1
71 L01D0 fcb $54,$54,$8E,$FF,$A0,$A6,$85,$97 TT.. &.. 93 u003F rmb 2
72 L01D8 fcb $42,$B7,$FF,$A9,$9E,$43,$EC,$1F B7.).Cl. 94 u0041 rmb 1
73 L01E0 fcb $ED,$8D,$FF,$1E,$EC,$01,$ED,$8D m...l.m. 95 u0042 rmb 1 MMU Block # of SIERRA's dsc.
74 L01E8 fcb $FF,$1A,$EC,$1D,$ED,$1F,$ED,$01 ..l.m.m. 96
75 L01F0 fcb $1F,$98,$FD,$FF,$A9,$DD,$02,$1C ....)].. 97 u0043 rmb 2
76 L01F8 fcb $AF,$39,$32,$7E,$30,$8D,$03,$4F /92~0..O 98 u0045 rmb 1 flag after color table sets
77 L0200 fcb $AF,$E4,$30,$8D,$02,$D4,$CE,$06 /d0..TN. 99 u0046 rmb 2
78 L0208 fcb $59,$A6,$80,$A7,$C0,$AC,$E4,$25 Y&.'@,d% 100 u0048 rmb 2
79 L0210 fcb $F8,$30,$8D,$02,$A8,$AF,$E4,$30 x0..(/d0 101 u004A rmb 5
80 L0218 fcb $8D,$02,$37,$CE,$05,$EE,$A6,$80 ..7N.n&. 102 u004F rmb 4
81 L0220 fcb $A7,$C0,$AC,$E4,$25,$F8,$32,$62 '@,d%x2b 103 u0053 rmb 2 monitor type
82 L0228 fcb $39,$1F,$98,$5C,$DD,$1C,$C3,$02 9..\].C. 104 u0055 rmb 10
83 L0230 fcb $02,$DD,$1E,$C3,$02,$02,$97,$5F .].C..._ 105 u005F rmb 163
84 L0238 fcb $DD,$0C,$DD,$0E,$CE,$00,$1A,$DF ].].N.._ 106
85 L0240 fcb $28,$30,$8D,$FE,$C1,$17,$01,$88 (0..A... 107 *u0102 rmb 327 ---disassembly
86 L0248 fcb $25,$20,$CE,$00,$12,$DF,$26,$30 % N.._&0 108
87 L0250 fcb $8D,$FE,$B8,$17,$01,$7A,$25,$12 ..8..z%. 109 u0102 rmb 113
88 L0258 fcb $CE,$00,$0A,$DF,$24,$30,$8D,$FE N.._$0.. 110 mtf173 rmb 1 multitasking flag
89 L0260 fcb $AF,$17,$01,$6C,$33,$C9,$20,$00 /..l3I . 111 scr174 rmb 1 screen number?
90 L0268 fcb $DF,$2E,$39,$32,$7C,$86,$01,$C6 _.92|..F 112 x01076 rmb 212
91 L0270 fcb $8B,$8E,$00,$04,$10,$3F,$8E,$25 .....?.% 113 u0249 rmb 1
92 L0278 fcb $6D,$1F,$20,$F7,$01,$74,$17,$01 m. w.t.. 114 u024A rmb 1
93 L0280 fcb $35,$DF,$04,$DF,$14,$30,$89,$40 5_._.0.@ 115 u024B rmb 1
94 L0288 fcb $00,$17,$01,$2A,$DF,$06,$DF,$16 ...*_._. 116 u024C rmb 497
95 L0290 fcb $CE,$D8,$00,$8E,$78,$00,$CC,$00 NX..x.L. 117
96 L0298 fcb $00,$ED,$C3,$30,$1E,$26,$FA,$4F .mC0.&zO 118 *u043D rmb 7106 ---disassembly
97 L02A0 fcb $F6,$01,$74,$1F,$02,$86,$01,$C6 v.t....F 119
98 L02A8 fcb $8C,$10,$3F,$8E,$25,$38,$30,$8D ..?.%80. 120 u043D rmb 433
99 L02B0 fcb $FE,$30,$F6,$05,$53,$86,$10,$3D .0v.S..= 121 int5EE rmb 107 Signal Intercept routine from 452 - 4BD
100 L02B8 fcb $3A,$86,$1B,$A7,$E4,$86,$31,$A7 :..'d.1' 122 sub659 rmb 116 Slot to hold subroutine for others uses at 4DA - 54F
101 L02C0 fcb $61,$4F,$A7,$62,$10,$8E,$00,$04 aO'b.... 123 u0xxx rmb 6450
102 L02C8 fcb $E6,$80,$E7,$63,$34,$10,$86,$01 f.gc4... 124 size equ .
103 L02D0 fcb $30,$62,$10,$3F,$8A,$25,$0F,$35 0b.?.%.5 125 name equ *
104 L02D8 fcb $10,$6C,$62,$A6,$62,$81,$10,$25 .lb&b..% 126 fcs /sierra/
105 L02E0 fcb $E7,$0F,$45,$17,$00,$03,$32,$64 g.E...2d 127 fcb $00
106 L02E8 fcb $39,$32,$E8,$E0,$86,$00,$C6,$00 92h`..F. 128
107 L02F0 fcb $30,$E4,$10,$3F,$8D,$25,$3B,$A6 0d.?.%;& 129 start equ *
108 L02F8 fcb $8D,$FE,$1A,$E6,$04,$A7,$04,$E7 ...f.'.g 130 L0014 lbra L007D branch to entry process params
109 L0300 fcb $8D,$FE,$12,$A6,$8D,$FE,$0F,$E6 ...&...f 131 L0017 lbra L00DB branch to clean up routines
110 L0308 fcb $0C,$A7,$0C,$E7,$8D,$FE,$07,$A6 .'.g...& 132
111 L0310 fcb $8D,$FE,$04,$E6,$88,$10,$A7,$88 ...f..'. 133
112 L0318 fcb $10,$E7,$8D,$FD,$FA,$A6,$8D,$FD .g..z&.. 134 * Multi-tasking flag (0=No multitask, 1=multitask)
113 L0320 fcb $F7,$E6,$88,$11,$A7,$88,$11,$E7 wf..'..g 135 L001A fcb $00 we store a value here
114 L0328 fcb $8D,$FD,$ED,$86,$00,$C6,$00,$10 ..m..F.. 136 * the "old self modifying code" trick
115 L0330 fcb $3F,$8E,$32,$E8,$20,$39,$32,$7E ?.2h 92~ 137
116 L0338 fcb $7D,$01,$74,$27,$30,$17,$FF,$A9 }.t'0..) 138
117 L0340 fcb $25,$2B,$86,$1B,$A7,$E4,$86,$30 %+..'d.0 139 * Text strings think this was probably an Info thing
118 L0348 fcb $A7,$61,$10,$8E,$00,$02,$86,$01 'a...... 140 L001B fcc 'AGI (c) copyright 1988 SIERRA On-Line'
119 L0350 fcb $30,$E4,$10,$3F,$8A,$25,$16,$C6 0d.?.%.F 141 fcc 'CoCo3 version by Chris Iden'
120 L0358 fcb $8C,$10,$8E,$00,$00,$10,$3F,$8E ......?. 142 fcb $00
121 L0360 fcb $4F,$F6,$01,$74,$1F,$02,$86,$01 Ov.t.... 143 Infosz equ *-L001B
122 L0368 fcb $C6,$8D,$10,$3F,$8E,$32,$62,$39 F..?.2b9 144
123 L0370 fcb $30,$8D,$FD,$92,$86,$11,$17,$00 0....... 145
124 L0378 fcb $92,$30,$8D,$FD,$8E,$17,$00,$8B .0...... 146 * Useage text string
125 L0380 fcb $30,$8D,$FD,$8C,$17,$00,$84,$39 0......9 147 L005C fcc 'Usage: Sierra -Rgb -Multitasking'
126 L0388 fcb $1A,$50,$96,$42,$B7,$FF,$A9,$9E .P.B7.). 148 fcb C$CR
127 L0390 fcb $43,$EC,$8D,$FD,$6F,$ED,$01,$F7 Cl..om.w 149 Usgsz equ *-L005C
128 L0398 fcb $FF,$AA,$EC,$8D,$FD,$64,$ED,$1F .*l..dm. 150
129 L03A0 fcb $F7,$FF,$A9,$1C,$AF,$4F,$E6,$8D w.)./Of. 151
130 L03A8 fcb $FD,$6F,$C4,$03,$1F,$01,$86,$01 .oD..... 152 L007D tfr s,d save stack ptr / start of param ptr into d
131 L03B0 fcb $C6,$92,$10,$3F,$8E,$39,$1F,$10 F..?.9.. 153 *
132 L03B8 fcb $1E,$89,$54,$54,$54,$54,$54,$34 ..TTTTT4 154 subd #$04FF start of stack/end of data mem ptr
133 L03C0 fcb $04,$CE,$FF,$A8,$A6,$C5,$5C,$C4 .N.(&E\D 155 std <u0000 store this value in user var
134 L03C8 fcb $07,$E6,$C5,$1F,$03,$35,$02,$39 .fE..5.9 156 bsr L009C branch to input processer routine
135 L03D0 fcb $32,$78,$EF,$E4,$AF,$62,$86,$11 2xod/b.. 157
136 L03D8 fcb $10,$3F,$22,$25,$2B,$AE,$62,$10 .?"%+.b. 158 L0086 lbsr L011A relay call to L0140
137 L03E0 fcb $3F,$00,$25,$24,$EF,$66,$1F,$31 ?.%$of.1 159
138 L03E8 fcb $AF,$64,$17,$FF,$C9,$AE,$E4,$30 /d..I.d0 160 L0089 ldd <u0000 load the data pointer
139 L03F0 fcb $86,$1E,$03,$A7,$84,$1E,$03,$81 ...'.... 161 beq L00DF if it is zero we have a problem
140 L03F8 fcb $06,$27,$08,$AE,$64,$30,$89,$20 .'..d0. 162 ldd >$FFA9 ??? MMU task 1 block 1 ???
141 L0400 fcb $00,$20,$E5,$EE,$66,$10,$3F,$02 . enf.?. 163 std <u000A save the task 1 block one value
142 L0408 fcb $32,$68,$39,$10,$3F,$1D,$24,$FB 2h9.?.$. 164 lda #$00
143 L0410 fcb $5F,$39,$2F,$56,$49,$0D,$00,$00 _9/VI... 165 sta <u0011
144 L0418 fcb $00,$CE,$00,$00,$8E,$05,$EE,$10 .N....n. 166 ldx <u0024
145 L0420 fcb $3F,$09,$86,$01,$30,$8D,$FF,$EB ?...0..k 167 jsr sub659 code at L04DA plays with mmu blocks
146 L0428 fcb $10,$3F,$80,$25,$24,$EF,$8D,$FF .?.%$o.. 168 rts
147 L0430 fcb $E5,$30,$8D,$FF,$DD,$10,$3F,$84 e0..].?. 169
148 L0438 fcb $25,$17,$A7,$8D,$FF,$DA,$C6,$CA %.'..ZFJ 170 * Process any command line args
149 L0440 fcb $8E,$00,$0C,$10,$3F,$8E,$25,$09 ....?.%. 171 * See F$Fork description 8-15 for entry conditions
150 L0448 fcb $34,$10,$C6,$C8,$10,$3F,$8E,$35 4.FH.?.5 172
151 L0450 fcb $06,$39,$C1,$80,$26,$0E,$1F,$30 .9A.&..0 173 L009C lda ,x+ get next char after name string
152 L0458 fcb $1F,$8B,$0A,$4A,$26,$06,$8D,$05 ...J&... 174 cmpa #C$CR is it a CR?
153 L0460 fcb $86,$03,$97,$4A,$3B,$6C,$C9,$02 ...J;lI. 175 beq L00DA yes exit from routine
154 L0468 fcb $4C,$26,$10,$6C,$C9,$02,$4B,$26 L&.lI.K& 176 cmpa #$2D is it a dash '-
155 L0470 fcb $0A,$6C,$C9,$02,$4A,$26,$04,$6C .lI.J&.l 177 bne L009C not a dash go look again
156 L0478 fcb $C9,$02,$49,$6D,$C9,$01,$02,$26 I.ImI..& 178
157 L0480 fcb $3B,$0C,$3F,$26,$02,$0C,$3E,$DC ;.?&..>\ 179 lda ,x+ was as dash get the next char
158 L0488 fcb $48,$C3,$00,$01,$DD,$48,$10,$83 HC..]H.. 180 ora #$20 apply mask to lower case
159 L0490 fcb $00,$14,$25,$28,$83,$00,$14,$DD ..%(...] 181 cmpa #$72 is it a 'r ?
160 L0498 fcb $48,$CC,$00,$3C,$30,$C9,$04,$3D HL.<0I.= 182 beq L00C2 yep go set up for RGB monitor
161 L04A0 fcb $6C,$84,$E1,$84,$22,$16,$A7,$80 l.a.".'. 183 cmpa #$6D is it an 'm ?
162 L04A8 fcb $6C,$84,$E1,$84,$22,$0E,$A7,$80 l.a.".'. 184 beq L00D2 if so go store a flag and continue
163 L04B0 fcb $6C,$84,$C6,$18,$E1,$84,$22,$04 l.F.a.". 185
164 L04B8 fcb $A7,$80,$6C,$84,$39,$A6,$8D,$FF '.l.9&.. 186 * We've found something other than Mm or Rr after a dash
165 L04C0 fcb $57,$27,$0D,$C6,$C9,$10,$3F,$8E W'.FI.?. 187 * write usage message and Exit program
166 L04C8 fcb $C6,$CB,$10,$3F,$8E,$10,$3F,$8F FK.?..?. 188
167 L04D0 fcb $EE,$8D,$FF,$42,$27,$03,$10,$3F n..B'..? 189 lda #StdOut load path std out
168 L04D8 fcb $81,$39,$EC,$E1,$DD,$2A,$1A,$50 .9la]*.P 190 leax >L005C,pcr load address of message
169 L04E0 fcb $96,$42,$A7,$84,$B7,$FF,$A9,$DE .B'.7.)^ 191 ldy #Usgsz $0021 load the size of the message
170 L04E8 fcb $43,$A6,$06,$A7,$4C,$B7,$FF,$AF C&.'L7./ 192 os9 I$WritLn write it
171 L04F0 fcb $A6,$05,$A7,$4A,$B7,$FF,$AE,$A6 &.'J7..& 193 clrb clear the error code (unneeded branch to L00DE)
172 L04F8 fcb $04,$A7,$48,$B7,$FF,$AD,$A6,$03 .'H7.-&. 194 bra L00DF and branch to exit!
173 L0500 fcb $A7,$46,$B7,$FF,$AC,$A6,$02,$A7 'F7.,&.' 195
174 L0508 fcb $44,$B7,$FF,$AB,$1C,$AF,$A6,$07 D7.+./&. 196 * found a "-r"
175 L0510 fcb $DE,$2E,$AB,$4A,$AD,$C6,$1A,$50 ^.+J-F.P 197 L00C2 pshs x save x-reg since set stat call uses it
176 L0518 fcb $96,$42,$B7,$FF,$A9,$DE,$43,$96 .B7.)^C. 198 lda #StdOut $01 set the path number
177 L0520 fcb $10,$A7,$4C,$B7,$FF,$AF,$96,$0F .'L7./.. 199 ldb #SS.Montr code #$92 sets the monitor type
178 L0528 fcb $A7,$4A,$B7,$FF,$AE,$96,$0E,$A7 'J7....' 200 ldx #RGB monitor type code $0001
179 L0530 fcb $48,$B7,$FF,$AD,$96,$0D,$A7,$46 H7.-..'F 201 os9 I$SetStt set it up
180 L0538 fcb $B7,$FF,$AC,$96,$0B,$A7,$42,$B7 7.,..'B7 202 puls x fetch our x back assumes call doesn't fail
181 L0540 fcb $FF,$AA,$96,$0A,$A7,$C4,$B7,$FF .*..'D7. 203 bra L009C go process the rest of the parms
182 L0548 fcb $A9,$1C,$AF,$6E,$9F,$00,$2A,$00 )./n..*. 204
183 L0550 fcb $00,$00,$00,$00,$00,$00,$00,$73 .......s 205 * found an "-m"
184 L0558 fcb $69,$65,$72,$72,$61,$00,$E1,$78 ierra.ax 206 L00D2 lda #$01 we have found a -m and load a flag
185 L0560 fcb $D8 X 207 sta >L001A,pcr and stow it in our code area (SELF MODIFYING)
208 bra L009C check for next param
209
210 L00DA rts return
211
212
213 * This is just a relay call to L0336
214 L00DB lbsr L0133
215
216 L00DE clrb NOBODY USES ME ?
217 L00DF os9 F$Exit time to check out
218
219 * disassembler had a little problem here
220 L00E2 fdb $000C another prog internal var
221
222 * Are these all data bytes of some kind ???
223 * quirky assemblage of bytes
224 L00E4 fcb $02,$2E,$06,$09,$04,$20,$10,$1B
225 fcb $11,$3D,$17,$29,$33,$3F,$00,$08
226 fcb $14,$18,$20,$28,$22,$38,$07,$0B
227 fcb $16,$1F,$27,$2D,$37,$3F
228
229 * The disaasembly gets confused here with text and the nulls
230 * according to the partial disassembly I recieved these hold
231 * Original MMU block image of second and thrid blocks of SIERRA
232 * MORE SELF MODIFYING CODE
233
234 L0102 fdb $0000 Orig MMU block inage of 2nd blk of sierra
235 L0104 fdb $0000 Orig MMU block inage of 3nd blk of sierra
236
237 * Name strinsg of other modules to load.
238
239 L0106 fcc 'Shdw'
240 fcb C$CR
241
242 L010B fcc 'Scrn'
243 fcb C$CR
244
245 L0110 fcc 'MnLn'
246 fcb C$CR
247
248
249 * Internal variables for self modifying code
250 L0115 fcb $00 Echo
251 L0116 fcb $00 EOF
252 L0117 fcb $00 INTerupt
253 L0118 fcb $00 Quit
254 L0119 fcb $00 Monitor type Coco set to when Sierra ran
255
256
257 * L011A called by L0086
258 L011A lbsr L0140 Clears data area, sets up vars and saves montype
259
260 lbsr L01AF Change our process image to dupe block 0 to 1-2
261 L0120 lbsr L01FA copies two subs to data area so others can use them
262
263 lbsr L0419 load intercept routine and open /VI and allocate Ram
264 bcs L0139 if errors occured close VIRQ device
265
266 lbsr L0229 NMLoads the three other modules and sets up vals
267 bcs L0136 problems then unload them
268
269 lbsr L026B go set up screens
270 bcs L0133 problems deallocate them
271 rts
272
273 * clean up and shut down
274 L0133 lbsr L0336 go deallocate hi res screens
275 L0136 lbsr L0370 unloads the three other modules
276 L0139 lbsr L04BD Close VIRQ device
277 lbsr L0388 restore the MMU blocks
278 rts
279
280 * at this point u0000 contains the value of s on entry minus $04FF
281 * which should be the size of our initialized data
282 * so we don't over write it but clear the rest of the data area
283
284 L0140 ldx #$0002 Init data area from 2-end with 0's
285 ldd #$0000
286 L0146 std ,x++
287 cmpx <u0000 should have the value $04FF
288 bcs L0146 appears this zeros out memory somewhere
289
290 * initialize some variables
291 lda >L001A,pcr multitasking flag from startup parms
292 sta mtf173 >$0173 store it
293
294 ldd #$06CE why twice
295 std <u0053
296 std <u0055
297
298 lda #$5C
299 sta >$0101
300
301 lda #$17
302 sta >$01D8
303
304 lda #$0F
305 sta >$023F
306
307 ldd #$0000
308 std <u004F
309
310 * get current montype
311 * GetStat Function Code $92
312 * Allocates and maps high res screen
313 * into application address space
314 * entry:
315 * a -> path number
316 * b -> function code $92 (SS.Montr)
317 *
318 * exit:
319 * x -> monitor type
320 *
321 * error:
322 * CC -> Carry set on error
323 * b -> error code (if any)
324 *
325 lda #StdOut $01 path number
326 ldb #SS.Montr monitor type code (not listed for getstat $92
327 os9 I$GetStt make the call
328 tfr x,d save in d appears he expects montype returned
329 sta >L0119,pcr trim it to a byte and save it
330 anda #$01 mask out mono type only RGB or COMP
331 sta >$0553 save that value off
332
333 * set current montype
334 * SetStat Function Code $92
335 * Allocates and maps high res screen
336 * into application address space
337 * entry:
338 * a -> path number
339 * b -> function code $92 (SS.Montr)
340 * x -> momitor type
341 * 0 = color composite
342 * 1 = analog RGB
343 * 2 = monochrome composite
344 *
345 * error:
346 * CC -> Carry set on error
347 * b -> error code (if any)
348 *
349 ldx #RGB $0001 set type to RGB again as in L00C2
350 lda #StdOut $01 set the path
351 ldb #SS.Montr Monitor type code $92
352 os9 I$SetStt make the call
353
354 * initialize more variables
355
356 lda #$32
357 sta >$0246
358
359 ldd #$6000 This is the start of high res screen memory
360 std <u0046
361
362 lda #$15
363 sta >$0248
364
365 lda #$FF Init 15 bytes at u0532 to $FF
366 ldb #$0F
367 ldx #$0532
368 bsr L01A3
369 rts
370
371 * Fill routine-one byte pattern
372 * Entry: A=Byte to fill with
373 * B=# bytes to fill
374 * X=Start address of fill
375
376 L01A3 sta ,x+
377 decb
378 bne L01A3
379 rts
380
381 * Fill routine-two byte pattern
382 * Entry: U=2-Byte pattern to fill with
383 * B=# bytes to fill
384 * X=Start address of fill
385 * NO BODY CALLS HERE ??
386 L01A9 stu ,x++
387 decb
388 bne L01A9
389 rts
390
391 * Raw disassembly of followin code
392 *L01AF orcc #$50
393 * ldx #$0002
394 * stx <u0022
395 * lda >$FFAF
396 * sta <u0008
397 * clr >$FFA9
398 * ldd >$2050
399 * anda #$1F
400 * addd #$2043
401 * std <u0043
402 * ldb >$2050
403 * andb #$E0
404 * lsrb
405 * lsrb
406 * lsrb
407 * lsrb
408 * lsrb
409 * ldx #$FFA0
410 * lda b,x
411 * sta <u0042
412 * sta >$FFA9
413 * ldx <u0043
414 * ldd -$01,x
415 * std >L0102,pcr
416 * ldd $01,x
417 * std >L0104,pcr
418 * ldd -$03,x
419 * std -$01,x
420 * std $01,x
421 * tfr b,a
422 * std >$FFA9
423 * std <u0002
424 * andcc #$AF
425 * rts
426
427 **********************************************************
428 * COMMENTS FROM CODE RECIEVED
429 * Change our process map:
430 * Blocks 1-2 become duplicates of block 0 (data area...
431 * changes actual MMU regs themselves &
432 * changes them in our process descriptor
433 *
434 * NOTE: SHOULD CHANGE SO IT MAPS IN BLOCK 0 IN AN UNUSED BLOCK 1ST
435 * TO GET PROCESS DESCRIPTOR DAT IMAGE FOR SIERRA.
436 * THEN, CAN BUMP BLOCKS AROUND WITH THE ACTUAL BLOCK #
437 * IN FULL 2 MB RANGE, INSTEAD OF JUST GIME 512K RANGE.
438
439 L01AF orcc #IntMasks Shut interrupts off
440 ldx #$0002 ???
441 stx <u0022
442
443 * As per above NOTE, should postpone this until we have DAT image
444 * available for Sierra process
445
446 lda >$FFAF Get MMU block # SIERRA is in
447 sta <u0008 Save it
448 clr >$FFA9 Map system block 0 into $2000-$3FFF
449 ldd >D.Proc+$2000 Get SIERRA's process dsc. ptr
450 anda #$1F Keep non-MMU dependent address
451
452 * NOTE: OFFSET IS STUPID, SHOULD USE EVEN BYTE SO LDD'S BELOW
453 * CAN USE FASTER LDD ,X INSTEAD OF OFFSET,X
454
455 addd #$2000+P$DATImg+3 Set up ptr for what we want out of it
456 std <u0043 Save it
457 ldb >D.Proc+$2000 Get MSB of SIERRA's process dsc. ptr
458 andb #$E0 Calculate which 8K block within
459 * system task it's in
460 lsrb
461 lsrb
462 lsrb
463 lsrb
464 lsrb
465
466 * NOTE: HAVE TO CHANGE THIS TO GET BLOCK #'S FROM SYSTEM DAT IMAGE,
467 * NOT RAW GIME REGS (TO WORK WITH >512K MACHINES)
468 ldx #$FFA0 Point to base of System task DAT register set block 0 task 0
469 lda b,x Get block # that has process desc. for SIERRA
470 sta <u0042 Save it
471 sta >$FFA9 Map in block with process dsc. to $2000-$3FFF
472 ldx <u0043 Get offset to 2nd 8K block in DAT map for SIERRA
473 ldd -1,x Get MMU block # of current 2nd 8k block in SIERRA
474 std >L0102,pc Save it
475 ldd 1,x Get MMU block # of current 3rd 8k block in SIERRA
476 std >L0104,pc Save it
477 ldd -3,x Get data area block 3 from sierra (1st block)
478 std -1,x Move 8k data area to 2nd block
479 std 1,x And to 3rd block
480 tfr b,a D=Raw MMU block # for both
481
482 * HAVE TO CHANGE TO ALLOW FOR DISTO DAT EXTENSION
483 std >$FFA9 Map data area block into both blocks 2&3
484 std <u0002 Save both block #'s
485 andcc #^IntMasks Turn interrupts back on
486 rts
487
488
489 * NOTE: 6809/6309 MOD: STUPID. DO LEAX, AND THEN PSHS X
490
491 * load first routine
492 L01FA leas -2,s Make 2 word buffer on stack
493 leax >L054F,pc Point to end of routine
494 stx ,s Save ptr
495 leax >L04DA,pc Point to routine
496 * ldu #$0659 Point to place in data area to copy it
497 ldu #sub659
498 L0209 lda ,x+ Copy routine
499 sta ,u+
500 cmpx ,s Done whole routine yet?
501 blo L0209 No, keep going
502
503 * get next routine interrupt intecept routine
504 leax >L04BD,pcr point to end of routine
505 stx ,s save pointer
506 leax >L0452,pcr point to routine
507 ldu #int5EE point to place in data area to copy it
508 L021E lda ,x+ copy routine
509 sta ,u+
510 cmpx ,s Done whole routine yet?
511 blo L021E No, keep going
512 leas $02,s clean up stack
513 rts return
514
515 * Called from dispatch table at L0120
516 * The last op in the subroutine before this one
517 * was a puls a,b after a puhs x and a setsatt call for process+path to VIRQ
518
519 L0229 tfr b,a don't see what's going on here
520 incb
521 std <u001C but we save off a bunch of values
522
523 addd #$0202
524 std <u001E
525
526 addd #$0202
527 sta <u005F
528 std <u000C
529 std <u000E
530
531 ldu #$001A
532 stu <u0028
533 leax >L0106,pcr shdw
534 lbsr L03D0 NMLoads named module
535 bcs L026A return on error
536
537 ldu #$0012
538 stu <u0026
539 leax >L010B,pcr scrn
540 lbsr L03D0 NMLoads named module
541 bcs L026A return on error
542
543 ldu #$000A
544 stu <u0024
545 leax >L0110,pcr mnln
546 lbsr L03D0 NMLoads named module
547
548 leau >$2000,u
549 stu <u002E
550 L026A rts
551
552 *****************************************************
553 *
554 * Set up screens
555 * SetStat Function Code $8B
556 * Allocates and maps high res screen
557 * into application address space
558 * entry:
559 * a -> path number
560 * b -> function code $8B (SS.AScrn)
561 * x -> screen type
562 * 0 = 640 x 192 x 2 colors (16K)
563 * 1 = 320 x 192 x 4 colors (16K)
564 * 2 = 160 x 192 x 16 colors (16K)
565 * 3 = 640 x 192 x 4 colors (32K)
566 * 4 = 320 x 192 x 16 colors (32K)
567 *
568 * exit:
569 * x -> application address space of screen
570 * y -> screen number (1-3)
571 *
572 * error:
573 * CC -> Carry set on error
574 * b -> error code (if any)
575 *
576 * Call use VDGINT allocates high res graphics for use with screens
577 * updated by the process, does not clear the screens only allocates
578 * See OS-9 Technical Reference 8-142 for more details
579 *
580
581 L026B leas -$04,s mamke room om stack 2 words
582 lda #$01 Std out
583 ldb #SS.AScrn Allocate & map in hi-res screen (VDGINT)
584 ldx #$0004 320x192x16 screen
585 os9 I$SetStt Map it in
586 bcs L02E6 Error, Restore stack & exit
587 tfr y,d Move screen # returned to D
588 * stb >$0174 Save screen #
589 stb scr174 Save screen #
590
591 * call with application address of screen in x
592 * returns with values in u
593 lbsr L03B6 twiddle addresses
594 stu <u0004 stow it two places
595 stu <u0014
596
597 leax >$4000,x end address ???
598 lbsr L03B6 twiddle addresses
599 stu <u0006 stow it in two places
600 stu <u0016
601
602 * TFM for 6309
603 ldu #$D800 Clear hi-res screen to color 0
604 ldx #$7800 Screen is from $6000 to $D800
605 ldd #$0000 (U will end up pointing to beginning of screen)
606 L0299 std ,--u writes 0000 to screen address and decrements
607 leax -2,x decrement x loop counter
608 bne L0299 keep going till all of screen is cleared
609
610 * Display a screen allocated by SS.AScrn
611 * SetStat Function Code $8C
612 *
613 * entry:
614 * a -> path number
615 * b -> function code $8C (SS.DScrn)
616 * y -> screen numbe
617 * 0 = text screen (32 x 16)
618 * 1-3 = high resolution screen
619 *
620 * error:
621 * CC -> Carry set on error
622 * b -> error code (if any)
623
624 clra Get screen # to display
625 ldb scr174
626 tfr d,y Y=screen # to display
627 lda #StdOut $01 Std out path
628 ldb #SS.DScrn Display 320x192x16 screen
629 os9 I$SetStt make the call
630 bcs L02E6
631
632 leax >L00E2,pc values initialized to is $000C
633 ldb >$0553 monitor type
634 lda #$10
635 mul
636 abx add b to x and stow at x
637
638
639 * This loads up the control sequence to set the pallete 1B 31 PRN CTN
640 * PRN palette register 0 - 15, CTN color table 0 - 63
641 lda #$1B Escape code
642 sta ,s push on stack
643 lda #$31 Palette code
644 sta $01,s push on stack
645 clra make a zero palette reg value
646 sta $02,s push it `
647 ldy #$0004 sets up # of bytes to write
648 L02C8 ldb ,x+ get value computed above for color table and bump it
649 stb $03,s push it
650 pshs x save it
651 lda #StdOut $01 Std Out path
652 leax $02,s start of data to write
653 os9 I$Write write it
654 bcs L02E6 error during write clean up stack and leave
655 puls x retrieve our x
656 inc $02,s this is our palette register value
657 lda $02,s we bumped it by one
658 cmpa #$10 we loop 15 times to set them all
659 bcs L02C8 loop
660
661 clr <u0045 clear a flag in memory
662 lbsr L02E9 go disable keyboard interrupts
663 L02E6 leas $04,s clean up stack
664 rts return
665
666
667 * Raw disassembly of following section
668 *L02E9 leas <-$20,s
669 * lda #$00
670 * ldb #$00
671 * leax ,s
672 * os9 I$GetStt
673 * bcs L0332
674 * lda >L0115,pcr
675 * ldb $04,x
676 * sta $04,x
677 * stb >L0115,pcr
678 * lda >L0116,pcr
679 * ldb $0C,x
680 * sta $0C,x
681 * stb >L0116,pcr
682 * lda >L0117,pcr
683 * ldb <$10,x
684 * sta <$10,x
685 * stb >L0117,pcr
686 * lda >L0118,pcr
687 * ldb <$11,x
688 * sta <$11,x
689 * stb >L0118,pcr
690 * lda #$00
691 * ldb #$00
692 * os9 I$SetStt
693 *L0332 leas <$20,s
694 * rts
695
696 * Kills the echo, eof, int and quit signals
697 * get current options packet
698 * GetStat Function Code $00
699 * Reads the options section of the path descriptor and
700 * copies it into the 32 byte area pointed to by reg X`
701 * entry:
702 * a -> path number
703 * b -> function code $00 (SS.OPT)
704 * x -> address to recieve status packet
705 *
706 * error:
707 * CC -> Carry set on error
708 * b -> error code (if any)
709 *
710
711 L02E9 leas <-$20,s Make temp buffer to hold PD.OPT data
712 lda #StdIn $00 Get 32 byte PD.OPT from Std In
713 ldb #SS.OPT $00
714 leax ,s point to our temp buffer
715 os9 I$GetStt make the call
716 bcs L0332 error goto exit sub
717
718 * NOTE: make sure following lines assemble into 5 bit, not 8 bit
719 * These appear to be loading the echo EOF, INT and QUIT with
720 * null values and saving the original ones back to vars
721 * since L0115 - L0118 were initialized with $00
722
723 lda >L0115,pc
724 ldb PD.EKO-PD.OPT,x Get echo option
725 sta PD.EKO-PD.OPT,x change echo option no echo
726 stb >L0115,pc Save original echo option
727
728 lda >L0116,pc
729 ldb PD.EOF-PD.OPT,x Change EOF char
730 sta PD.EOF-PD.OPT,x
731 stb >L0116,pc
732
733 lda >L0117,pc
734 ldb <PD.INT-PD.OPT,x Change INTerrupt char (normally CTRL-C)
735 sta <PD.INT-PD.OPT,x
736 stb >L0117,pc
737
738 lda >L0118,pc
739 ldb <PD.QUT-PD.OPT,x Change QUIT char (normally CTRL-E)
740 sta <PD.QUT-PD.OPT,x
741 stb >L0118,pc
742
743 * set current options packet
744 * SetStat Function Code $00
745 * Writes the options section of the path descriptor
746 * from the 32 byte area pointed to by reg X`
747 * entry:
748 * a -> path number
749 * b -> function code $00 (SS.OPT)
750 * x -> address holding the status packet
751 *
752 * error:
753 * CC -> Carry set on error
754 * b -> error code (if any)
755 *
756
757 * x is still pointing to our temp buff
758 lda #StdIn $00 Set VDG screen to new options
759 ldb #SS.OPT $00
760 os9 I$SetStt set them to be our new values
761
762 L0332 leas <$20,s Eat temp stack & return
763 rts
764
765 * raw disassembly
766 *L0336 leas -$02,s
767 * tst >$0174
768 * beq L036D
769 * lbsr L02E9
770 * bcs L036D
771 ** lda #$1B
772 * sta ,s
773 * lda #$30
774 * sta $01,s
775 * ldy #$0002
776 * lda #$01
777 * leax ,s
778 * os9 I$Write
779 * bcs L036D
780 * ldb #$8C
781 * ldy #$0000
782 * os9 I$SetStt
783 * clra
784 * ldb >$0174
785 * tfr d,y
786 * lda #$01
787 * ldb #$8D
788 * os9 I$SetStt
789 *L036D leas $02,s
790 * rts
791
792
793 * Return the screen to default text sreen and its values
794 * deallocate and free memory of high res screen created
795
796 L0336 leas -2,s Make temp buffer to hold write data
797 * tst >$0174 Any hi-res screen # allocated?
798 tst scr174 Any hi-res screen # allocated?
799 beq L036D No, restore stack & return
800 lbsr L02E9 go change the echo,eof,int and quit settings
801 bcs L036D had an error restore stack and return
802 lda #$1B Setup DefColr sequence in temp buffer
803 sta ,s
804 lda #$30 Sets palettes back to default color
805 sta 1,s
806 ldy #$0002 number of bytes to write
807 lda #StdOut path to write to $01
808 leax ,s point x a buffer
809 os9 I$Write write
810 bcs L036D we have an error clean stack and leave
811
812 * Display a screen allocated by SS.AScrn
813 * SetStat Function Code $8C
814 *
815 * entry:
816 * a -> path number
817 * b -> function code $8C (SS.DScrn)
818 * y -> screen numbe
819 * 0 = text screen (32 x 16)
820 * 1-3 = high resolution screen
821 *
822 * error:
823 * CC -> Carry set on error
824 * b -> error code (if any)
825
826 * a is still set to stdout from above
827 ldb #SS.DScrn Display screen function code
828 ldy #$0000 Display screen #0 (lo-res or 32x16 text)
829 os9 I$SetStt make the call
830
831 * Frees the memory of a screen allocated by SS.AScrn
832 * SetStat Function Code $8C
833 *
834 * entry:
835 * a -> path number
836 * b -> function code $8D (SS.FScrn)
837 * y -> screen number 1-3 = high resolution screen
838 *
839 * error:
840 * CC -> Carry set on error
841 * b -> error code (if any)
842
843 clra clear high byte
844 ldb scr174 Get hi-res screen # again
845 tfr d,y move it to Y=screen #
846 lda #StdOut set the path $01
847 ldb #SS.FSCrn Return screen memory to system
848 os9 I$SetStt amke the call
849
850 L036D leas 2,s Eat stack & return
851 rts
852
853
854
855 * Unload the other modules
856 L0370 leax >L0106,pcr shdw name string
857 lda #Prgrm+Objct #$11 module type
858 lbsr L040B unload it
859 leax >L010B,pcr scrn name string
860 lbsr L040B unload it
861 leax >L0110,pcr mnln name string
862 lbsr L040B unload it
863 rts
864
865 *L0388 orcc #$50
866 * lda <u0042
867 * sta >$FFA9
868 * ldx <u0043
869 * ldd >L0104,pcr
870 * std $01,x
871 * stb >$FFAA
872 * ldd >L0102,pcr
873 * std -$01,x
874 * stb >$FFA9
875 * andcc #$AF
876 * clra
877 * ldb >L0119,pcr
878 * andb #$03
879 * tfr d,x
880 * lda #$01
881 * ldb #$92
882 * os9 I$SetStt
883 * rts
884 **
885 *L03B6 tfr x,d
886 * exg a,b
887 * lsrb
888 * lsrb
889 * lsrb
890 * lsrb
891 * lsrb
892 * pshs b
893 * ldu #$FFA8
894 * lda b,u
895 * incb
896 * andb #$07
897 * ldb b,u
898 * tfr d,u
899 * puls a
900 * rts
901
902
903 * Restore original MMU block numbers
904 L0388 orcc #IntMasks Shut off interrupts
905 lda <u0042 get MMU Block #
906 sta >$FFA9 Restore original block 0 onto MMU
907 ldx <u0043
908 ldd >L0104,pc Origanl 3rd block of MMU
909 std 1,x
910 stb >$FFAA Restore original block 1 onto MMU
911 ldd >L0102,pc Original 2nd block of MMU
912 std -1,x
913 stb >$FFA9 Restore block 0 again
914 andcc #^IntMasks Turn interrupts back on
915
916 * return monitor type to original value
917 clra
918 ldb >L0119,pc Get original monitor type
919 andb #$03 Force to only legit values
920 tfr d,x Move to proper register
921 lda #StdOut set path $01
922 ldb #SS.Montr Restore original monitor type
923 os9 I$SetStt make the call
924 rts
925
926 * twiddles address
927 * called with value to be twiddled in X
928 * returns block # in a
929 * ????? in u
930 L03B6 tfr x,d Move address to D
931 exg a,b Swap MSB/LSB
932 lsrb Divide MSB by 32 (calculate 8k block # in proc map)
933 lsrb
934 lsrb
935 lsrb
936 lsrb
937 pshs b Save block # in process map
938 ldu #$FFA8 Point to start of user DAT image
939 lda b,u
940 incb
941 andb #$07
942 ldb b,u
943 tfr d,u
944 puls a
945 rts
946
947
948
949 *************************************************************
950 * Called from within sub at L0229
951 * entry:
952 * x -> is loaded with the address of the name string to load
953 * u -> contains some arbitrary value
954 *
955
956 L03D0 leas -$08,s Make a little scratch on the stack
957 stu ,s pointer to our buffer
958
959 * Loads one or more modules from a file but does not map the module
960 * into user's address space F$NMLoad
961 * entry:
962 * a -> type/language byte
963 * x -> address of the path list
964 * with out path list default path is current execution dir
965 *
966 * exit:
967 * a -> type/language
968 * b -> module revision
969 * x -> address of the last byte in the pathlist + 1
970 * y -> storageb requirements of the module
971 *
972 * error:
973 * b -> error code if any
974 * cc -> carry set on error
975
976 stx $02,s pointer module name
977 lda #Prgrm+Objct $11 module type
978 os9 F$NMLoad Load it but don't map it in
979 bcs L0408 exit on error
980
981 * Links to a memory module that has the specified name, language and type
982 * entry:
983 * a -> type/language byte
984 * x -> address of the module name
985 *
986 * exit:
987 * a -> type/language
988 * b -> attributes/module revision
989 * x -> address of the last byte in the modulename + 1
990 * y -> module entry point absolute address
991 * u -> module header abosolute address
992 *
993 * error:
994 * cc -> set on error
995
996 ldx $02,s get our name string again
997 os9 F$Link link it
998 bcs L0408 exit on error
999 stu $06,s store module header address
1000 tfr u,x
1001 L03E8 stx $04,s
1002 lbsr L03B6 Go twiddle with address`
1003 ldx ,s
1004 leax a,x
1005 exg d,u
1006 sta ,x
1007 exg d,u
1008 cmpa #$06
1009 beq L0403
1010 ldx $04,s
1011 leax >$2000,x
1012 bra L03E8
1013
1014 L0403 ldu $06,s
1015 os9 F$UnLink
1016 L0408 leas $08,s
1017 rts
1018
1019 L040B os9 F$UnLoad Unlink a module by name
1020 bcc L040B
1021 clrb
1022 rts
1023
1024 L0412 fcc '/VI'
1025 L0415 fcb C$CR
1026 L0416 fdb $0000 address of the device table entry
1027 L0418 fcb $00 path number to device
1028
1029 **************************************************************
1030 *
1031 * subroutine entry is L0419
1032 * sets up Sig Intercept
1033 * verifies /VI device is loaded links to it
1034 * and allocates ram for it
1035 * called from dispatch table around L0120
1036
1037
1038 * Set signal intercept trap
1039 * entry:
1040 * x -> address of intercept routine
1041 * u -> starting adress of routines memory area
1042 * exit:
1043 * Signals sent to the process cause the intercept to be
1044 * called instead of the process being killed
1045
1046 L0419 ldu #$0000 start of Sierra memory area
1047 ldx #int5EE Intercept rourtine copied to mem area
1048 os9 F$Icpt install the trap
1049
1050 * Attach to the vrt memory descriptor
1051 * Attaches and verifies loaded the VI descriptor
1052 * entry:
1053 * a -> access mode
1054 * 0 = use any special device capabilities
1055 * 1 = read only
1056 * 2 = write only
1057 * 3 = update (read and write)
1058 * x -> address of device name string
1059 *
1060 * exit:
1061 * x -> updated past device name
1062 * u -> address of device table entry
1063 *
1064 * error:
1065 * b -> error code (if any)
1066 * cc -> carry set on error
1067
1068 lda #$01 attach for read
1069 leax >L0412+1,pcr skip the slash Load VI only
1070 os9 I$Attach make the call
1071 bcs L0451 didn't work exit
1072 stu >L0416,pcr did work save address
1073
1074 * Open a path to the device /VI
1075 * entry:
1076 * a -> access mode (D S PE PW PR E W R)
1077 * x -> address of the path list
1078 *
1079 * exit:
1080 * a -> path number
1081 * x -> address of the last byte if the pathlist + 1
1082 *
1083 * error:
1084 * b -> error code(if any)
1085 * cc -> carry set on error
1086 *
1087 * a still contains $01 read
1088 leax >L0412,pcr load with device name including /
1089 os9 I$Open make the call
1090 bcs L0451 didn't work exit
1091 sta >L0418,pcr did work save path #
1092
1093 * Allocate process+path RAM blocks
1094
1095 ldb #SS.ARAM $CA function code for VIRQ
1096 ldx #$000C
1097 os9 I$SetStt make the call
1098 bcs L0451
1099 pshs x
1100
1101 * Set process+path VIRQ KQ3
1102 ldb #SS.KSet $C8 function code for VIRQ
1103 os9 I$SetStt
1104 puls b,a
1105 L0451 rts
1106
1107 * Signal Intercept processing gets copied to int5EE mem slot
1108 L0452 cmpb #$80 b gets the signal code if not $80 ignore
1109 bne L0464 $80 is user defined
1110 tfr u,d
1111 tfr a,dp
1112 dec <u004A
1113 bne L0464
1114 bsr L0465
1115 lda #$03
1116 sta <u004A
1117 L0464 rti
1118
1119 L0465 inc >u024C,u
1120 bne L047B
1121 inc >u024B,u
1122 bne L047B
1123 inc >u024A,u
1124 bne L047B
1125 inc >u0249,u
1126 L047B tst >u0102,u
1127 bne L04BC
1128 inc <u003F
1129 bne L0487
1130 inc <u003E
1131 L0487 ldd <u0048
1132 addd #$0001
1133 std <u0048
1134 cmpd #$0014
1135 bcs L04BC
1136 subd #$0014
1137 std <u0048
1138 ldd #$003C
1139 leax >u043D,u
1140 inc ,x
1141 cmpb ,x
1142 bhi L04BC
1143 sta ,x+
1144 inc ,x
1145 cmpb ,x
1146 bhi L04BC
1147 sta ,x+
1148 inc ,x
1149 ldb #$18
1150 cmpb ,x
1151 bhi L04BC
1152 sta ,x+
1153 inc ,x
1154 L04BC rts
1155
1156 * deallocates the VIRQ device
1157 L04BD lda >L0418,pcr load path number to /VI device
1158 beq L04D0 no path open check for device table addr
1159 ldb #SS.KClr $C9 Clear KQ3 VIRQ
1160 os9 I$SetStt make the call
1161 ldb #SS.DRAM $CB deallocate the ram
1162 os9 I$SetStt make the call
1163 os9 I$Close close the path to /VI
1164 L04D0 ldu >L0416,pcr load device table address for VI
1165 beq L04D9 don't have one leave now
1166 os9 I$Detach else detach it
1167 L04D9 rts
1168
1169 * Twiddles with MMU blocks for us
1170 * This sub gets copied into $0659 and executed there from this and
1171 * the other modules this one loads (sub659)
1172 *
1173 * s and x loaded by calling routine
1174
1175 L04DA ldd ,s++ load d with current stack pointer and bump it
1176 * from mnln we come in with $4040
1177 std <u002A save the calling stack pointer in u002A
1178 * orcc #$50
1179 orcc #IntMasks mask the interrupts
1180 lda <u0042
1181 sta ,x x is loaded with value from u0028 in mnln
1182 sta >$FFA9 task 1 block 2 x2000 - x3FFF
1183 ldu <u0043
1184 lda $06,x
1185 sta u000C,u
1186 sta >$FFAF task 1 block 8 xE000 - xFFFF
1187 lda $05,x
1188 sta u000A,u
1189 sta >$FFAE task 1 block 7 xC000 - xDFFF
1190 lda $04,x
1191 sta u0008,u
1192 sta >$FFAD task 1 block 6 xA000 - xBFFF
1193 lda $03,x
1194 sta u0006,u
1195 sta >$FFAC task 1 block 5 x8000 - x9FFF
1196 lda $02,x
1197 sta u0004,u
1198 sta >$FFAB task 1 block 4 x6000 - x7FFF
1199 * andcc #$AF
1200 andcc #^IntMasks unmask interrupts
1201
1202 lda $07,x
1203 ldu <u002E
1204 adda u000A,u
1205 jsr a,u
1206
1207 orcc #IntMasks
1208 lda <u0042
1209 sta >$FFA9
1210 ldu <u0043
1211 lda <u0010
1212 sta u000C,u
1213 sta >$FFAF
1214 lda <u000F
1215 sta u000A,u
1216 sta >$FFAE
1217 lda <u000E
1218 sta u0008,u
1219 sta >$FFAD
1220 lda <u000D
1221 sta u0006,u
1222 sta >$FFAC
1223 lda <u000B
1224 sta u0002,u
1225 sta >$FFAA
1226 lda <u000A
1227 sta ,u
1228 sta >$FFA9
1229 andcc #^IntMasks
1230
1231 jmp [>$002A]
1232
1233 L054F fcb $00,$00,$00,$00,$00,$00,$00,$00 ........
1234 L0557 fcb $73,$69,$65,$72,$72,$61,$00 sierra.
1235 emod
1236 eom equ *