Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rochester!cornell!uw-beaver!tektronix!tekgen!jonh
From: jonh@tekgen.TEK.COM (Jon Howell)
Newsgroups: comp.sys.m6809
Subject: Re: RSDOS <=-> OS9
Message-ID: <1483@tekgen.TEK.COM>
Date: Thu, 16-Jul-87 02:13:47 EDT
Article-I.D.: tekgen.1483
Posted: Thu Jul 16 02:13:47 1987
Date-Received: Sat, 18-Jul-87 04:49:52 EDT
References: <1036@wlbr.UUCP-> <464@potpourri.UUCP>
Reply-To: jonh@tekgen.UUCP (Jon Howell)
Organization: Tektronix, Inc., Beaverton, OR.
Lines: 144

In article <464@potpourri.UUCP> kato@potpourri.UUCP (Carlos Santiago) writes:
>-> wrote a little RS BASIC program that makes an RS-DOS disk readable to
>-> either RS-DOS or OS9.

This program does the same.  I don't know it's original name (I got it as
RS-OS9.BAS) or who wrote it.

>I have been unable to transfer files from 0s9 to rsdos. I would
>like to see the source for thes programs posted on the net.

wish granted.  (Tho--I don't KNOW that this goes os-9 ==> rsdos.. never tried
it going that direction.  Unfortunately, I kinda doubt it.)

>-> The best I have seen in the overall is a package called Xcom9. It's
>-> written in asm (lots of source) and is small (<6k), fast, and
>-> reliable. It has xmodem protocol, as well as straigh ascii file
>-> capture, etc. I use it all the time (and I do mean *all*). If you're
>-> interested in transferring files to/from CompuServe, they have a
>-> semi-proprietary protocol called the 'B' protocol. There's a package
>-> called Smod8 (also PD) that uses 'B', which is far superior to Xmodem
>-> when tossing stuff back and forth over Telenet or Tymnet. Oh... the
>-> ASM source is for 6809/os9. The B protocol package is all in C.
>Where can I get the source other than compuserve? Can it be posted
>on the net?
Yea, me too, please...


NOTE: Make sure you strip linefeeds on the save!  Otherwise, BASIC might
choke.  I guess the doc's are pretty much the REM statements.
save as--->RS-OS9.BAS.  (You should load and resave in compressed format)
------------Snip,------Snip,---------Snip.-------------------------
1 '**************************
2 '      RS2OS9/BAS         *
3 '  Makes CoCo DOS disks   *
4 '  readable by OS9!       *
5 '**************************
6 '
7 ' Important restrictions:
8 '
9 ' Track 0 must be unused.
10 ' Only the first 12 files
11 ' will appear in OS9 Dir.
12 ' Subsequent disk writes by
13 ' either OS will obsolete
14 ' the other directory!
15 '
16 GOTO109
17 PRINT:PRINT"Put CoCo DOS disk in any drive.":PRINT
18 INPUT"Enter drive # when ready";DV
19 DSKI$ DV,17,1,F1$,F2$
20 IF LEFT$(F1$,32)<>STRING$(32,255)THEN PRINT"Not a CoCo DOS disk!":GOTO17
21 DSKI$ DV,17,2,F1$,F2$
22 IF LEFT$(F1$,2)<>STRING$(2,255)THEN PRINT"Track 0 is already allocated!":GOTO17
23 'Write ID sector (LSN=0)
24 N=19:GOSUB90
25 DATA 0,2,76,12,0,4F,0,1
26 'Inhibit OS9 writes
27 DATA 0,0,2,0,0,ED,44,97
28 DATA 2,0,12
29 S1$=A$+STRING$(13,0)+"DOS OR "+CHR$(&HB9)+STRING$(88,0)
30 DSKO$ DV,0,1,S1$,STRING$(128,0)
31 PRINT"ID Sector written."
32 'Write allocation map (LSN=1)
33 DSKO$ DV,0,2,STRING$(128,255),STRING$(128,255)
34 PRINT"Allocation Map written."
35 'ROOT directory file descriptor
36 N=21:GOSUB90
37 ' Read only
38 DATA 89,0,0,53,A,16,17,21
39 DATA 2,0,0,1,C0,53,A,16
40 DATA 0,0,3,0,2
41 S1$=A$+STRING$(107,0)
42 DSKO$ DV,0,3,S1$,STRING$(128,0)
43 '16 Dir entries in LSN=3-4
44 'File descriptors go in LSN 5-17
45 DE=0:S1$="."+CHR$(&HAE)+STRING$(29,0)+CHR$(2)+CHR$(&HAE)+STRING$(30,0)+CHR$(2):S2$="":' Init Dir entry #
46 FOR DZ=0TO1
47 FOR D9=0TO7
48 IF(DZ=0)AND(D9<2)THEN57
49 GOSUB92:' Get a Dir entry
50 IF DE=-1 THEN 58
51 P=INSTR(1,D$," "):IF(P<2)OR(P>8)THEN P=9
52 A$=LEFT$(D$,P-1)+".":P=INSTR(9,D$," "):IF(P<9)OR(P>11)THEN P=12
53 A$=A$+MID$(D$,9,P-9)
54 MID$(A$,LEN(A$),1)=CHR$(ASC(RIGHT$(A$,1))+128)
55 A$=A$+STRING$(31-LEN(A$),0)+CHR$(D9+3+DZ*8)
56 IF D9<4 THEN S1$=S1$+A$ ELSE S2$=S2$+A$
57 NEXT D9
58 S1$=S1$+STRING$(128-LEN(S1$),0):S2$=S2$+STRING$(128-LEN(S2$),0)
59 DSKO$ DV,0,DZ+4,S1$,S2$:S1$="":S2$="":NEXT DZ
60 'Write file descriptors LSN 5-17
61 DE=0:S1$="":S2$="":PRINT"Files included:"
62 N=16:GOSUB90:' Init file des header
63 DATA 9,0,0,0,0,0,0,0
64 DATA 1,0,0,0,0,0,0,0
65 FH$=A$
66 FOR L=5TO17
67 GOSUB92:IF DE=-1THEN 87
68 PRINT LEFT$(D$,11)
69 LN=0:' File length
70 S1$=FH$:' Set file hdr
71 NG=ASC(MID$(F1$,SG+1,1)):' Read FAT entry
72 'Calc LSN from gran
73 TR=INT(SG/2):IF TR>16 THEN TR=TR+1
74 SC=9*(SG AND 1)+1
75 LSN=TR*18+SC-1
76 NUM=LSN:NS=3:GOSUB103
77 S1$=S1$+N$+CHR$(0)+CHR$(9)
78 IF LEN(S1$)>250 THEN PRINT"Too fragmented!":STOP
79 SG=NG:IF NG<68THEN LN=LN+2304:GOTO 71
80 'Found last gran
81 LN=LN+256*((NG AND 15)-1)+256*ASC(MID$(D$,15,1))+ASC(MID$(D$,16,1))
82 NUM=LN:NS=4:GOSUB103
83 MID$(S1$,10,4)=N$:' Update file length
84 S1$=S1$+STRING$(128-LEN(S1$),0)
85 DSKO$ DV,0,L+1,S1$,STRING$(128,0)
86 NEXT L
87 'Directory done
88 PRINT:PRINT"Disk ready for OS9!":PRINT
89 END
90 'Read N bytes of hex data into A$
91 A$="":FOR I=1TON:READ R$:A$=A$+CHR$(VAL("&H"+R$)):NEXT:RETURN
92 'Read dir entry into D$
93 ' DE is Dir entry index outputs starting gran in SG
94 ' SG = starting gran
95 IF DE<0 THEN RETURN
96 DS=INT(DE/8):DR=DE-DS*8
97 IF DR=0 THEN DSKI$ DV,17,DS+3,T1$,T2$
98 IF DR<4 THEN D$=MID$(T1$,DR*32+1,32) ELSE D$=MID$(T2$,DR*32-127,32)
99 IF DE<72 THEN DE=DE+1 ELSE DE=-1
100 IF ASC(D$)=255 THEN DE=-1
101 IF ASC(D$)=0 THEN 95
102 SG=ASC(MID$(D$,14,1)):RETURN
103 'Binary string output
104 'Output binary value of NUM in NS bytes in string N$
105 N$="":FOR I=1TO NS
106 N$=CHR$(NUM AND 255)+N$
107 NUM=INT(NUM/256)
108 NEXT I:RETURN
109 PCLEAR 1:CLS:CLEAR 2000:GOTO17
-- 
___ __ ,  __  __   _   ,   , __  ,   , ___ __
 |  |_ |  |_ /    / \  |\ /| |_\ |   |  |  |_  |  -- It's good for your
 |  |_ |_ |_ \__  \_/  | V | |    \_/   |  |_  *     health!