PLM1800 and CDOS – A Blast From The Past
Thanks to a ton of work by a bunch of people on the Cosmac Elf mailing list, we have resurrected an operating system and a couple of compilers from the early days of the 1802. Just getting the files off the old 3.5″ diskettes was a feat in itself. I think David Schultz did the work for Microdos and BASIC and Hank Riley for PLM. David went on to work through the file format and adapt an emulator to support it – His work is here. Marcel Tongren integrated the diskette support into the Emma 02 Emulator.
The PLM compiler compiles a PL/1-like language and was meant to run on the RCA Microdos system with 60K of memory. I’m running microdos in the Emma 02 emulator and it’s a treat with a full set of dos-type commands: DIR, DEL, COPY etc besides the BASIC and PLM compilers and the ASM8 assembler.
DO; DECLARE T BYTE INITIAL(1); DO WHILE T>0; Q=1; CALL TIME(32767); Q=0; CALL TIME(32767); END; END; EOF
Compiling the program is a multi-step process. You run the compiler, merge the compiler output with the PLMLIB support routines, assemble the result with ASM8, then use a utility program CDSBIN to extract the binary code from the listing. The :1’s and :2’s are telling MicroDOS which drive the files are on :0 is the operating system, :1 is the PLM disk, and :2 is emulated on a windows directory. The last couple of commands copy the output .BIN and .LST files to the windows directory.
On windows I converted the raw binary in the .BIN file to intel hex and the uploaded it to the olduino with avrdude. The blink program uses a PLM built-in routine TIME which is generates a delay of 90+10N where N is the parameter. By happy coincidence 90+327670 cycles is around 1/2 sec on my 4mhz olduino so it makes a nice blink as you can see below. I think everyone working on the recovery of MicroDOS and the compilers has been working on emulators so I imagine this is the first time that PLM code has run on hardware since the 80’s.
The code, at first glance looks pretty basic. Seems to be mostly generated subroutine calls rather than inline code, maybe a stack machine underneath?
0409 ; 0160 0409 ; 0161 MAIN ORG $ 0409 ; 0162 ..00001 01 DO; 0409 ; 0163 ..00002 02 DECLARE T BYTE INITIAL(1); 0409 ; 0164 Z09000 EQU $ 0409 ; 0165 ORG Z10000 046A 01; 0166 DC 00001 046B ; 0167 ORG Z09000 0409 ; 0168 ..00003 02 DO WHILE T>0; 0409 ; 0169 Z01000 ORG $ 0409 D40287; 0170 CALL LOAD1 040C 046A; 0171 DC Z10000 040E D40255; 0172 CALL COMPOP 0411 044F; 0173 DC Z00050 0413 CB041E; 0174 LBNF $+00011 0416 D40063; 0175 CALL SMOP 0419 044F; 0176 DC Z00050 041B D4026F; 0177 CALL TEST 041E C0044C; 0178 LBR Z01001 0421 ; 0179 Z01002 ORG $ 0421 ; 0180 ..00004 03 Q=1; 0421 D4022D; 0181 CALL LOADOP 0424 0451; 0182 DC Z00051 0426 8F; 0183 GLO RF 0427 F6; 0184 SHR 0428 CB042F; 0185 LBNF $+00007 042B 7B; 0186 SEQ 042C C00430; 0187 LBR $+00004 042F 7A; 0188 REQ 0430 ; 0189 ..00005 03 CALL TIME(32767); 0430 D40236; 0190 CALL TIMDEL 0433 0455; 0191 DC Z00053 0435 ; 0192 ..00006 03 Q=0; 0435 D4022D; 0193 CALL LOADOP 0438 044F; 0194 DC Z00050 043A 8F; 0195 GLO RF 043B F6; 0196 SHR 043C CB0443; 0197 LBNF $+00007 043F 7B; 0198 SEQ 0440 C00444; 0199 LBR $+00004 0443 7A; 0200 REQ 0444 ; 0201 ..00007 03 CALL TIME(32767); 0444 D40236; 0202 CALL TIMDEL 0447 0455; 0203 DC Z00053 0449 ; 0204 ..00008 03 END; 0449 C00409; 0205 LBR Z01000 044C ; 0206 Z09001 EQU $ 044C ; 0207 ORG Z00053 0455 7FFF; 0208 DC 32767 0457 ; 0209 ORG Z09001 044C ; 0210 Z01001 ORG $ 044C ; 0211 ..00009 02 END; 044C ; 0212 ..00010 01 EOF 044C C00409; 0213 Z00001 LBR MAIN 044F 00; 0214 Z00050 DC 00H 0450 00; 0215 DC 0 0451 00; 0216 Z00051 DC 00H 0452 01; 0217 DC 00001 0453 00; 0218 Z00052 DC 00H 0454 02; 0219 DC 00002 0455 ; 0220 Z00053 ORG $+00002 0457 ; 0221 Z00054 ORG $+00002 0459 0000; 0222 Z00003 DC 0000H 045B 0000; 0223 Z00004 DC 0000H 045D 0000; 0224 Z00005 DC 0000H 045F 0000; 0225 Z00006 DC 0000H 0461 0000; 0226 Z00007 DC 0000H 0463 0000; 0227 Z00008 DC 0000H 0465 0000; 0228 Z00009 DC 0000H 0467 0000; 0229 Z00010 DC 0000H 0469 ; 0230 Z09999 ORG $+00001 046A ; 0231 Z10000 ORG $+00001 046B ; 0232 PAGE 0500 ; 0233 ORG $+00255 05FF ; 0234 STACK ORG $+00001 0600 ; 0235 Z30000 ORG $ 0600 ; 0236 MEMORY ORG $ 0600 ; 0237 END
Edited to change references to CDOS to MicroDOS. CDOS was an even earlier RCA operating system for the 1802 which did in fact use 8″ diskettes.
Cool, if slow
It is slow on Emma which I guess is trying to be a real 1802. On Dave Schultz’s 1802sim it runs lickety-split! http://home.earthlink.net/~schultdw/1802/microdos/
As someone with a real MS2000, It is slow! Emma02 is pretty realistic in it’s performance.
that’s what i figured. If i think back to those days we *expected* compilers to take a while to run. I was still spending my days on mainframes where i’d submit batch PL/1 compiles and get listings back in hours.
I chimed in on that PL/M forum discussion. I remember seeing P.LM disks come up a year or two ago on Ebay and wondered back then if PLM == PL/M, and now we not only know, YES, but also now have it functional on hardware. Fantastic. Nice work!
Hi, how did you manage to run microdos within emma02 ?
I tried several things, without success. Please give me a hint.
start emma and select ms2000 on the RCA tab. Make sure that the ROM box and the click start and the FDC0 box show the right file names. Click Start and the VT100 screen should pop up. Type L (no need to press enter) and microdos should load.
I am running the latest downloadable version of emma02, V1.23 on Linux and also on windows. But I don’t see any RCA tab. I only have
COMX35 Cosmac Studio II Cidelsa Telmac Pecom ET660 Debugger 😦
Where can I download your version ?
ah, ok, I’ll send you a link by email.
also, Have you looked under “Cosmac” for MS2000?
marcel is very good about answering questions by the way, you can reach him on the cosmac elf list.