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