Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/merge.asm @ 475:c8d3a5ef9537
entered: chdir chmod qsort strass toupper tsleep wait
author | roug |
---|---|
date | Sun, 06 Oct 2002 09:10:36 +0000 |
parents | 24637ab6e2b8 |
children | c155aac72190 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
225 | 2 * Merge - Merge files into one file |
0 | 3 * |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
225 | 8 * 4 From OS-9 Level One VR 02.00.00 |
0 | 9 |
10 nam Merge | |
225 | 11 ttl Merge files into one file |
0 | 12 |
13 ifp1 | |
225 | 14 use defsfile |
0 | 15 endc |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
16 |
0 | 17 tylg set Prgrm+Objct |
18 atrv set ReEnt+rev | |
19 rev set $01 | |
225 | 20 edition set 4 |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
21 |
0 | 22 mod eom,name,tylg,atrv,start,size |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
23 |
225 | 24 path rmb 1 |
25 param rmb 2 | |
26 d.ptr rmb 2 | |
27 d.size rmb 2 | |
28 d.buffer rmb 2496 should reserve 7k, leaving some room for parameters | |
0 | 29 size equ . |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
30 |
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
31 name fcs /Merge/ |
225 | 32 fcb edition change to 6, as merge 5 has problems? |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
0
diff
changeset
|
33 |
225 | 34 start pshs u save start address of memory |
35 stx <param and parameter area start | |
0 | 36 tfr x,d |
225 | 37 subd #$0107 take out 1 bytes in DP, and 1 page for the stack |
38 subd ,s++ take out start address of data area | |
39 std <d.size save size of data buffer | |
40 leau d.buffer,u point to some data | |
41 stu <d.ptr save another pointer | |
42 | |
43 do.file ldx <param get first filename | |
44 bsr space | |
45 | |
0 | 46 clrb |
225 | 47 cmpa #C$CR was the character a CR? |
48 beq Exit yes, exit | |
49 | |
50 lda #READ. | |
51 os9 I$Open open the file for reading | |
52 bcs Exit crap out if error | |
53 sta <path save path number | |
54 stx <param and save new address of parameter area | |
55 | |
56 read.lp lda <path get the current path number | |
57 ldy <d.size and size of data to read | |
58 ldx <d.ptr and pointer to data buffer | |
59 os9 I$Read read data into the buffer | |
60 bcs chk.err check errors | |
61 | |
62 lda #$01 to STDOUT | |
63 os9 I$Write dump it out in one shot | |
64 bcc read.lp loop if no errors | |
65 bra Exit otherwise exit ungracefully | |
66 | |
67 chk.err cmpb #E$EOF end of the file? | |
68 bne Error no, error out | |
69 lda <path otherwise get the current path number | |
70 os9 I$Close close it | |
71 bcc do.file if no error, go get next filename | |
72 | |
73 Error coma set carry | |
74 Exit os9 F$Exit and exit | |
75 | |
76 space lda ,x+ grab a character | |
77 cmpa #C$SPAC space? | |
78 beq space yes, skip it | |
79 leax -1,x otherwise point to last non-space | |
80 rts | |
81 | |
0 | 82 emod |
83 eom equ * | |
225 | 84 end |
85 |