Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/verify.asm @ 1020:c1a5613ffe7b
changes
author | boisy |
---|---|
date | Thu, 06 Mar 2003 01:41:03 +0000 |
parents | c155aac72190 |
children | 84ea83668304 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * Verify - Verify a module's CRC | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
161
diff
changeset
|
8 * 5 From Tandy OS-9 Level One VR 02.00.00 |
908 | 9 * 6 Option modified to require dash in frot BGP 03/01/18 |
0 | 10 |
11 nam Verify | |
12 ttl Verify a module's CRC | |
13 | |
14 * Disassembled 98/09/15 00:03:43 by Disasm v1.6 (C) 1988 by RML | |
15 | |
16 ifp1 | |
17 use defsfile | |
18 endc | |
19 | |
20 tylg set Prgrm+Objct | |
21 atrv set ReEnt+rev | |
22 rev set $01 | |
908 | 23 edition set 6 |
0 | 24 |
25 mod eom,name,tylg,atrv,start,size | |
26 | |
924 | 27 org 0 |
908 | 28 crc1 rmb 1 |
29 crc2 rmb 1 | |
30 crc3 rmb 1 | |
31 readcnt rmb 2 | |
32 dovfy rmb 1 | |
33 bufptr rmb 2 | |
34 bufsiz rmb 2 | |
35 bytesrd rmb 57 | |
0 | 36 u0043 rmb 195 |
908 | 37 buffer rmb 1000 |
0 | 38 size equ . |
39 | |
40 name fcs /Verify/ | |
41 fcb edition | |
42 | |
908 | 43 start leas >buffer,u point S to buffer |
44 sts <bufptr save pointer to buffer | |
45 tfr y,d transfer end of our mem to D | |
46 subd <bufptr subtract bufptr address | |
47 std <bufsiz | |
48 clr <dovfy | |
49 L0023 ldd ,x+ get two chars | |
50 cmpa #C$SPAC space? | |
51 beq L0023 branch if so | |
52 andb #$5F make uppercase | |
53 cmpd #$2D55 -U ? | |
0 | 54 bne L0031 |
908 | 55 inc <dovfy we will do verify |
56 L0031 ldd #M$IDSize get module id size | |
57 std <readcnt save read count | |
58 lbsr DoRead | |
0 | 59 bcs L004D |
908 | 60 cmpy #M$IDSize |
61 bne BadMod | |
62 ldd ,x get first two bytes | |
63 cmpd #M$ID12 OS-9 module sync bytes? | |
64 bne BadMod branch if not | |
65 bsr DoCRCChk check header parity | |
0 | 66 bra L0031 |
908 | 67 L004D cmpb #E$EOF end of file error? |
68 bne Exit branch if not | |
69 clrb else clear carry | |
70 Exit os9 F$Exit and exit | |
71 | |
72 BadMod ldb #E$BMID | |
73 bra Exit | |
74 | |
75 * Here is where we check the module | |
76 DoCRCChk clrb | |
77 * First we will check the header parity | |
78 lda #M$Parity | |
0 | 79 L005C eorb ,x+ |
80 deca | |
81 bne L005C | |
908 | 82 lda <dovfy get verify flag |
83 bne UpdtHdrP branch if we must do verify | |
0 | 84 eorb ,x |
85 incb | |
86 beq L0070 | |
908 | 87 leax >HdrBad,pcr |
0 | 88 bra L0074 |
908 | 89 L0070 leax >HdrGood,pcr |
90 L0074 lbsr WriteLn | |
0 | 91 bra L007C |
908 | 92 UpdtHdrP comb |
0 | 93 stb ,x |
908 | 94 L007C ldx <bufptr |
0 | 95 ldy $02,x |
96 leay -$03,y | |
908 | 97 sty <readcnt |
0 | 98 ldd #$FFFF |
908 | 99 std <crc1 |
100 stb <crc3 | |
0 | 101 bsr L00D6 |
908 | 102 lda <dovfy |
103 bne UpdtCRC | |
0 | 104 ldd #$0003 |
908 | 105 std <readcnt |
0 | 106 bsr L00D6 |
908 | 107 lda <crc1 |
108 cmpa #CRCCon1 | |
0 | 109 bne L00A8 |
908 | 110 ldd <crc2 |
111 cmpd #CRCCon23 | |
0 | 112 beq L00AE |
908 | 113 L00A8 leax >CRCBad,pcr |
0 | 114 bra L00B2 |
908 | 115 L00AE leax >CRCGood,pcr |
116 L00B2 bsr WriteLn | |
0 | 117 bra L00CF |
908 | 118 UpdtCRC com <crc1 |
119 com <crc2 | |
120 com <crc3 | |
121 lda #$01 to standard out | |
122 leax ,u point to CRCs | |
123 ldy #$0003 3 bytes | |
124 os9 I$Write write it out | |
125 bcs Exit branch if error | |
0 | 126 clra |
127 os9 I$Read | |
908 | 128 bcs Exit |
0 | 129 L00CF rts |
908 | 130 L00D0 bsr DoRead |
131 lbcs Exit | |
132 L00D6 ldy <bytesrd | |
0 | 133 beq L00D0 |
134 os9 F$CRC | |
908 | 135 lda <dovfy |
0 | 136 beq L00EB |
908 | 137 lda #$01 standard output |
138 os9 I$Write write it | |
139 lbcs Exit branch if error | |
140 L00EB ldd <readcnt | |
141 subd <bytesrd | |
142 std <readcnt | |
0 | 143 bne L00D0 |
908 | 144 std <bytesrd |
0 | 145 rts |
908 | 146 |
147 DoRead clra | |
148 ldx <bufptr get buffer pointer | |
149 ldy <bufsiz get buffer size | |
150 cmpy <readcnt compare against read count | |
151 bls ExecRead if lower, use bufsiz | |
152 ldy <readcnt else read count | |
153 ExecRead os9 I$Read read data | |
154 sty <bytesrd save read count | |
0 | 155 rts |
908 | 156 |
157 WriteLn lda #$02 | |
158 ldy #80 | |
0 | 159 os9 I$WritLn |
160 rts | |
908 | 161 |
162 HdrGood fcc "Header parity is correct." | |
0 | 163 fcb C$CR |
908 | 164 |
165 HdrBad fcc "Header parity is INCORRECT !" | |
0 | 166 fcb C$CR |
908 | 167 |
168 CRCGood fcc "CRC is correct." | |
0 | 169 fcb C$CR |
908 | 170 |
171 CRCBad fcc "CRC is INCORRECT !" | |
0 | 172 fcb C$CR |
173 | |
174 emod | |
175 eom equ * | |
176 end |