(last edit: 2016-01-13)
Beschaffung: Es gibt obskure Quellen sowohl für ein dongle-loses OrCAD-386 -
- und auch höherauflösende Grafiktreiber, die anscheinend später von Freaks dazuprogrammiert wurden.
Mein Name ist Hase, ich weiß von nichts
Bequem ist folgendes Bedienverhalten:
nc anwerfen, in historisches Schaltungs-Verzeichnis wechseln, *.sch anklicken und damit das Draft-Programm von OrCAD starten.
Dazu wird folgendes vorbereitet:
(1) autoexec.bat muß enthalten:
~~~ path ~~~blabla~~~ \orcad386.emu\exe;.; ~~~ set orcaddd=\orcad386.emu\drv\vga640.drv set orcadexe=\orcad386.emu\exe\ set orcadesp=\orcad386.emu\ set orcaduser=\orcad386.emu\ ~~~
Fazit:
draft.exe muß im PATH auffindbar sein
orcaddd ist der Default-Displaytreiber für das ESP-Einstiegs-GUI (erwartet 640×480!)
(2) Die nc-Erweiterungsdatei (nc.ext) muß die Zeilen …
*.dat: ..\orc.32.bat *.sch: draft.exe !.!
… enthalten.
(3) Die Baumstruktur der OrCAD-ESP-Umgebung muß rudimentär nachgebaut werden:
C:\PROJEKT\OLD\ORCADSCH ├──TEMPLATE ├──OLDSCH1 ├──OLDSCH2 └──...
Im obersten Ordner ORCADSCH befindet sich das File orc32.bat, das projektabhängig editiert werden muß, hier:
set orcadproj=\projekt\old\orcadsch\ copy esp.cfg ..\template > nul orcad.exe
Im Ordner TEMPLATE befinden sich minimal:
esp.cfg (wird durch orc32.bat vom Arbeitsordner OLDSCHn hierhin kopiert) orcadesp.dat (Größe immer ca. 36KB, enthält die Settings für die zahlreichen Schaltflächen des ESP-GUI)
In jedem Ordner OLDSCHn befinden sich minimal:
esp.cfg (wurde editiert, damit die Zeile "DESIGN = 'OLDSCHn'" angegeben wird) orcadesp.dat (wurde z.B. von der Vorlage aus TEMPLATE kopiert und spezifisch pro OLDSCHn-Ordner angepaßt, wo nötig) sdt.cfg (enthält Treiber-, Library- und Makrokram, ist von Wissenden jeweils anzupassen) historical.sch (uralter Schaltplan)
Das Binärfile „sdt.bcf“ wird immer nach Start des ESP-GUI automatisch aus dem Textfile sdt.cfg erzeugt.
(4) Der Affe hüpft ins Wasser: Start der ESP-Umgebung aus dem Ordner OLDSCH
„orcadesp.dat“ in diesem Ordner doppelklicken –> orc32.bat startet die ESP-Oberfläche (Ctrl-Alt-Home wechselt zwischem Mauszeigerfang in DOSemu und KDE)
* „Schematic Design Tools“-Button doppelklicken
* „Draft“-Button doppelklicken –> Hurra! draft.exe öffnet historical.sch in einem hochauflösenden Grafikmodus! Ausstieg über „quit-abandon edits“ wie damals.
(5) Ungeduldige können auch direkt auf ein „historical.sch“ doppelklicken.
Dann führt der Norton Commander „draft.exe historical.sch“ aus und findet hoffentlich alle Configfiles rundherum.
(6) Schlimmer noch: pcb.exe anwerfen …
Erstmal alte *.pcb-Files von OrCAD-PCB II konvertieren:
frompcb2 lmess2.pcb
Und dann im Ordner OLDSCHn das File „pcb.cfg“ sinnvoll editieren bzw. anpassen. Der EMUHires-Driver funktioniert auch für pcb.exe!
(hier ist noch Bedarf an weiteren Erkenntnissen …)
Das Untenstehende gilt für OrCAD-32bit-Schematics (alte 16bit-Schematics können mit dem Tool „16to32.exe“ konvertiert werden)
(1) in DOSemu:
* orc32.bat starten
→ Einstiegs-GUI erscheint
→ „Schematic Design Tools“
→ RMB auf „Plot Schematic“
→ „Configure Schematic Design Tools“
Printer Driver = pscript.drv (Dummy!) Plotter Driver = pscript2.drv Printer Port = LPT1: (Dummy!) Plotter Port = LPT1: (Dummy!)
→ GUI verlassen, sdt.bcf wird damit aktualisiert
* Nun auf der comandline im Projektordner …
plotall foo.sch foo.ps
… eingeben. ACHTUNG! Postscript-Files können nur erzeugt werden, wenn alle Libraryparts vorhanden sind!
(2) in Linux:
* GIMP starten, Postscript-Import wie folgt:
→ Datei öffnen → aus PostScript importieren
Auflösung: 150dpi s/w Breite: 1700 px Höhe: 2300 px
Damit paßt das OrCAD A3-Sheet genau in das GIMP-Fenster!
→ Ausdrucken auf Lieblingsdrucker, fertig!
Vorerst als root:
echo "vm.mmap_min_addr = 0" >> /etc/sysctl.conf /etc/init.d/procps restart
"Changing mmap_min_addr makes your system slightly less secure, you will not be protected from potential kernel exploits that use NULL derefs."
Und dann als root:
apt-get install xfonts-base xfonts-75dpi xfonts-100dpi
Anzeige aller relevanten installierten Fonts:
xlsfonts|grep dos
* Alle Namen in Directories, die mit „Norton Commander V5.5“ kopiert werden, werden auf UPPERCASE konvertiert.
* Files, die in DOS angelegt werden, bekommen Linux-Namen in UPPER/lowercase, wie angegeben.
Sie werden mit dem DOS-Befehl „dir“ aber nur UPPERCASE angezeigt.
Der „Norton Commander“ zeigt (wie auch das DOS-GNUtool „ls“) hingegen alle Filenamen in lowercase an.
Beispiel (DOS):
C:\> echo > UPPER.txt C:\> echo > lower.txt C:\>dir *.txt Volume in drive C is mu/drives/c Directory of C:\ LOWER TXT 12 04-24-13 10:52a UPPER TXT 12 04-24-13 10:51a 2 file(s) 24 bytes 0 dir(s) 2,147,450,880 bytes free C:\>ls *.txt lower.txt upper.txt C:\>_
Beispiel (Linux):
franz@pingu:~/DOSemuDisk$ ls *.txt lower.txt UPPER.txt franz@pingu:~/DOSemuDisk$
Nützlich, wenn uralte Editoren durch KDE-Werkzeuge ersetzt werden können.
Thema 8051: der Keil-Assembler verdaut auch UTF8-codierte Sourcefiles.
!!! ABER: Makrozeilen müssen mit CRLF delimited sein, sonst wird nur die 1. Zeile ersetzt !!!
Also: autoexec.bat im virtuellen DOS editieren, letzte Zeile auf …
unix -e
.. editieren und aus bash aufrufen mit z.B.
dosemu "\projekt\test\makeall.bat"
Oha.. dieses Verfahren geht nicht immer, gibt manchmal furchtbare Abstürze.
Neue Variante, geht perfekt:
Files „autoexec.emu“ und „autoexec.cli“ anlegen,
Symlink namens autoexec.bat auf das gewünschte File:
*.emu für DosEMU mit GUI,
*.cli für Aufruf aus Shell
Im Commandline-Modus: Aufruf von „exitemu.com“ beendet DOSemu problemlos.
Siehe http://www.geany.org/ … aktuelle Sourcen herunterladen & selber kompilieren!
Lieblings-Assembler und Linker können sodann per Knopfdruck (DOSemu im commandline mode) angeworfen werden.
Vorgehensweise: Knopfdruck in geany startet ein shellscript, dieses gerneriert ein eigenes autoexec.bat für die gewünschten Funktionen und wird mit exitemu beendet.
Bei mehreren DOS-Projekten evtl. ein symlink auf das jeweilige autoexec.bat legen.
Die Sache mit dosemu „commandstring“ und „unix -e“ als letzte Zeile in autoexec.bat (siehe http://www.dosemu.org/docs/README/1.4/x724.html) geht nicht wirklich!
* DOSemu, freedos, xfonts installieren
* DOSemu-Minimal-Laufwerk mit Keil-A51-Toolset organisieren
Aufruf-Buttons in geany:
(1) das komplett unverständliche all-in-one-Makescript für 8051-Assembler in DOSemu-Umgebung (./make51)
#!/bin/bash #################################################################################### # # make51: a make-like tool for Keil 8051 assembler projects # (running with DOSemu & DOSdisk_a51 but edited under Linux) # # V0.12 by koarrl 2016-01-13 (Status: testing) # # This is a tricky utility using vintage KEIL a51 in DOSemu environment .. # .. and an embedded bash/awk binary -> monolithic IntelHex file converter # GNU make is a very different thing from this :-) # #################################################################################### # Old conventions for Keil a51 projects: # "cnf" dir contains project-specific stuff: # files.txt ..... list of source filenames for "summ" tool # l51.inp ....... 8051 linker takes input from this file (cmdline length is restricted) # spix-wrk.rc ... project extension settings for SPI programmer tool # "make" is this new thing with the old name # "d" does project cleanup, removing all generated files # "summ" catenates all sourcefiles as listed in cnf/files.txt # "dosmake.bat" is tricky: # When DOSemu is used in commandline mode, autoexec.bat will call this file # This is done by changing a symlink on DOSemuDisk from autoexec.emu to autoexec.cli # Don't forget to keep track of the ./cnf directory contents for linker and programmer settings! # ---- embedded fileconverter for KEIL AT89xx DOS toolchain ------------------------ # V0.12 by koarrl 2016-01-13 # usage: B2H16 path_to_binfile_in name_of_hexfile_out lastbyte+1 # DON'T TOUCH the ugly awk oneline script! # It produces a monolithic IntelHex file with appended checksum. # 'monolithic' means every line describes 16 bytes of data without skipped areas B2H16() { dd if=$1 bs=$3 iflag=append conv=sync status=noxfer > /tmp/"xx_"$3 2>/dev/null hexdump -v /tmp/"xx_"$3 | head -n -1 > /tmp/"xx_"$3.dmp # ~~~ begin of ugly code ~~~ mawk 'BEGIN{FS=" ";ORS="";OFS="";INFILE=ARGV[1];csf=0;}\ {getline<INFILE;am=toupper(substr($1,4,2));al=toupper(substr($1,6,2));\ b0=toupper(substr($2,3,2));b1=toupper(substr($2,1,2));\ b2=toupper(substr($3,3,2));b3=toupper(substr($3,1,2));\ b4=toupper(substr($4,3,2));b5=toupper(substr($4,1,2));\ b6=toupper(substr($5,3,2));b7=toupper(substr($5,1,2));\ b8=toupper(substr($6,3,2));b9=toupper(substr($6,1,2));\ ba=toupper(substr($7,3,2));bb=toupper(substr($7,1,2));\ bc=toupper(substr($8,3,2));bd=toupper(substr($8,1,2));\ be=toupper(substr($9,3,2));bf=toupper(substr($9,1,2));\ amx="0x"am;alx="0x"al;b0x="0x"b0;b1x="0x"b1;b2x="0x"b2;\ b3x="0x"b3;b4x="0x"b4;b5x="0x"b5;b6x="0x"b6;b7x="0x"b7;\ b8x="0x"b8;b9x="0x"b9;bax="0x"ba;bbx="0x"bb;bcx="0x"bc;\ bdx="0x"bd;bex="0x"be;bfx="0x"bf;csl=b0x+b1x+b2x+b3x+b4x\ +b5x+b6x+b7x+b8x+b9x+bax+bbx+bcx+bdx+bex+bfx;csf=csf+csl;\ cs=16+amx+alx+csl;csm=(256-(cs%256))%256;print":10";\ print am al;print"00";\ print b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf;\ if(csm<16)print"0";printf("%X",csm);print"\n";}\ END{print":00000001FF\n";printf("%X",csf);printf("\n");}' /tmp/"xx_"$3.dmp > /tmp/"xx_"$3.out # ~~~ end of ugly code ~~~ # read checksum from last line of file just generated tail -1 /tmp/"xx_"$3.out > $2.chs # write hexfile w/o appended checksum head -n -1 /tmp/"xx_"$3.out > $2.hex } # **** MAIN starts from here ******************************************************* if [ -z "`which hexdump`" ]; then echo "\"hexdump\" utility must be installed!" exit 0 fi if [ ! -d "obj" ]; then echo "Exit: not called from sourcecode directory!" exit 0 fi # specify DOSemu drive C: (minimalistic FreeDOS plus KEIL 8051 assembler backup copy :-) DOSROOT="DOSdisk_a51" # create symlink to drive C: this way ("dosemu -install .." is maybe possible too) # Attention! ln -f appears not to work! Therefore rm -f .. ln -s .. are used! WDIR=`pwd` rm -f ~/DOSdisk ln -s ~/$DOSROOT ~/DOSdisk # create always-the-same-named symlink inside DOS machine tree to Linux-housed asm source folder ln -f -s "$WDIR" ~/DOSdisk/A51.tmp # get release string from Linux workdir name RELEASE=`echo $WDIR|rev|cut -d_ -f1|rev` # autoexec.bat for DOSemu is built now ... # - specify PATH # - cd to working directory (always the same!) # - the here batch file "dosmake.bat" will do all & finish by invoking "exitemu.com" echo "path c:\a51;c:\dosemu;.;" > ~/DOSdisk/autoexec.bat echo "cd A51.tmp" >> ~/DOSdisk/autoexec.bat echo "dosmake.bat" >> ~/DOSdisk/autoexec.bat # cleanup old stuff like in the good old days using a here shell script ./d # invoke dosemu - the above-built autoexec.bat will perform the rest! # !!! Only macro files need CR+LF, all other sources can live with the LF-only (Unix-style) delimiter !!! dosemu # after finishing this check if assembly and linking went all OK (using Linux tools) .. # .. if all went OK, convert hex files to monolithic (spix programmer needs these), show results if [ ! -f lst/*.err ]; then B2H16 obj/main.bin code_${RELEASE} 8176 B2H16 obj/xeedata.bin xdata_${RELEASE}_prod 2048 B2H16 obj/xeedata.bin xdata_${RELEASE}_upd 2048 240 cat obj/li.txt echo "Output File: main.bin, "`wc -c obj/main.bin|cut -d " " -f1`" Bytes" echo -n " CodeCS: " cat code_${RELEASE}.chs # XData only available with AT89S... chips! if [ -n "`cat main*|grep 'Target: AT89S'`" ]; then echo -n "XData_${RELEASE}_prodCS: " cat xdata_${RELEASE}_prod.chs # !! xdata_upd checksum would be wrong as only the hexfile is truncated, so none at all is displayed !! fi else cat lst/*.err|grep ERROR fi # **********************************************************************************
(2) Cleanup (./d)
#!/bin/bash ############################################################################## # # d: quietly cleanup all assembler/linker mess here # # V0.03 by koarrl 2013-11-13 (Status: perfect) # ############################################################################## rm *.?~ 2>/dev/null rm *.???~ 2>/dev/null rm *.xxx 2>/dev/null rm OBJ/* 2>/dev/null rm LST/* 2>/dev/null rm obj/* 2>/dev/null rm lst/* 2>/dev/null rm xxxxxxxx.sum 2>/dev/null rm *.hex 2>/dev/null rm *.chs 2>/dev/null exit 0
(3) Create sum of all source files (./summ)
#!/bin/bash ############################################################################## # # summ: catenate all source files (order specified by cnf/files.txt) # # V0.03 by koarrl 2013-11-13 (Status: perfect) # ############################################################################## cat cnf/files.txt | xargs cat > xxxxxxxx.sum
* Pakete DOSemu, freedos, xfonts installieren
* DOSemu-Minimal-Laufwerk mit entsprechendem Toolset organisieren
* Universal-Launcherscript-Aufruf in mc.ext ergänzen:
... # Attention! The extension *.sch is used by OrCAD and EAGLE as well! # So a wrapper bash script ~/bin/launchCAD is needed which serves both. # OrCAD386 schematics furthermore need a stripped-down DOSemu with OrCAD386 installed! regex/\.(sch|SCH)$ Open=launchCAD %f ...
Und hier das script launchCAD:
#!/bin/bash ############################################################################### # # LaunchCAD-0.02: a tool which determines whether the # specified schematic file is to be opened with OrCad or EAGLE # and then launches the appropriate CAD system # (part of mc.ext additions by koarrl Jan 27, 2016) # ############################################################################### # ---- calling OrCAD386 in DOSemu minimum environment ------------------------- # (this depends on a DOSemu installation with a stripped-down OrCAD386) # NOTE: "$1" must be in quotes because of possible whitespaces in file or path orcSDT() { # specify DOSemu "drive C" (nano version!) DOSROOT='DOSdisk_OrCAD' WFILE=`basename "$1"` EMUPATH="OrCAD.tmp" # create symlink to used nano version of "drive C:" rm -f ~/DOSdisk ln -s ~/$DOSROOT ~/DOSdisk # in temporary DOSemu project folder: create symlink --> work file ln -f -s `pwd`/"$WFILE" ~/$DOSROOT/$EMUPATH/"$WFILE" # the specific autoexec.sdt is constructed here; # - specify PATH and cd to working directory, # - then invoke OrCAD-SDT draft.exe with wfile # - after all terminate DOSemu session echo "path c:\orcad386.emu\exe;c:\dosemu;.;" > ~/$DOSROOT/autoexec.bat echo "c:" >> ~/$DOSROOT/autoexec.bat echo "cd \\$EMUPATH" >> ~/$DOSROOT/autoexec.bat echo "draft.exe ""$WFILE" >> ~/$DOSROOT/autoexec.bat echo "exitemu.com" >> ~/$DOSROOT/autoexec.bat # invoke dosemu, autoexec.bat will perform the rest :-) dosemu # ATTENTION! sdt.cfg and sdt.bcf must remain unmodified! } # **** MAIN ******************************************************************* # exit silently if no cmdline parameter found [ -z "$1" ] && exit # define path to CAD program EAGLE=/opt/eagle/bin/eagle # OrCAD 32bit *.sch ORCSCH=`head -c32 "$1"|grep -a 'OrCAD 32bit Schematic'` # old EAGLE (mixed-binary) *.sch EAGSCH=`head -c144 "$1"|grep -a 'Top'|grep -a 'Route2'` # new EAGLE (XML) *.sch EA6SCH=`head -c100 "$1"|grep '<!DOCTYPE eagle SYSTEM "eagle.dtd">'` # These signature strings are not empty if file type matches! if [ -n "$EAGSCH$EA6SCH" ]; then $EAGLE "$1" exit fi if [ -n "$ORCSCH" ]; then orcSDT "$1" exit fi # *****************************************************************************