annotate 3rdparty/p2mods/datmod.asm @ 1163:5cbcbfd738ae

Added
author boisy
date Thu, 08 May 2003 20:50:59 +0000
parents 020929a44372
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
978
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
1 * F$DatMod
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
2 *
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
3 * Entry:
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
4 * A = Type/Language
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
5 * B = Attr/Rev
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
6 * X = address of name
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
7 * Y = size
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
8 *
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
9 * Exit:
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
10 * X = address of last byte of name + 1
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
11 * Y = module entry point address
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
12 * U = module header address
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
13
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
14 Level equ 1
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
15
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
16 ifp1
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
17 use defsfile
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
18 endc
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
19
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
20 Type set Prgrm+Objct
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
21 Revs set ReEnt+1
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
22 edition set $01
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
23
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
24 mod eom,name,Type,Revs,start,256
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
25
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
26 name fcs "DatMod"
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
27 fcb $01
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
28
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
29 * routine cold
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
30 start clra
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
31 leax name,pcr
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
32 os9 F$Link
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
33 bcs error
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
34 leay SvcTbl,pcr
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
35 os9 F$SSvc
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
36 clrb
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
37 error os9 F$Exit
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
38
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
39 F$DatMod equ $25
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
40
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
41 SvcTbl equ *
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
42 fcb F$DatMod
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
43 fdb DatMod-*-2
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
44 fcb $80
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
45
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
46 s.namlen equ 0
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
47 s.nextnm equ 2
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
48 s.modptr equ 6
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
49 s.size equ 8
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
50
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
51 DatMod
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
52 leas -s.size,s
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
53
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
54 * First, parse the name
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
55 ldx R$X,u get the name of the module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
56 os9 F$PrsNam parse it: TODO /x/x crashes machine!
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
57 lbcs DatModEr
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
58 sty s.nextnm,s save updated name pointer
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
59 tfr y,d get ptr to last char + 1 into D
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
60 subd R$X,u get length of name in D
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
61 std s.namlen,s save name length for later
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
62 addd R$Y,u add name length to caller's specified size
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
63 addd #M$IDSize+3 add module header size and CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
64 pshs u
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
65 os9 F$SRqMem ask system for this memory
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
66 stu s.modptr+2,s else save pointer to module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
67 puls u
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
68 lbcs DatModEr branch if error
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
69 ldy s.modptr,s get module pointer into Y
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
70
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
71 * We have the memory for the Data Module, now populate it
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
72 std M$Size,y save size in module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
73 ldd #M$ID12 get module ID bytes
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
74 std M$ID,y save in module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
75 ldd R$D,u get passed type/lang and attr/rev
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
76 bita #TypeMask is type zero?
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
77 bne StoreIt branch if not...
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
78 anda #Data else force type to be data
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
79 StoreIt std M$Type,y and save in module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
80 ldd M$Size,y get module ptr's size
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
81 subd s.namlen,s subtract name's length from size
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
82 subd #3 and CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
83 std M$Name,y and save pointer to it in module header
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
84
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
85 * Compute header parity
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
86 pshs d save D (holds offset to name from within module)
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
87
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
88 ldd #M$IDSize-1
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
89 pshs b
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
90 clrb
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
91 EorLoop eora b,y
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
92 incb
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
93 cmpb ,s
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
94 bne EorLoop
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
95 puls b
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
96 coma
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
97 sta M$Parity,y save parity byte
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
98
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
99 * Copy name from caller's X to data module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
100 ldx R$X,u point to caller's passed name
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
101 puls d get name ptr in module into D
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
102 addd s.modptr,s add absolute address of module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
103 tfr d,y and put in Y
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
104 ldb s.namlen+1,s get length of name
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
105 CpyLoop lda ,x+ get char
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
106 sta ,y+ put char
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
107 decb decrement counter
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
108 bne CpyLoop
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
109 ora #$80 set high bit of last character we got
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
110 sta -1,y and put it back in module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
111
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
112 * Initialize CRC with constant $FFFFFF
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
113 ldd #$FFFF get CRC initializer
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
114 std ,y and store
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
115 sta 2,y
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
116
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
117 * Compute CRC and validate Module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
118 pshs u
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
119 tfr y,u U now holds pointer to CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
120 ldx s.modptr+2,s get pointer to module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
121 ldy M$Size,x get module size
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
122 leay -3,y subtract CRC length
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
123 os9 F$CRC update CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
124 ldd ,u get 1st two bytes of CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
125 coma complement them
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
126 comb
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
127 std ,u save them back
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
128 lda 2,u get third byte of CRC
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
129 coma complement them
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
130 sta 2,u save it back
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
131 os9 F$VModul and validate module
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
132 puls u
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
133 bcc DatModOk branch if all ok
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
134 pshs cc,b preserve error info
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
135 ldd M$Size,s get module size alloced from stack
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
136 tfr x,u put module ptr from X to U
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
137 os9 F$SRtMem return memory
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
138 puls b,cc get error info
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
139 bra DatModEr and exit
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
140
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
141 * Put return info in caller's regs
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
142 DatModOk ldx s.nextnm,s get pointer to char after name
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
143 stx R$X,u save it in caller's X
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
144 ldx s.modptr,s get module pointer
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
145 stx R$U,u save it in caller's U
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
146 leax M$IDSize,x get entry point
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
147 stx R$Y,u save it in caller's Y
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
148
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
149 DatModEr leas s.size,s
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
150 rts
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
151
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
152 emod
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
153 eom equ *
020929a44372 F$DatMod for OS-9 Level One and test program
boisy
parents:
diff changeset
154 end