Digital Research
This commit is contained in:
2020-11-06 18:50:37 +01:00
parent 621ed8ccaf
commit 31738079c4
8481 changed files with 1888323 additions and 0 deletions

View File

@@ -0,0 +1,222 @@
*/*
* Copyright 1981
* Alcyon Corporation
* 8716 Production Ave.
* San Diego, Ca. 92121
**/
R0: .equ 0,r
R1: .equ 1,r
R2: .equ 2,r
R3: .equ 3,r
R4: .equ 4,r
R5: .equ 5,r
R6: .equ 6,r
R7: .equ 7,r
R8: .equ 8,r
R9: .equ 9,r
R10: .equ 10,r
R11: .equ 11,r
R12: .equ 12,r
R13: .equ 13,r
R14: .equ 14,r
R15: .equ 15,r
D0: .equ 0,r
D1: .equ 1,r
D2: .equ 2,r
D3: .equ 3,r
D4: .equ 4,r
D5: .equ 5,r
D6: .equ 6,r
D7: .equ 7,r
A0: .equ @10,r
A1: .equ @11,r
A2: .equ @12,r
A3: .equ @13,r
A4: .equ @14,r
A5: .equ @15,r
A6: .equ @16,r
A7: .equ @17,r
USP: .equ 18,r
SP: .equ 15,r
CCR: .equ 16,r
SR: .equ 17,r
r0: .equ 0,r
r1: .equ 1,r
r2: .equ 2,r
r3: .equ 3,r
r4: .equ 4,r
r5: .equ 5,r
r6: .equ 6,r
r7: .equ 7,r
r8: .equ 8,r
r9: .equ 9,r
r10: .equ 10,r
r11: .equ 11,r
r12: .equ 12,r
r13: .equ 13,r
r14: .equ 14,r
r15: .equ 15,r
d0: .equ 0,r
d1: .equ 1,r
d2: .equ 2,r
d3: .equ 3,r
d4: .equ 4,r
d5: .equ 5,r
d6: .equ 6,r
d7: .equ 7,r
a0: .equ @10,r
a1: .equ @11,r
a2: .equ @12,r
a3: .equ @13,r
a4: .equ @14,r
a5: .equ @15,r
a6: .equ @16,r
a7: .equ @17,r
usp: .equ 18,r
sp: .equ 15,r
ccr: .equ 16,r
sr: .equ 17,r
.b: .equ 19,r
.B: .equ 19,r
.w: .equ 20,r
.W: .equ 20,r
.l: .equ 21,r
.L: .equ 21,r
pc: .equ 22,r
PC: .equ 22,r
abcd: .opd 4,@140400
add: .opd 1,@150000
adda: .opd 15,@150000
addi: .opd 2,@003000
addq: .opd 17,@050000
inc: .opd 16,@050000
addx: .opd 27,@150400
and: .opd 1,@140000
andi: .opd 2,@001000
asl: .opd 8,@160400
asr: .opd 8,@160000
bcc: .opd 6,@062000
bcs: .opd 6,@062400
beq: .opd 6,@063400
bze: .opd 6,@063400
bge: .opd 6,@066000
bgt: .opd 6,@067000
bhi: .opd 6,@061000
bhis: .opd 6,@062000
bhs: .opd 6,@062000
ble: .opd 6,@067400
blo: .opd 6,@062400
bls: .opd 6,@061400
blos: .opd 6,@061400
blt: .opd 6,@066400
bmi: .opd 6,@065400
bne: .opd 6,@063000
bnz: .opd 6,@063000
bpl: .opd 6,@065000
bvc: .opd 6,@064000
bvs: .opd 6,@064400
bchg: .opd 7,@000100
bclr: .opd 7,@000200
bra: .opd 6,@060000
bt: .opd 6,@060000
bset: .opd 7,@000300
bsr: .opd 6,@060400
btst: .opd 7,@000000
chk: .opd 26,@040600
clr: .opd 24,@041000
cmp: .opd 26,@130000
cmpa: .opd 15,@130000
cmpi: .opd 2,@006000
cmpm: .opd 10,@130410
dbcc: .opd 11,@052310
dbcs: .opd 11,@052710
dblo: .opd 11,@052710
dbeq: .opd 11,@053710
dbze: .opd 11,@053710
dbra: .opd 11,@050710
dbf: .opd 11,@050710
dbge: .opd 11,@056310
dbgt: .opd 11,@057310
dbhi: .opd 11,@051310
dbhs: .opd 11,@051310
dble: .opd 11,@057710
dbls: .opd 11,@051710
dblt: .opd 11,@056710
dbmi: .opd 11,@055710
dbne: .opd 11,@053310
dbnz: .opd 11,@053310
dbpl: .opd 11,@055310
dbt: .opd 11,@050310
dbvc: .opd 11,@054310
dbvs: .opd 11,@054710
divs: .opd 5,@100700
divu: .opd 5,@100300
eor: .opd 23,@130000
eori: .opd 2,@005000
exg: .opd 12,@140400
ext: .opd 13,@044000
jmp: .opd 9,@047300
jsr: .opd 9,@047200
illegal:.opd 0,@045374
lea: .opd 30,@040700
link: .opd 19,@047120
lsr: .opd 8,@160010
lsl: .opd 8,@160410
move: .opd 3,@000000
movea: .opd 3,@000100
movem: .opd 20,@044200
movep: .opd 21,@000010
moveq: .opd 22,@070000
muls: .opd 5,@140700
mulu: .opd 5,@140300
nbcd: .opd 25,@044000
neg: .opd 24,@042000
negx: .opd 24,@040000
nop: .opd 0,@047161
not: .opd 24,@043000
or: .opd 1,@100000
ori: .opd 2,@000000
pea: .opd 29,@044100
reset: .opd 0,@047160
rol: .opd 8,@160430
ror: .opd 8,@160030
roxl: .opd 8,@160420
roxr: .opd 8,@160020
rte: .opd 0,@047163
rtr: .opd 0,@047167
rts: .opd 0,@047165
sbcd: .opd 4,@100400
scc: .opd 25,@052300
shs: .opd 25,@052300
scs: .opd 25,@052700
slo: .opd 25,@052700
seq: .opd 25,@053700
sze: .opd 25,@053700
sf: .opd 25,@050700
sge: .opd 25,@056300
sgt: .opd 25,@057300
shi: .opd 25,@051300
sle: .opd 25,@057700
sls: .opd 25,@051700
slt: .opd 25,@056700
smi: .opd 25,@055700
sne: .opd 25,@053300
snz: .opd 25,@053300
spl: .opd 25,@055300
st: .opd 25,@050300
svc: .opd 25,@054300
svs: .opd 25,@054700
stop: .opd 14,@047162
sub: .opd 1,@110000
suba: .opd 15,@110000
subi: .opd 2,@002000
subq: .opd 17,@050400
dec: .opd 16,@050400
subx: .opd 27,@110400
swap: .opd 28,@044100
tas: .opd 25,@045300
trap: .opd 18,@047100
trapv: .opd 0,@047166
tst: .opd 24,@045000
unlk: .opd 13,@047130
.end

View File

@@ -0,0 +1,17 @@
$ !
$ ! Get the latest with the greatest into current directory
$ !
$ copy bin:AR68.EXE []
$ copy bin:AS68.EXE []
$ copy bin:C068.EXE []
$ copy bin:C168.EXE []
$ copy bin:CP68.EXE []
$ copy bin:LO68.EXE []
$ copy bin:NM68.EXE []
$ copy bin:PRTOBJ.EXE []
$ copy bin:RELOC.EXE []
$ copy bin:SENDC68.EXE []
$ copy bin:SIZE68.EXE []
$ copy bin:XDUMP.EXE []
$ copy bin:as68symb.dat []
$ copy [--.as68]as68init. []

View File

@@ -0,0 +1,270 @@
CP/M-68K Cross Software for VMS
-------------------------------
Revision 01.04
--------------
August 28, 1983
---------------
Digital Research, Inc
P.O. Box 579
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
************************
* Company Confidential *
************************
Note: This document contains Digital Research proprietary infor-
mation, and must not be copied or distributed for any purpose
whatsoever, without prior written permission of Digital Research,
Inc.
Address Comments to: Steve Williams, x6082
CP/M-68K Cross Software for VMS Page 2
Introduction
1.0 Introduction
This document describes the installation and execution
procedures for the Digital Research 68000 cross development
software for VAX/VMS. This software includes the C compiler,
assembler, linker, archiver, symbol table print utility, object
module size utility, and S-Record conversion utility. These
tools execute in much the same fashion as they do under CP/M-68K,
as documented in the CP/M-68K Programmer's Guide.
2.0 Installation Procedures
The tools are distributed on a 9-track FLX format mag tape
(either 800 or 1600 bpi is available). To bring up the software
on VMS, perform the following steps:
1. Login to a valid account.
2. Create directories for four ersatz devices: "bin:" (.exe
files), "com:" (command files), "lib:" (library files),
and "cpm:" (CP/M-68K files).
3. Enter VMS "ASSIGN" commands for these directories in
LOGIN.COM, e.g:
$ assign drb0:[c.bin] bin:
$ assign drb0:[c.com] com:
$ assign drb0:[c.lib] lib:
$ assign drb0:[c.cpm] cpm:
Note that the full path name must be specified.
4. Perform the above assignments manually, re-login or
re-execute LOGIN.COM to make the device names valid.
5. Read the tape as follows:
$ allocate mt:
$ mount mt:/foreign
$ set def lib:
$ mcr flx /rs=mt:[1,1]*.*/do/im
$ mcr flx /rs=mt:[1,2]*.*/do
$ set def bin:
$ mcr flx /rs=mt:[1,3]*.*/do
$ set def cpm:
$ mcr flx /rs=mt:[1,4]*.*/do/im
$ mcr flx /rs=mt:[1,5]*.*/do
$ set def com:
$ mcr flx /rs=mt:[1,6]*.*/do
$ @install
$ dismount mt:
$ deallocate mt:
CP/M-68K Cross Software for VMS Page 3
Installation Procedures
You may need to replace the "mt:" device name above with a
different device name, depending on the type of tape drive
you have. Consult your system administrator for details.
6. Add the statements in the file "xlogin.com" to LOGIN.COM
so that the proper command definitions are performed at
login time.
Once the above steps have been performed, the software is ready
to use on VMS.
3.0 Operating Instructions
The following sections describe how to run the installed
cross software on VMS.
3.1 C compilation
A C compilation is performed using the 'c68' command as
follows:
$ c68 file
The ".c" extension is implied and must not be specified. The
'c68' command is extremely similar to the 'C' SUBMIT file on
CP/M-68K. Default floating point format is Motorola FFP using
the "c68" command. The "ce68" command causes the compiler to use
IEEE format floating point numbers.
3.2 Assembly
The assembler is invoked in exactly the same manner as on
CP/M-68K. The output (listing and errors) can be redirected to a
file or device using the ">filename" construct. A sample command
is:
$ as68 -l -u -p file.s >file.lis
This command assembles "file.s" and places the object in
"file.o". The listing is output to "file.lis". All assembler
options valid under CP/M-68K may be used on VMS as well.
3.3 Linking
The LO68 program is used with the same options and command
line syntax as on CP/M-68K. For example,
$ lo68 -r -o file.rel file1.o file2.o
links "file1.o" with "file2.o", creating "file.rel", a relocat-
able format file.
CP/M-68K Cross Software for VMS Page 4
Operating Instructions
C programs are linked using the "clink" command, as with
CP/M-68K:
$ clink file1
This links "file1.o" with the C runtime software to produce
"file1.rel", a relocatable format 68000 load module. Separately
compiled modules may be linked in the following way:
$ clink file1 file2 file3 file4 ...
All of the object files are linked to produce "file1.rel". A
limit of 9 such files is imposed by the command file.
The "clink" command procedure assumes that the program being
linked does not use floating point. To link a program using FFP
floating point, use "clinkf" instead of "clink". IEEE floating
point programs (those compiled with the "ce68" command) are
linked using "clinke".
3.4 Archive Files
The CP/M-68K archive program (AR68) can be used under VMS
exactly in the same fashion as under CP/M-68K. For example, to
create a library file:
$ ar68 r lib a.o b.o c.o
This command creates a library called "lib" containing the three
files "a.o", "b.o", and "c.o".
4.0 Building CP/M-68K
Using the VAX cross tools to build CP/M-68K is similar to
building the operating system on CP/M. You link the BIOS with
CPMLIB to produce a relocatable image file (CPM.REL). Use the
RELOC utility to create the absolute load image (CPM.SYS). The
CP/M-68K SUBMIT files "LCPM.SUB" and "RELCPM.SUB" have been
adapted to VMS procedure files to make this process easier.
For example, to create the EXORmacs distribution system, use
the following sequence of commands:
$ set def cpm:
$ @normbios !Create "bios.o"
$ @lcpm !Create "cpm.rel"
$ @relcpm 15000 !Create CPM.SYS at 15000 hex.
The boot loader for CP/M-68K is generated in a similar fashion,
as documented in the CP/M-68K System Guide.
CP/M-68K Cross Software for VMS Page 5
File Transfer Techniques
5.0 File Transfer Techniques
5.1 S-records
The normal method of transferring files to a 68000 target is
via Motorola S-records. The SENDC68 program converts a load
module file from binary format to S-record format. The command
syntax for this program is:
SENDC68 [-] file.68k >file.sr
Where "file.68k" is an absolute format CP/M-68K load module, and
"file.sr" is the created S-record file. This form of the load
module may be created using the linker "-t" switch or the reloc
utility. The RELCPM command used in the CP/M-68K generation
procedure generates an absolute file. The "-" option specifies
that S-records are not to be created for the ".bss" segment. The
default is to create S-records that zero all locations in the
".bss".
The resulting S-record file may be downloaded via the VMS
"TYPE" command into a target system with a PROM debugger, such as
the MACSbug program on the EXORmacs.
5.2 Other Transfer Techniques
Other techniques such as binary download utilities or CP/M
file transfer utilities may be used to transfer CP/M-68K load
modules to the 68000 target. When such a technique is used, the
bytes in the file must be swapped, and the words of all longword
quantities in the load module header must be swapped. Library
modules may not be transferred using this technique without
extensive rearrangement of the headers. The symbol table in
object and load module files will have the symbol names byte
swapped in this type of transfer.
6.0 Trademarks

View File

@@ -0,0 +1,13 @@
$cp68 :== $bin:cp68
$c068 :== $bin:c068
$c168 :== $bin:c168
$as68 :== $bin:as68
$lo68 :== $bin:lo68
$set noon
$cp68 'p1'.c 'p1'.i
$c068 'p1'.i 'p1'.ic 'p1'.st -f
$delete 'p1'.i;*,'p1'.st;*
$c168 'p1'.ic 'p1'.s -l
$delete 'p1'.ic;*
$as68 -l -u 'p1'.s
$delete 'p1'.s;*

View File

@@ -0,0 +1,13 @@
$ cp68 :== $bin:cp68
$ c068 :== $bin:c068
$ c168 :== $bin:c168
$ as68 :== $bin:as68
$ lo68 :== $bin:lo68
$ set noon
$ cp68 'p1'.c 'p1'.i
$ c068 'p1'.i 'p1'.ic 'p1'.st -e
$ delete 'p1'.i;*,'p1'.st;*
$ c168 'p1'.ic 'p1'.s -l
$ delete 'p1'.ic;*
$ as68 -l -u 'p1'.s
$ delete 'p1'.s;*

View File

@@ -0,0 +1,13 @@
$cp68 :== $bin:cp68
$c068 :== $bin:c068
$c168 :== $bin:c168
$as68 :== $bin:as68
$lo68 :== $bin:lo68
$set noon
$cp68 'p1'.c 'p1'.i
$c068 'p1'.i 'p1'.ic 'p1'.st -f
$delete 'p1'.i;*,'p1'.st;*
$c168 'p1'.ic 'p1'.s -l
$delete 'p1'.ic;*
$as68 -l -u 'p1'.s
$delete 'p1'.s;*

View File

@@ -0,0 +1 @@
$ lo68 -r -o 'p1'.rel lib:s.o 'p1'.o 'p2'.o 'p3'.o 'p4'.o 'p5'.o 'p6'.o 'p7'.o 'p8'.o 'p9'.o lib:clib

View File

@@ -0,0 +1 @@
$ lo68 -r -o 'p1'.rel lib:s.o 'p1'.o 'p2'.o 'p3'.o 'p4'.o 'p5'.o 'p6'.o 'p7'.o 'p8'.o 'p9'.o lib:clib lib:libe.a

View File

@@ -0,0 +1 @@
$ lo68 -r -o 'p1'.rel lib:s.o 'p1'.o 'p2'.o 'p3'.o 'p4'.o 'p5'.o 'p6'.o 'p7'.o 'p8'.o 'p9'.o lib:clib lib:libf.a

View File

@@ -0,0 +1,6 @@
$ set noon
$ @xlogin
$ set def bin:
$ as68 -i as68init
$ del a6*.*;*,as68init.o;*
$ set def com:

View File

@@ -0,0 +1,11 @@
$ mcr flx 'p1'/ze/do
$ set def [.lib]
$ mcr flx 'p1'[1,1]/do/im=clib./im/rs,s.o,w.o,libe.a,libf.a
$ mcr flx 'p1'[1,2]/do/-rw=*.h/rs
$ set def [-.bin]
$ mcr flx 'p1'[1,3]/do/-rw=*.exe,*.com,as68init.,install.doc/rs
$ set def [-.cpm]
$ mcr flx 'p1'[1,4]/do/-rw/im=ldrlib/im/rs,cpmlib
$ mcr flx 'p1'[1,5]/do/-rw=*.c,*.s,*.h,*.sub,*.com/rs
$ set def [-.com]
$ mcr flx 'p1'[1,6]/do/-rw=*.*/rs

View File

@@ -0,0 +1,12 @@
$ as68 :== $bin:as68
$ lo68 :== $bin:lo68
$ c68 :== @com:c68.com
$ cf68 :== @com:cf68.com
$ ce68 :== @com:ce68.com
$ clink :== @com:clink.com
$ ar68 :== $bin:ar68
$ sendc68 :== $bin:sendc68
$ nm68 :== $bin:nm68
$ xdump :== $bin:xdump
$ reloc :== $bin:reloc
$ size68 :== $bin:size68

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
.text
*
* Global Code addresses
*
.globl _init
.globl _biosinit
.globl _flush
.globl _wboot
.globl _cbios
.globl _dskia
.globl _dskic
.globl _setimask
.globl _ccp
.globl cpm * Lowest addr of CP/M
.globl _end * Highest addr of CP/M
*
* Global data addresses
*
.globl _memtab * memory region table
.globl _dpb3 * RAM disk dpb address
.globl _memdsk * -> First memory disk location
*
* Vector Addresses
*
dskint: .equ $3fc * UDC Interrupt vector
trap3: .equ $8c * Trap 3 vector
buserr: .equ $8 * Bus error vector
*
*
_init: lea entry,a0
move.l a0,trap3
lea _dskia,a0
move.l a0,dskint
*
* Auto-Size TPA
*
lea _memtab,a0 * a0 -> Memory region table
move.w #1,(a0)+ * 1 region
move.l #$400,(a0)+ * TPA starts at 400
move.l #cpm-$408,(a0)+ * Ends where CP/M begins
*
* Auto-Size RAM disk
*
move.l buserr,-(sp) * Push bus err vector
lea _end,a0 * a0 -> Last location in CP/M
add.l #cpm,a0 * Linker doesn't reloc this!!
move.l a0,_memdsk * -> first location in RAM disk
move.l #quit,buserr * set up vector -> ourselves
loop:
tst.w (a0)+ * Find
bra loop * End of memory
quit:
add.l #14,a7 * Clear buserr gorp
move.l (a7)+,buserr * Pop buserr vector
sub.l #_end,a0 * a0 = # bytes in RAM disk
sub.l #cpm,a0 * Relocation bug
move.l a0,d0 * Into D reg for shift
move.l #11,d1 * Load shift count
lsr.l d1,d0 * Divide by 2048
move.w d0,_dpb3+6 * Load DRM field of dpb
move #$2000,sr
jsr _biosinit
clr.l d0
rts
*
_wboot: clr.l d0
jmp _ccp
*
entry: move.l d2,-(a7)
move.l d1,-(a7)
move.w d0,-(a7)
jsr _cbios
add #10,a7
rte
*
_dskia: link a6,#0
movem.l d0-d7/a0-a5,-(a7)
jsr _dskic
movem.l (a7)+,d0-d7/a0-a5
unlk a6
rte
*
_setimask: move sr,d0
lsr #8,d0
and.l #7,d0
move sr,d1
ror.w #8,d1
and.w #$fff8,d1
add.w 4(a7),d1
ror.w #8,d1
move d1,sr
rts
.end

View File

@@ -0,0 +1,3 @@
#define LOADER 1
#define CTLTYPE 0
#define MEMDSK 0

View File

@@ -0,0 +1,23 @@
/************************************************/
/* */
/* Portable type definitions for use */
/* with the C BIOS according to */
/* CP/M-68K (tm) standard usage. */
/* */
/************************************************/
#define LONG long
#define ULONG unsigned long
#define WORD short int
#define UWORD unsigned short
#define BYTE char
#define UBYTE unsigned char
#define VOID
#define REG register
#define LOCAL auto
#define MLOCAL static
#define GLOBAL extern
#define EXTERN extern
/************************************************/

View File

@@ -0,0 +1,59 @@
***************************************
* Information to go on the 256 byte *
* boot sector of an ExorMacs *
***************************************
.text
.dc.l $4000 * starting stack pointer
.dc.l start * starting program counter
.dc.w 1 * garbage
.dc.w 1 * length of SAT
.dc.l 2 * secondary directory start
.dc.l 0 * primary directory PSN list start
.dc.l 0 * start of boot loader
.dc.w 26 * length of boot loader
.dc.l $0 * boot execution address
.dc.l $0 * boot load address
.dc.b '9/30' * generation date
.dc.b 'CP/M-68K of 9/30/82 ' * volume descriptor
.dc.b '0020' * version/revision
.dc.w $0a484 * checksum (god help us)
.dc.l $0f1e2d3c * diagnostic test pattern
.dc.l $4b5a6978
.dc.l $8796a5b4
.dc.l $c3d2e1f0
.dc.l $0f1e2d3c * diagnostic test pattern
.dc.l $4b5a6978
.dc.l $8796a5b4
.dc.l $c3d2e1f0
.dc.l $4f8f0f07 * diagnostic test pattern
.dc.l $0b0d0e06
.dc.l $0a0c0408
.dc.l $04020100
.dc.l 00, 00, 00, 00 * diagnostic test pattern
.dc.l 0 * diagnostic test area directory
.dc.l 0 * start of dump area
.dc.w 0 * length of dump area
.dc.l 0 * start of sector lockout table
.dc.w 0 * length of sector lockout table
.dc.l 0,0,0,0,0,0,0 * unused, reserved
.dc.l 0,0,0,0,0,0
.dc.l 0,0,0,0,0,0,0
.dc.l 0,0,0,0,0,0
.dc.b 'EXORMACS' * let's hear it for Motorola
*
* end of volume id
*
* begin boot info proper
*
.ds.b $300 * skip over exception vectors
.even
start: move #$2700,sr
move.l #$8,a0
move.w #253,d0
exlp: move.l #expdef,(a0)+
dbf d0,exlp
jmp grunt
expdef: rte
grunt: move #$2000,sr
.end

View File

@@ -0,0 +1,288 @@
*****************************************************************
* *
* CP/M-68K Loader BIOS *
* Basic Input/Output Subsystem *
* For ERG 68000 with Tarbell floppy disk controller *
* *
*****************************************************************
.globl _bios * declare external entry point
_bios:
cmpi #nfuncs,d0
bge nogood
lsl #2,d0 * multiply bios function by 4
movea.l 6(pc,d0),a0 * get handler address
jsr (a0) * call handler
nogood:
rts
biosbase:
.dc.l nogood
.dc.l nogood
.dc.l constat
.dc.l conin
.dc.l conout
.dc.l nogood
.dc.l nogood
.dc.l nogood
.dc.l home
.dc.l seldsk
.dc.l settrk
.dc.l setsec
.dc.l setdma
.dc.l read
.dc.l nogood
.dc.l nogood
.dc.l sectran
.dc.l setdma
.dc.l getseg
.dc.l nogood
.dc.l nogood
.dc.l nogood
.dc.l setexc
nfuncs=(*-biosbase)/4
constat: move.b $ffff01,d0 * get status byte
andi.w #2,d0 * data available bit on?
beq noton * branch if not
moveq.l #$1,d0 * set result to true
rts
noton: clr.l d0 * set result to false
rts
conin: bsr constat * see if key pressed
tst d0
beq conin * wait until key pressed
move.b $ffff00,d0 * get key
and.l #$7f,d0 * clear all but low 7 bits
rts
conout: move.b $ffff01,d0 * get status
and.b #$1,d0 * check for transmitter buffer empty
beq conout * wait until our port has aged...
move.b d1,$ffff00 * and output it
rts * and exit
*
* Disk Handlers for Tarbell 1793 floppy disk controller
*
maxdsk = 2 * this BIOS supports 2 floppy drives
dphlen = 26 * length of disk parameter header
iobase = $00fffff8 * Tarbell floppy disk port base address
dcmd = iobase * output port for command
dstat = iobase * input status port
dtrk = iobase+1 * disk track port
dsect = iobase+2 * disk sector port
ddata = iobase+3 * disk data port
dwait = iobase+4 * input port to wait for op finished
dcntrl = iobase+4 * output control port for drive selection
home: clr.b track
rts
seldsk:
* select disk A
clr.b seldrv * select drive A
clr.b selcode * select code is 00 for drv 0, $10 for drv 1
move.l #dph0,d0
selrtn: rts
settrk: move.b d1,track
rts
setsec: move.b d1,sector
rts
sectran:
* translate sector in d1 with translate table pointed to by d2
* result in d0
movea.l d2,a0
ext.l d1
move.b #0(a0,d1),d0
ext.l d0
rts
setdma:
move.l d1,dma
rts
read:
* Read one sector from requested disk, track, sector to dma address
* Retry if necessary, return in d0 00 if ok, else non-zero
move.b #10,errcnt * set up retry counter
rretry:
bsr setup
ori #$88,d3 * OR read command with head load bit
move.b d3,dcmd * output it to FDC
rloop: btst #7,dwait
beq rdone * if end of read, exit
move.b ddata,(a0)+ * else, move next byte of data
bra rloop
rdone:
bsr rstatus * get FDC status
bne rerror
clr.l d0
rts
rerror: bsr errchk * go to error handler
subq.b #1,errcnt
bne rretry
move.l #$ffffffff,d0
rts
setup:
* common read and write setup code
* select disk, set track, set sector were all deferred until now
move.b #$d0,dcmd * clear controller, get status
move.b curdrv,d3
cmp.b seldrv,d3
bne newdrive * if drive not selected, do it
move.b track,d3
cmp.b oldtrk,d3
bne newtrk * if not on right track, do it
clr.l d3 * if head already loaded, no head load delay
btst #5,dstat * if head unloaded, treat as new disk
bne sexit
newdrive:
move.b selcode,dcntrl * select the drive
move.b seldrv,curdrv
newtrk:
bsr chkseek * seek to correct track if required
moveq #4,d3 * force head load delay
sexit:
move.b sector,dsect * set up sector number
move.b track,dtrk * set up track number
move.l dma,a0 * dma address to a0
rts
errchk:
btst.b #4,d7
bne chkseek * if record not found error, reseek
rts
chkseek:
* check for correct track, seek if necessary
bsr readid * find out what track we're on
beq chks1 * if read id ok, skip restore code
restore:
* home the drive and reseek to correct track
move.b #$0B,dcmd * restore command to command port
rstwait:
btst #7,dwait
bne rstwait * loop until restore completed
btst #2,dstat
beq restore * if not at track 0, try again
clr.l d3 * track number returned in d3 from readid
chks1:
move.b d3,dtrk * update track register in FDC
move.b track,oldtrk * update oldtrk
cmp.b track,d3 * are we at right track?
beq chkdone * if yes, exit
move.b track,ddata * else, put desired track in data reg of FDC
move.b #$18,dcmd * and issue a seek command
chks2: btst #7,dwait
bne chks2 * loop until seek complete
move.b dstat,d3 * read status to clear FDC
chkdone:
rts
readid:
* read track id, return track number in d3
move.b #$c4,dcmd * issue read id command
move.b dwait,d7 * wait for intrq
move.b ddata,d3 * track byte to d3
rid2:
btst #7,dwait
beq rstatus * wait for intrq
move.b ddata,d7 * read another byte
bra rid2 * and loop
rstatus:
move.b dstat,d7
andi.b #$9d,d7 * set condition codes
rts
getseg:
move.l #memrgn,d0 * return address of mem region table
rts
setexc:
andi.l #$ff,d1 * do only for exceptions 0 - 255
lsl #2,d1 * multiply exception number by 4
movea.l d1,a0
move.l (a0),d0 * return old vector value
move.l d2,(a0) * insert new vector
rts
.data
seldrv: .dc.b $ff * drive requested by seldsk
curdrv: .dc.b $ff * currently selected drive
track: .dc.b 0 * track requested by settrk
oldtrk: .dc.b 0 * track we were on
sector: .dc.w 0
dma: .dc.l 0
selcode: .dc.b 0 * drive select code
errcnt: .dc.b 10 * retry counter
memrgn: .dc.w 1 * 1 memory region
.dc.l $18000 * load the system at 18000 hex
.dc.l $8000
* disk parameter headers
dph0: .dc.l xlt
.dc.w 0 * dummy
.dc.w 0
.dc.w 0
.dc.l dirbuf * ptr to directory buffer
.dc.l dpb * ptr to disk parameter block
.dc.l 0 * ptr to check vector
.dc.l 0 * ptr to allocation vector
* disk parameter block
dpb: .dc.w 26 * sectors per track
.dc.b 3 * block shift
.dc.b 7 * block mask
.dc.b 0 * extent mask
.dc.b 0 * dummy fill
.dc.w 242 * disk size
.dc.w 63 * 64 directory entries
.dc.w $c000 * directory mask
.dc.w 16 * directory check size
.dc.w 2 * track offset
* sector translate table
xlt: .dc.b 1, 7,13,19
.dc.b 25, 5,11,17
.dc.b 23, 3, 9,15
.dc.b 21, 2, 8,14
.dc.b 20,26, 6,12
.dc.b 18,24, 4,10
.dc.b 16,22
.bss
dirbuf: .ds.b 128 * directory buffer
.end

View File

@@ -0,0 +1,360 @@
*****************************************************************
* *
* CP/M-68K BIOS *
* Basic Input/Output Subsystem *
* For ERG 68000 with Tarbell floppy disk controller *
* *
*****************************************************************
.globl _init * bios initialization entry point
.globl _ccp * ccp entry point
_init: move.l #traphndl,$8c * set up trap #3 handler
clr.l d0 * log on disk A, user 0
rts
traphndl:
cmpi #nfuncs,d0
bcc trapng
lsl #2,d0 * multiply bios function by 4
movea.l 6(pc,d0),a0 * get handler address
jsr (a0) * call handler
trapng:
rte
biosbase:
.dc.l _init
.dc.l wboot
.dc.l constat
.dc.l conin
.dc.l conout
.dc.l lstout
.dc.l pun
.dc.l rdr
.dc.l home
.dc.l seldsk
.dc.l settrk
.dc.l setsec
.dc.l setdma
.dc.l read
.dc.l write
.dc.l listst
.dc.l sectran
.dc.l setdma
.dc.l getseg
.dc.l getiob
.dc.l setiob
.dc.l flush
.dc.l setexc
nfuncs=(*-biosbase)/4
wboot: jmp _ccp
constat: move.b $ffff01,d0 * get status byte
andi.w #2,d0 * data available bit on?
beq noton * branch if not
moveq.l #$1,d0 * set result to true
rts
noton: clr.l d0 * set result to false
rts
conin: bsr constat * see if key pressed
tst d0
beq conin * wait until key pressed
move.b $ffff00,d0 * get key
and.l #$7f,d0 * clear all but low 7 bits
cmpi.b #1,d0
beq break
rts
break:
trap $f
.dc.w 0 * return to MACSBUG
rts
conout: move.b $ffff01,d0 * get status
and.b #$1,d0 * check for transmitter buffer empty
beq conout * wait until our port has aged...
move.b d1,$ffff00 * and output it
rts * and exit
lstout: rts
pun: rts
rdr: rts
listst: move.b #$ff,d0
rts
*
* Disk Handlers for Tarbell 1793 floppy disk controller
*
maxdsk = 2 * this BIOS supports 2 floppy drives
dphlen = 26 * length of disk parameter header
iobase = $00fffff8 * Tarbell floppy disk port base address
dcmd = iobase * output port for command
dstat = iobase * input status port
dtrk = iobase+1 * disk track port
dsect = iobase+2 * disk sector port
ddata = iobase+3 * disk data port
dwait = iobase+4 * input port to wait for op finished
dcntrl = iobase+4 * output control port for drive selection
home: clr.b track
rts
seldsk:
* select disk given by register d1.b
moveq #0,d0
cmp.b #maxdsk,d1 * valid drive number?
bpl selrtn * if no, return 0 in d0
move.b d1,seldrv * else, save drive number
lsl.b #4,d1
move.b d1,selcode * select code is 00 for drv 0, $10 for drv 1
move.b seldrv,d0
mulu #dphlen,d0
add.l #dph0,d0 * point d0 at correct dph
selrtn: rts
settrk: move.b d1,track
rts
setsec: move.b d1,sector
rts
sectran:
* translate sector in d1 with translate table pointed to by d2
* result in d0
movea.l d2,a0
ext.l d1
move.b #0(a0,d1),d0
ext.l d0
rts
setdma:
move.l d1,dma
rts
read:
* Read one sector from requested disk, track, sector to dma address
* Retry if necessary, return in d0 00 if ok, else non-zero
move.b #10,errcnt * set up retry counter
rretry:
bsr setup
ori #$88,d3 * OR read command with head load bit
move.b d3,dcmd * output it to FDC
rloop: btst #7,dwait
beq rdone * if end of read, exit
move.b ddata,(a0)+ * else, move next byte of data
bra rloop
rdone:
bsr rstatus * get FDC status
bne rerror
clr.l d0
rts
rerror: bsr errchk * go to error handler
subq.b #1,errcnt
bne rretry
move.l #$ffffffff,d0
rts
write:
* Write one sector to requested disk, track, sector from dma address
* Retry if necessary, return in d0 00 if ok, else non-zero
move.b #10,errcnt * set up retry counter
wretry:
bsr setup
ori #$a8,d3 * OR write command with head load bit
move.b d3,dcmd * output it to FDC
wloop: btst #7,dwait
beq wdone * if end of read, exit
move.b (a0)+,ddata * else, move next byte of data
bra wloop
wdone:
bsr rstatus * get FDC status
bne werror
clr.l d0
rts
werror: bsr errchk * go to error handler
subq.b #1,errcnt
bne wretry
move.l #$ffffffff,d0
rts
setup:
* common read and write setup code
* select disk, set track, set sector were all deferred until now
move.b #$d0,dcmd * clear controller, get status
move.b curdrv,d3
cmp.b seldrv,d3
bne newdrive * if drive not selected, do it
move.b track,d3
cmp.b oldtrk,d3
bne newtrk * if not on right track, do it
clr.l d3 * if head already loaded, no head load delay
btst #5,dstat * if head unloaded, treat as new disk
bne sexit
newdrive:
move.b selcode,dcntrl * select the drive
move.b seldrv,curdrv
newtrk:
bsr chkseek * seek to correct track if required
moveq #4,d3 * force head load delay
sexit:
move.b sector,dsect * set up sector number
move.b track,dtrk * set up track number
move.l dma,a0 * dma address to a0
rts
errchk:
btst.b #4,d7
bne chkseek * if record not found error, reseek
rts
chkseek:
* check for correct track, seek if necessary
bsr readid * find out what track we're on
beq chks1 * if read id ok, skip restore code
restore:
* home the drive and reseek to correct track
move.b #$0B,dcmd * restore command to command port
rstwait:
btst #7,dwait
bne rstwait * loop until restore completed
btst #2,dstat
beq restore * if not at track 0, try again
clr.l d3 * track number returned in d3 from readid
chks1:
move.b d3,dtrk * update track register in FDC
move.b track,oldtrk * update oldtrk
cmp.b track,d3 * are we at right track?
beq chkdone * if yes, exit
move.b track,ddata * else, put desired track in data reg of FDC
move.b #$18,dcmd * and issue a seek command
chks2: btst #7,dwait
bne chks2 * loop until seek complete
move.b dstat,d3 * read status to clear FDC
chkdone:
rts
readid:
* read track id, return track number in d3
move.b #$c4,dcmd * issue read id command
move.b dwait,d7 * wait for intrq
move.b ddata,d3 * track byte to d3
rid2:
btst #7,dwait
beq rstatus * wait for intrq
move.b ddata,d7 * read another byte
bra rid2 * and loop
rstatus:
move.b dstat,d7
andi.b #$9d,d7 * set condition codes
rts
flush:
clr.l d0 * return successful
rts
getseg:
move.l #memrgn,d0 * return address of mem region table
rts
getiob:
rts
setiob:
rts
setexc:
andi.l #$ff,d1 * do only for exceptions 0 - 255
cmpi #47,d1
beq noset * this BIOS doesn't set Trap 15
cmpi #9,d1 * or Trace
beq noset
lsl #2,d1 * multiply exception nmbr by 4
movea.l d1,a0
move.l (a0),d0 * return old vector value
move.l d2,(a0) * insert new vector
noset: rts
.data
seldrv: .dc.b $ff * drive requested by seldsk
curdrv: .dc.b $ff * currently selected drive
track: .dc.b 0 * track requested by settrk
oldtrk: .dc.b 0 * track we were on
sector: .dc.w 0
dma: .dc.l 0
selcode: .dc.b 0 * drive select code
errcnt: .dc.b 10 * retry counter
memrgn: .dc.w 1 * 1 memory region
.dc.l $800 * starts at 800 hex
.dc.l $17800 * goes until 18000 hex
* disk parameter headers
dph0: .dc.l xlt
.dc.w 0 * dummy
.dc.w 0
.dc.w 0
.dc.l dirbuf * ptr to directory buffer
.dc.l dpb * ptr to disk parameter block
.dc.l ckv0 * ptr to check vector
.dc.l alv0 * ptr to allocation vector
dph1: .dc.l xlt
.dc.w 0 * dummy
.dc.w 0
.dc.w 0
.dc.l dirbuf * ptr to directory buffer
.dc.l dpb * ptr to disk parameter block
.dc.l ckv1 * ptr to check vector
.dc.l alv1 * ptr to allocation vector
* disk parameter block
dpb: .dc.w 26 * sectors per track
.dc.b 3 * block shift
.dc.b 7 * block mask
.dc.b 0 * extent mask
.dc.b 0 * dummy fill
.dc.w 242 * disk size
.dc.w 63 * 64 directory entries
.dc.w $c000 * directory mask
.dc.w 16 * directory check size
.dc.w 2 * track offset
* sector translate table
xlt: .dc.b 1, 7,13,19
.dc.b 25, 5,11,17
.dc.b 23, 3, 9,15
.dc.b 21, 2, 8,14
.dc.b 20,26, 6,12
.dc.b 18,24, 4,10
.dc.b 16,22
.bss
dirbuf: .ds.b 128 * directory buffer
ckv0: .ds.b 16 * check vector
ckv1: .ds.b 16
alv0: .ds.b 32 * allocation vector
alv1: .ds.b 32
.end

View File

@@ -0,0 +1 @@
$ lo68 -r -o cpm.rel -ucpm cpmlib biosa.o bios.o

View File

@@ -0,0 +1 @@
lo68 -r -o cpm.rel -ucpm cpmlib biosa.o bios.o

View File

@@ -0,0 +1,41 @@
.text
.globl _bios
.globl _biosinit
.globl _cbios
.globl _dskia
.globl _dskic
.globl _setimask
*
*
*
*
_bios: link a6,#0
move.l d2,-(a7)
move.l d1,-(a7)
move.w d0,-(a7)
move #$2000,sr
lea _dskia,a0
move.l a0,$3fc
jsr _cbios
unlk a6
rts
*
_dskia: link a6,#0
movem.l d0-d7/a0-a5,-(a7)
jsr _dskic
movem.l (a7)+,d0-d7/a0-a5
unlk a6
rte
*
_setimask: move sr,d0
lsr #8,d0
and.l #7,d0
move sr,d1
ror.w #8,d1
and.w #$fff8,d1
add.w 4(a7),d1
ror.w #8,d1
move d1,sr
rts
*
.end

View File

@@ -0,0 +1,9 @@
$ set noon
$ !
$ ! Build file for EXORmacs loader bios using VMS cross tools
$ !
$ copy loadbios.h biostype.h
$ c68 bios
$ as68 -u -l ldbiosa.s
$ as68 -u -l booter.s
$ rename bios.o ldbios.o

View File

@@ -0,0 +1,9 @@
$ set noon
$ !
$ ! Build file for EXORmacs loader bios using VMS cross tools
$ !
$ copy loadbios.h biostype.h
$ cc68 bios
$ as68 -u -l ldbiosa.s
$ as68 -u -l booter.s
$ rename bios.o ldbios.o

View File

@@ -0,0 +1,3 @@
#define LOADER 1
#define CTLTYPE 0
#define MEMDSK 0

View File

@@ -0,0 +1,9 @@
pip biostype.h=loadbios.h
cp68 bios.c bios.i
c068 bios.i bios.ic bios.st
era bios.i
era bios.st
c168 bios.ic bios.s -l
as68 -u -l bios.s
as68 -u -l ldbiosa.s
pip ldbios.o=bios.o

View File

@@ -0,0 +1 @@
$ lo68 -s -t0 -uldr -o cpmldr.sys booter.o ldrlib ldbiosa.o ldbios.o

View File

@@ -0,0 +1 @@
lo68 -s -t0 -uldr -o cpmldr.sys booter.o ldrlib ldbiosa.o ldbios.o

View File

@@ -0,0 +1,4 @@
$ set noon
$ copy normbios.h biostype.h
$ c68 bios
$ as68 -u -l biosa.s

View File

@@ -0,0 +1,4 @@
$ set noon
$ copy normbios.h biostype.h
$ cc68 bios
$ as68 -u -l biosa.s

View File

@@ -0,0 +1,3 @@
#define LOADER 0
#define CTLTYPE 0
#define MEMDSK 4

View File

@@ -0,0 +1,8 @@
pip biostype.h=normbios.h
cp68 bios.c bios.i
c068 bios.i bios.ic bios.st
era bios.i
era bios.st
c168 bios.ic bios.s -l
as68 -u -l bios.s
as68 -u -l biosa.s

View File

@@ -0,0 +1,194 @@
*********************************************************
* *
* Program to Write Boot Tracks for CP/M-68K (tm) *
* *
* Copyright Digital Research 1982 *
* *
*********************************************************
*
*
*
prntstr = 9 BDOS Functions
dseldsk = 14
open = 15
readseq = 20
dsetdma = 26
*
seldsk = 9 BIOS Functions
settrk = 10
setsec = 11
isetdma = 12
write = 14
sectran = 16
flush = 21
*
bufcnt = $80
bufsize = $80*bufcnt
*
.text
*
start: link a6,#0
move.l 8(a6),a0 base page address
lea $5c(a0),a1
move.l a1,fcb
clr.b hflag
add #$81,a0 first character of command tail
scan: cmpi.b #$20,(a0)+ skip over blanks
beq scan
sub.l #1,a0
scan1: tst.b (a0)
beq erxit
cmpi.b #$2d,(a0)+ check for -H flag
bne nohyph
cmpi.b #$48,(a0)+
bne erxit
tst.b hflag
bne erxit
move.b #$ff,hflag
sub.l #$24,fcb change to 2nd default fcb
bra scan
nohyph: cmpi.b #$20,(a0)
bne scan1
scan2: cmpi.b #$20,(a0)+
beq scan2
cmpi.b #$61,-(a0) get disk letter
blt upper upshift
sub #$20,(a0)
upper: cmpi.b #$41,(a0) compare with range A - P
blt erxit
cmpi.b #$50,(a0)
bgt erxit
move.b (a0),d0
ext.w d0 put disk letter into range 0 - 15
sub.w #$41,d0
move.w d0,dsk
*
* open file to copy
*
move.w #open,d0
move.l fcb,d1
trap #2
cmpi.w #$00ff,d0
bne openok
move.l #opnfl,d1
jmp erx
openok: move.l fcb,a0
clr.b 32(a0)
*
* read
*
move.l #buf,d2
clr.w count
rloop: move.w #dsetdma,d0
move.l d2,d1
trap #2
move.w #readseq,d0
move.l fcb,d1
trap #2
tst.w d0
bne wrtout
add.l #128,d2
add.w #1,count
cmpi.w #bufcnt,count
bgt bufoflx
bra rloop
*
* write
*
wrtout: move.w #seldsk,d0 select the disk
move.w dsk,d1
clr.b d2
trap #3
tst.l d0 check for select error
beq selerx
move.l d0,a0
move.l 14(a0),a0 get DPB address
move.w (a0),spt get sectors per track
move.w 14(a0),off get offset
clr.w trk start at trk 0
move.w #1,sect start at sector 1
lea buf,a0
tst.b hflag
bne wrt1
cmpi.w #$601a,(a0)
bne wrt1
add.l #28,a0
wrt1: move.l a0,bufp
*
wloop: tst.w count
beq exit
move.w sect,d1 check for end-of-track
cmp.w spt,d1
ble sok
move.w #1,sect advance to new track
move.w trk,d0
add.w #1,d0
move.w d0,trk
cmp.w off,d0
bge oflex
sok: move.w #settrk,d0 set the track
move.w trk,d1
trap #3
move.w sect,d1 set sector
move.w #setsec,d0
trap #3
move.w #isetdma,d0 set up dma address for write
move.l bufp,d1
trap #3
move.w #write,d0 and write
clr.w d1
trap #3
tst.w d0 check for write error
bne wrterx
add #1,sect increment sector number
sub #1,count
add.l #128,bufp
bra wloop
*
exit: move.w #flush,d0 exit location - flush bios buffers
trap #3
unlk a6
rts and exit to CCP
*
erxit: move.l #erstr,d1 miscellaneous errors
erx: move.w #prntstr,d0 print error message and exit
trap #2
bra exit
*
selerx: move.l #selstr,d1 disk select error
bra erx
wrterx: move.l #wrtstr,d1 disk write error
bra erx
bufoflx: move.l #bufofl,d1 buffer overflow
bra erx
oflex: move.l #trkofl,d1
bra erx
*
*
.bss
*
.even
*
buf: .ds.b bufsize+128
*
fcb: .ds.l 1 fcb address
spt: .ds.w 1 sectors per track
sect: .ds.w 1 current sector
trk: .ds.w 1 current track
dsk: .ds.w 1 selected disk
off: .ds.w 1 1st track of non-boot area
count: .ds.w 1
bufp: .ds.l 1
hflag: .ds.b 1
*
.data
*
erstr: .dc.b 'Invalid Command Line',13,10,'$'
selstr: .dc.b 'Select Error',13,10,'$'
wrtstr: .dc.b 'Write Error',13,10,'$'
opnfl: .dc.b 'Cannot Open Source File',13,10,'$'
bufofl: .dc.b 'Buffer Overflow',13,10,'$'
trkofl: .dc.b 'Too Much Data for System Tracks',13,10,'$'
*
*
.end

View File

@@ -0,0 +1 @@
$ reloc -b'p1' cpm.rel cpm.sys

View File

@@ -0,0 +1 @@
reloc -b$1 cpm.rel cpm.sys

View File

@@ -0,0 +1,270 @@
CP/M-68K Cross Software for VMS
-------------------------------
Revision 01.04
--------------
August 28, 1983
---------------
Digital Research, Inc
P.O. Box 579
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
************************
* Company Confidential *
************************
Note: This document contains Digital Research proprietary infor-
mation, and must not be copied or distributed for any purpose
whatsoever, without prior written permission of Digital Research,
Inc.
Address Comments to: Steve Williams, x6082
CP/M-68K Cross Software for VMS Page 2
Introduction
1.0 Introduction
This document describes the installation and execution
procedures for the Digital Research 68000 cross development
software for VAX/VMS. This software includes the C compiler,
assembler, linker, archiver, symbol table print utility, object
module size utility, and S-Record conversion utility. These
tools execute in much the same fashion as they do under CP/M-68K,
as documented in the CP/M-68K Programmer's Guide.
2.0 Installation Procedures
The tools are distributed on a 9-track FLX format mag tape
(either 800 or 1600 bpi is available). To bring up the software
on VMS, perform the following steps:
1. Login to a valid account.
2. Create directories for four ersatz devices: "bin:" (.exe
files), "com:" (command files), "lib:" (library files),
and "cpm:" (CP/M-68K files).
3. Enter VMS "ASSIGN" commands for these directories in
LOGIN.COM, e.g:
$ assign drb0:[c.bin] bin:
$ assign drb0:[c.com] com:
$ assign drb0:[c.lib] lib:
$ assign drb0:[c.cpm] cpm:
Note that the full path name must be specified.
4. Perform the above assignments manually, re-login or
re-execute LOGIN.COM to make the device names valid.
5. Read the tape as follows:
$ allocate mt:
$ mount mt:/foreign
$ set def lib:
$ mcr flx /rs=mt:[1,1]*.*/do/im
$ mcr flx /rs=mt:[1,2]*.*/do
$ set def bin:
$ mcr flx /rs=mt:[1,3]*.*/do
$ set def cpm:
$ mcr flx /rs=mt:[1,4]*.*/do/im
$ mcr flx /rs=mt:[1,5]*.*/do
$ set def com:
$ mcr flx /rs=mt:[1,6]*.*/do
$ @install
$ dismount mt:
$ deallocate mt:
CP/M-68K Cross Software for VMS Page 3
Installation Procedures
You may need to replace the "mt:" device name above with a
different device name, depending on the type of tape drive
you have. Consult your system administrator for details.
6. Add the statements in the file "xlogin.com" to LOGIN.COM
so that the proper command definitions are performed at
login time.
Once the above steps have been performed, the software is ready
to use on VMS.
3.0 Operating Instructions
The following sections describe how to run the installed
cross software on VMS.
3.1 C compilation
A C compilation is performed using the 'c68' command as
follows:
$ c68 file
The ".c" extension is implied and must not be specified. The
'c68' command is extremely similar to the 'C' SUBMIT file on
CP/M-68K. Default floating point format is Motorola FFP using
the "c68" command. The "ce68" command causes the compiler to use
IEEE format floating point numbers.
3.2 Assembly
The assembler is invoked in exactly the same manner as on
CP/M-68K. The output (listing and errors) can be redirected to a
file or device using the ">filename" construct. A sample command
is:
$ as68 -l -u -p file.s >file.lis
This command assembles "file.s" and places the object in
"file.o". The listing is output to "file.lis". All assembler
options valid under CP/M-68K may be used on VMS as well.
3.3 Linking
The LO68 program is used with the same options and command
line syntax as on CP/M-68K. For example,
$ lo68 -r -o file.rel file1.o file2.o
links "file1.o" with "file2.o", creating "file.rel", a relocat-
able format file.
CP/M-68K Cross Software for VMS Page 4
Operating Instructions
C programs are linked using the "clink" command, as with
CP/M-68K:
$ clink file1
This links "file1.o" with the C runtime software to produce
"file1.rel", a relocatable format 68000 load module. Separately
compiled modules may be linked in the following way:
$ clink file1 file2 file3 file4 ...
All of the object files are linked to produce "file1.rel". A
limit of 9 such files is imposed by the command file.
The "clink" command procedure assumes that the program being
linked does not use floating point. To link a program using FFP
floating point, use "clinkf" instead of "clink". IEEE floating
point programs (those compiled with the "ce68" command) are
linked using "clinke".
3.4 Archive Files
The CP/M-68K archive program (AR68) can be used under VMS
exactly in the same fashion as under CP/M-68K. For example, to
create a library file:
$ ar68 r lib a.o b.o c.o
This command creates a library called "lib" containing the three
files "a.o", "b.o", and "c.o".
4.0 Building CP/M-68K
Using the VAX cross tools to build CP/M-68K is similar to
building the operating system on CP/M. You link the BIOS with
CPMLIB to produce a relocatable image file (CPM.REL). Use the
RELOC utility to create the absolute load image (CPM.SYS). The
CP/M-68K SUBMIT files "LCPM.SUB" and "RELCPM.SUB" have been
adapted to VMS procedure files to make this process easier.
For example, to create the EXORmacs distribution system, use
the following sequence of commands:
$ set def cpm:
$ @normbios !Create "bios.o"
$ @lcpm !Create "cpm.rel"
$ @relcpm 15000 !Create CPM.SYS at 15000 hex.
The boot loader for CP/M-68K is generated in a similar fashion,
as documented in the CP/M-68K System Guide.
CP/M-68K Cross Software for VMS Page 5
File Transfer Techniques
5.0 File Transfer Techniques
5.1 S-records
The normal method of transferring files to a 68000 target is
via Motorola S-records. The SENDC68 program converts a load
module file from binary format to S-record format. The command
syntax for this program is:
SENDC68 [-] file.68k >file.sr
Where "file.68k" is an absolute format CP/M-68K load module, and
"file.sr" is the created S-record file. This form of the load
module may be created using the linker "-t" switch or the reloc
utility. The RELCPM command used in the CP/M-68K generation
procedure generates an absolute file. The "-" option specifies
that S-records are not to be created for the ".bss" segment. The
default is to create S-records that zero all locations in the
".bss".
The resulting S-record file may be downloaded via the VMS
"TYPE" command into a target system with a PROM debugger, such as
the MACSbug program on the EXORmacs.
5.2 Other Transfer Techniques
Other techniques such as binary download utilities or CP/M
file transfer utilities may be used to transfer CP/M-68K load
modules to the 68000 target. When such a technique is used, the
bytes in the file must be swapped, and the words of all longword
quantities in the load module header must be swapped. Library
modules may not be transferred using this technique without
extensive rearrangement of the headers. The symbol table in
object and load module files will have the symbol names byte
swapped in this type of transfer.
6.0 Trademarks

View File

@@ -0,0 +1,239 @@
.title ^^CP/M-68K Cross Software for VMS
.nofill
.bl 4
.c
CP/M-68K Cross Software for VMS
.c
-------------------------------
.bl 2
.c
Revision 01.04
.c
--------------
.bl 2
.c
August 28, 1983
.c
---------------
.bl 12
.c
Digital Research, Inc
.c
P.O. Box 579
.c
Pacific Grove, CA 93950
.c
(408) 649-3896
.c
TWX 910 360 5001
.bl 4
.c
************************
.c
* Company Confidential *
.c
************************
.bl 4
.fill
Note: This document contains Digital Research proprietary information, and
must not be copied or distributed for any purpose whatsoever, without prior
written permission of Digital Research, Inc.
.bl 2
Address Comments to: Steve Williams, x6082
.subtitle Introduction
.page
.hl 1 Introduction
.i 5
This document describes the installation and execution procedures for the
Digital Research 68000 cross development software for VAX/VMS. This software
includes the C compiler, assembler, linker, archiver, symbol table print
utility, object module size utility, and S-Record conversion utility. These
tools execute in much the same fashion as they do under CP/M-68K, as
documented in the CP/M-68K Programmer's Guide.
.subtitle Installation Procedures
.hl 1 Installation Procedures
.i 5
The tools are distributed on a 9-track FLX format mag tape (either 800 or
1600 bpi is available). To bring up the software on VMS, perform the
following steps:
.ls
.le;Login to a valid account.
.le;Create directories for four ersatz devices: "bin:" (.exe files), "com:"
(command files), "lib:" (library files), and "cpm:"
(CP/M-68K files).
.le;Enter VMS "ASSIGN" commands for these directories in LOGIN.COM,
e.g:
.bl 1
.nofill
$ assign drb0:[c.bin] bin:
$ assign drb0:[c.com] com:
$ assign drb0:[c.lib] lib:
$ assign drb0:[c.cpm] cpm:
.bl 1
.fill
Note that the full path name must be specified.
.le;Perform the above assignments manually, re-login or re-execute LOGIN.COM
to make the device names valid.
.le;Read the tape as follows:
.bl 1
.nofill
$ allocate mt:
$ mount mt:/foreign
$ set def lib:
$ mcr flx /rs=mt:[1,1]*.*/do/im
$ mcr flx /rs=mt:[1,2]*.*/do
$ set def bin:
$ mcr flx /rs=mt:[1,3]*.*/do
$ set def cpm:
$ mcr flx /rs=mt:[1,4]*.*/do/im
$ mcr flx /rs=mt:[1,5]*.*/do
$ set def com:
$ mcr flx /rs=mt:[1,6]*.*/do
$ _@install
$ dismount mt:
$ deallocate mt:
.fill
.bl 1
You may need to replace the "mt:" device name above with a different device
name, depending on the type of tape drive you have. Consult your system
administrator for details.
.le;Add the statements in the file "xlogin.com" to LOGIN.COM so that the
proper command definitions are performed at login time.
.els
Once the above steps have been performed, the software is ready to use on
VMS.
.subtitle Operating Instructions
.hl 1 Operating Instructions
.i 5
The following sections describe how to run the installed cross software on
VMS.
.hl 2 C compilation
.i 5
A C compilation is performed using the 'c68' command as follows:
.bl 1
.i 8
$ c68 file
.bl 1
The ".c" extension is implied and must not be specified. The 'c68' command
is extremely similar to the 'C' SUBMIT file on CP/M-68K.
Default floating point format is Motorola FFP using the "c68" command.
The "ce68" command causes the compiler to use IEEE format floating point
numbers.
.hl 2 Assembly
.i 5
The assembler is invoked in exactly the same manner as on CP/M-68K. The
output (listing and errors) can be redirected to a file or device using the
">filename" construct. A sample command is:
.bl 1
.i 8
$ as68 -l -u -p file.s >file.lis
.bl 1
This command assembles "file.s" and places the object in "file.o". The
listing is output to "file.lis". All assembler options valid under CP/M-68K
may be used on VMS as well.
.hl 2 Linking
.i 5
The LO68 program is used with the same options and command line syntax as on
CP/M-68K. For example,
.bl 1
.i 5
$ lo68 -r -o file.rel file1.o file2.o
.bl 1
links "file1.o" with "file2.o", creating "file.rel", a relocatable format
file.
.bl 1
.i 5
C programs are linked using the "clink" command, as with CP/M-68K:
.bl 1
.i 5
$ clink file1
.bl 1
This links "file1.o" with the C runtime software to produce "file1.rel", a
relocatable format 68000 load module.
Separately compiled modules may be linked in the following way:
.bl 1
.i 5
$ clink file1 file2 file3 file4 ...
.bl 1
All of the object files are linked to produce "file1.rel". A limit of 9 such
files is imposed by the command file.
.bl 1
.i 5
The "clink" command procedure assumes that the program being linked does not
use floating point. To link a program using FFP floating point, use
"clinkf" instead of "clink". IEEE floating point programs (those compiled
with the "ce68" command) are linked using "clinke".
.hl 2 Archive Files
.i 5
The CP/M-68K archive program (AR68) can be used under VMS exactly in the same
fashion as under CP/M-68K. For example, to create a library file:
.bl 1
.i 8
$ ar68 r lib a.o b.o c.o
.bl 1
This command creates a library called "lib" containing the three files "a.o",
"b.o", and "c.o".
.subtitle Building CP/M-68K
.hl 1 Building CP/M-68K
.i 5
Using the VAX cross tools to build CP/M-68K is similar to building the
operating system on CP/M. You link the BIOS with CPMLIB to produce a
relocatable image file (CPM.REL). Use the RELOC utility to create the
absolute load image (CPM.SYS). The CP/M-68K SUBMIT files "LCPM.SUB" and
"RELCPM.SUB" have been adapted to VMS procedure files to make this process
easier.
.bl 1
.i 5
For example, to create the EXORmacs distribution system, use the following
sequence of commands:
.bl 1
.nofill
.lm +8
$ set def cpm:
$ _@normbios !Create "bios.o"
$ _@lcpm !Create "cpm.rel"
$ _@relcpm 15000 !Create CPM.SYS at 15000 hex.
.lm -8
.fill
.bl 1
The boot loader for CP/M-68K is generated in a similar fashion, as documented
in the CP/M-68K System Guide.
.subtitle File Transfer Techniques
.hl 1 File Transfer Techniques
.hl 2 S-records
.i 5
The normal method of transferring files to a 68000 target is via Motorola
S-records. The SENDC68 program converts a load module file from binary format
to S-record format. The command syntax for this program is:
.bl 1
.i 8
SENDC68 [-] file.68k >file.sr
.bl 1
Where "file.68k" is an absolute format CP/M-68K load module, and "file.sr"
is the created S-record file. This form of the load module may be created
using the linker "-t" switch or the reloc utility. The RELCPM command used
in the CP/M-68K generation procedure generates an absolute file.
The "-" option specifies that S-records are
not to be created for the ".bss" segment. The default is to create S-records
that zero all locations in the ".bss".
.bl 1
.i 5
The resulting S-record file may be downloaded via the VMS "TYPE" command into
a target system with a PROM debugger, such as the MACSbug program on the
EXORmacs.
.hl 2 Other Transfer Techniques
.i 5
Other techniques such as binary download utilities or CP/M file transfer
utilities may be used to transfer CP/M-68K load modules to the 68000 target.
When such a technique is used, the bytes in the file must be swapped, and
the words of all longword quantities in the load module header must be
swapped. Library modules may not be transferred using this technique without
extensive rearrangement of the headers. The symbol table in object and
load module files will have the symbol names byte swapped in this type of
transfer.
.hl 1 Trademarks
.i 5
VAX, VMS, and FLX are trademarks of Digital Equipment Corporation. EXORmacs,
and MACSbug are trademarks of Motorola, Inc. CP/M-68K is a trademark of
Digital Research, Inc.

View File

@@ -0,0 +1,39 @@
/****************************************************************************/
/* */
/* B A S E P A G E . H */
/* ------------------- */
/* */
/* This file contains a definition of the CP/M basepage structure, */
/* b_page. */
/* */
/* NOTE: In the portable CP/M environment, it is NOT guaranteed */
/* that the location of the base page is known at link-edit time */
/* (as it is, for example, in CP/M-80 and CP/M-86.) Instead, a */
/* pointer to the current basepage is delivered by the BDOS */
/* to each new program which is run. This pointer, _base, is */
/* initialized by the C startup function (startup.s) and is */
/* available to C programs as an external. */
/* */
/* "cpm.h" MUST be '#include'd before this file */
/* */
/****************************************************************************/
struct b_page
{
BYTE *ltpa; /* Low TPA address */
BYTE *htpa; /* High TPA address */
BYTE *lcode; /* Start address of code seg*/
LONG codelen; /* Code segment length */
BYTE *ldata; /* Start address of data seg*/
LONG datalen; /* Data segment length */
BYTE *lbss; /* Start address of bss seg */
LONG bsslen; /* Bss segment length */
LONG freelen; /* Free segment length */
BYTE resvd1[20]; /* Reserved area */
struct fcb fcb2; /* Second basepage FCB */
struct fcb fcb1; /* First basepage FCB */
BYTE buff[128]; /* Default DMA buffer, */
/* command line tail */
};
extern struct b_page *_base;

View File

@@ -0,0 +1,367 @@
/****************************************************************************/
/* */
/* B D O S . H */
/* ----------- */
/* */
/* Copyright (c) 1982, Zilog Incorporated */
/* */
/* Macros defining the direct BDOS calls used by the standard CP/M */
/* utilities (ED, PIP, STAT, SET, SHOW.) Some necessary data */
/* data structures are also defined. */
/* */
/* All macros return a long value, even when the BDOS function they */
/* call does produce a return parameter. */
/* */
/* This header file can be used applications which do not require */
/* to use the C standard I/O library functions. For applications */
/* which require the library, but which wish to make use of the */
/* additional information in this file, cpm.h should be included in */
/* the source ahead of this file. The compiler flags multiple */
/* definition errors if this ordering is not observed. */
/* */
/* portab.h must always be included ahead of this file. */
/* */
/****************************************************************************/
extern long __BDOS(); /* BDOS entry point */
#define XADDR long /* 32-bit address data type */
/****************************************************************************/
/* The following BDOS calls are defined in cpm.h. Define them only if they */
/* are not defined already. */
/****************************************************************************/
#ifndef EXIT /* Find out where we stand */
/* Define if necessary */
#define EXIT 0 /* Exit to BDOS */
#define CONOUT 2 /* Direct console output */
#define LSTOUT 5 /* Direct list device output*/
#define CONIO 6 /* Direct console I/O */
#define CONBUF 10 /* Read console buffer */
#define OPEN 15 /* OPEN a disk file */
#define CLOSE 16 /* Close a disk file */
#define DELETE 19 /* Delete a disk file */
#define CREATE 22 /* Create a disk file */
#define SETDMA 26 /* Set DMA address */
#define B_READ 33 /* Read Random record */
#define B_WRITE 34 /* Write Random record */
#define FILSIZ 35 /* Compute File Size */
#define SETMSC 44 /* Set Multi-Sector Count */
#endif
/****************************************************************************/
/* The following BDOS calls are not defined in cpm.h */
/****************************************************************************/
#define CONIN 1 /* Single char I/P with echo*/
#define READER 3 /* Paper tape input */
#define PUNCH 4 /* Paper tape output */
#define GET_IOB 7 /* Get I/O byte */
#define SET_IOB 8 /* Set I/O byte */
#define PRINT 9 /* Print $-terminated line */
#define CONSTAT 11 /* Check if I/P char waiting*/
#define VERSION 12 /* Return version number */
#define RS_DISK 13 /* Reset disk system */
#define SEL_DISK 14 /* Select disk */
#define SRCH_1ST 17 /* Search 1st filename match*/
#define SRCH_NEXT 18 /* Search next match */
#define S_READ 20 /* Sequential read from file*/
#define S_WRITE 21 /* Sequential write to file */
#define RENAME 23 /* Rename a file */
#define RET_LOGIN 24 /* Return login vector */
#define RET_CDISK 25 /* Return current disk */
#define GET_ALLOC 27 /* Get allocation vector */
#define WR_PROTD 28 /* Write protect disk */
#define GET_RO 29 /* Get read-only vector */
#define SET_ATT 30 /* Set file attributes */
#define GET_DPB 31 /* Get disk parameters */
#define GSET_UCODE 32 /* Get/set user code */
#define SET_RAND 36 /* Set random record */
#define RS_DRIVE 37 /* Reset disk specified drv */
/* 38, 39 not used */
#define B_WRZF 40 /* Write random, zero fill */
/* 41 - 43 not used */
#define RET_ERRORS 45 /* Set error return mode */
#define GET_DFS 46 /* Get free disk space */
#define CHAIN 47 /* Chain to program via CCP */
#define FLUSH 48 /* Flush buffers to disk */
#define GSET_SCB 49 /* Get/set system control bk*/
#define BIOS_CALL 50 /* Direct call to BIOS */
/* 51 - 58 not used */
#define PROG_LOAD 59 /* Program load */
/* 60 unused */
#define SET_EXV 61 /* Set exception vector */
#define SET_SUP 62 /* Set supervisor state */
#define SET_LABEL 100 /* Set directory label */
#define GET_LABEL 101 /* Get directory label */
#define GET_XFCB 102 /* Get extended FCB */
#define SET_XFCB 103 /* Set extended FCB */
#define COND_LST 161 /* Conditionally attach LST:*/
/****************************************************************************/
/* The macros themselves... */
/****************************************************************************/
#define _conin() (__BDOS(CONIN, (long) 0))
#define _conout(a) (__BDOS(CONOUT, (long) (a)))
#define _reader() (__BDOS(READER, (long) 0))
#define _punch(a) (__BDOS(PUNCH, (long) (a)))
#define _lstout(a) (__BDOS(LSTOUT, (long) (a)))
#define _conio(a) (__BDOS(CONIO, (long) (a)))
#define _get_iob() (__BDOS(GET_IOB, (long) 0))
#define _set_iob(a) (__BDOS(SET_IOB, (long) (a)))
#define _print(a) (__BDOS(PRINT, (long) (a)))
#define _conbuf(a) (__BDOS(CONBUF, (long) (a)))
#define _constat() (__BDOS(CONSTAT, (long) 0))
#define _version() (__BDOS(VERSION, (long) 0))
#define _rs_disk(a) (__BDOS(RS_DISK, (long) (a)))
#define _sel_disk(a) (__BDOS(SEL_DISK, (long) (a)))
#define _open(a) (__BDOS(OPEN, (long) (a)))
#define _close(a) (__BDOS(CLOSE, (long) (a)))
#define _srch_1st(a) (__BDOS(SRCH_1ST, (long) (a)))
#define _srch_next() (__BDOS(SRCH_NEXT, (long) 0))
#define _delete(a) (__BDOS(DELETE, (long) (a)))
#define _s_read(a) (__BDOS(S_READ, (long) (a)))
#define _s_write(a) (__BDOS(S_WRITE, (long) (a)))
#define _create(a) (__BDOS(CREATE, (long) (a)))
#define _rename(a) (__BDOS(RENAME, (long) (a)))
#define _ret_login() (__BDOS(RET_LOGIN, (long) 0))
#define _ret_cdisk() (__BDOS(RET_CDISK, (long) 0))
#define _setdma(a) (__BDOS(SETDMA, (long) (a)))
#define _get_alloc() (__BDOS(GET_ALLOC, (long) 0))
#define _wr_protd() (__BDOS(WR_PROTD, (long) 0))
#define _get_ro() (__BDOS(GET_RO, (long) 0))
#define _set_att(a) (__BDOS(SET_ATT, (long) (a)))
/* _get_dpb has parameter in*/
/* some implementations */
/* of CP/M but not others */
/* This macro suitable only */
/* for former */
#define _get_dpb(a) (__BDOS(GET_DPB, (long) (a)))
/* This one handles latter */
#define _get_dpa() (__BDOS(GET_DPB, (long) 0))
#define _gset_ucode(a) (__BDOS(GSET_UCODE, (long) (a)))
#define _b_read(a) (__BDOS(B_READ, (long) (a)))
#define _b_write(a) (__BDOS(B_WRITE, (long) (a)))
#define _filsiz(a) (__BDOS(FILSIZ, (long) (a)))
#define _set_rand(a) (__BDOS(SET_RAND, (long) (a)))
#define _rs_drive(a) (__BDOS(RS_DRIVE, (long) (a)))
#define _b_wrzf(a) (__BDOS(B_WRZF, (long) (a)))
#define _setmsc(a) (__BDOS(SETMSC, (long) (a)))
#define _ret_errors(a) (__BDOS(RET_ERRORS, (long) (a)))
#define _get_dfs(a) (__BDOS(GET_DFS, (long) (a)))
#define _chain() (__BDOS(CHAIN, (long) 0))
#define _flush() (__BDOS(FLUSH, (long) 0))
#define _gset_scb(a) (__BDOS(GSET_SCB, (long) (a)))
#define _bios_call(a) (__BDOS(BIOS_CALL, (long) (a)))
#define _prog_load(a) (__BDOS(PROG_LOAD, (long) (a)))
#define _set_exv(a) (__BDOS(SET_EXV, (long) (a)))
#define _set_sup(a) (__BDOS(SET_SUP, (long) 0))
#define _get_label(a) (__BDOS(GET_LABEL, (long) (a)))
#define _set_label(a) (__BDOS(SET_LABEL, (long) (a)))
#define _get_xfcb(a) (__BDOS(GET_XFCB, (long) (a)))
#define _set_xfcb(a) (__BDOS(SET_XFCB, (long) (a)))
#define _cond_lst() (__BDOS(COND_LST, (long) 0))
/****************************************************************************/
/* BIOS calls, for use in conjunction with BDOS call 50 & struct bios_parms */
/****************************************************************************/
#define _INIT 0 /* Cold start */
#define _WARM 1 /* Warm start */
#define _CONST 2 /* Console status */
#define _CONIN 3 /* Read console character */
#define _CONOUT 4 /* Write console character */
#define _LIST 5 /* Write listing character */
#define _PUNCH 6 /* Write punch character */
#define _READER 7 /* Read tape character */
#define _HOME 8 /* Move to track 0 */
#define _SELDSK 9 /* Select disk drive */
#define _SETTRK 10 /* Set track number */
#define _SETSEC 11 /* Set sector number */
#define _SETDMA 12 /* Set DMA address */
#define _READ 13 /* Read selected sector */
#define _WRITE 14 /* Write selected sector */
#define _LISTST 15 /* Return list status */
#define _GETMRT 16 /* Get memory region table */
/* address */
#define _GETIOB 17 /* Get IOBYTE value */
#define _SETIOB 18 /* Set IOBYTE value */
#define _FLUSH 19 /* Flush buffers */
#define _SETEXC 20 /* Set exception vector */
/****************************************************************************/
/* FCB structure is defined in cpm.h. Define it here only if it is not */
/* defined already. Declare some useful values at the same time. */
/****************************************************************************/
#ifndef SECSIZ /* Not already declared? */
struct fcbtab /* File control block */
{ /* */
BYTE drive; /* Disk drive field */
BYTE fname[8]; /* File name */
BYTE ftype[3]; /* File type */
BYTE extent; /* Current extent number */
BYTE s1,s2; /* "system reserved" */
BYTE reccnt; /* Record counter */
BYTE resvd[16]; /* More "system reserved" */
LONG record; /* Note -- we overlap the */
/* current record field to */
/* make this useful. */
};
#define fcb fcbtab /* A useful synonym */
#define SECSIZ 128 /* size of CP/M sector */
#define _MAXSXFR 1 /* max # sectors xferrable */
#define _MAXSHFT 12 /* shift right BDOS rtn val */
#endif
/****************************************************************************/
/* Data structures not defined in cpm.h */
/****************************************************************************/
struct dpbs /* Disk parameter block */
{
UWORD spt; /* Sectors per track */
BYTE bls; /* Block shift factor */
BYTE bms; /* Block mask */
BYTE exm; /* Extent mark */
/* BYTE filler; *** Pad to align words ***/
UWORD mxa; /* Maximum allocation (blks)*/
UWORD dmx; /* Max directory entries */
UWORD dbl; /* Directory alloc. map */
UWORD cks; /* Directory checksum */
UWORD ofs; /* Track offset from track 0*/
};
struct bios_parm /* BIOS parameters for BDOS */
{ /* call 50 */
UWORD req; /* BIOS request code */
LONG p1; /* First parameter */
LONG p2; /* Second parameter */
};
struct scbs /* System control block */
{
BYTE resvd_1[6]; /* Reserved for system use */
BYTE u_flags[4]; /* Utility flags */
BYTE d_flags[4]; /* Display flags */
BYTE clp_flags[2]; /* Command Line Proc flags */
UWORD p_error; /* Program error return code*/
BYTE resvd_2[8]; /* Reserved for system use */
BYTE con_w; /* Console width */
BYTE con_c; /* Console column */
BYTE con_l; /* Console page length */
BYTE resvd_3[5]; /* Reserved for system use */
UWORD conin_r; /* CONIN redirection flag */
UWORD conout_r; /* CONOUT redirection flag */
UWORD auxin_r; /* AUXIN redirection flag */
UWORD auxout_r; /* AUXOUT redirection flag */
UWORD lstout_r; /* LSTOUT redirection flag */
BYTE resvd_4[2]; /* Reserved for system use */
BOOLEAN ctl_h_a; /* Backspace active */
BOOLEAN rubout_a; /* Rubout active */
BYTE resvd_5[2]; /* Reserved for system use */
UWORD c_xlate; /* Console translate func. */
UWORD con_m; /* Console mode (raw/cooked)*/
UWORD buff_a; /* 128 byte buffer available*/
BYTE o_delim; /* Output delimiter */
BOOLEAN lo_flag; /* List output flag */
BYTE resvd_6[2]; /* Reserved for system use */
UWORD d_m_a; /* Current DMA address */
BYTE disk_no; /* Current disk */
BYTE bdos_info[2]; /* BDOS variable info */
BYTE resvd_7[3]; /* Reserved for system use */
BYTE user_no; /* Current user number */
BYTE resvd_8[6]; /* Reserved for system use */
BYTE bdos_mode; /* BDOS error mode */
BYTE c_chain[4]; /* Current search chain */
BYTE tmp_drv; /* Drive for temporary files*/
BYTE resvd_9[7]; /* Reserved for system use */
BYTE date_s[5]; /* Date stamp */
BYTE error_jmp[3]; /* Error jump */
UWORD cmb_a; /* Common memory base addr */
UWORD bdos_ent; /* BDOS entry point */
};
struct scbpb /* SCB parameter block */
{
BYTE off; /* Index to data in SCB */
BYTE op; /* Operation: 0xff Set byte */
/* 0xfe Set word */
/* else Get word */
UWORD val; /* Byte/word value to be set*/
};
#define SET_BYTE 0xff
#define SET_WORD 0xfe
#define GET 0
/****************************************************************************/
/* HILO must be defined for the Z8000. Undefine it first, in case cpm.h */
/* has already defined it. The tagless structures defining byte ordering */
/* which are declared in cpm.h are not redeclared here (the use of members */
/* of tagless structures to define offsets is an obsolete feature of the C */
/* language.) */
/****************************************************************************/
#undef HILO
#define HILO

View File

@@ -0,0 +1,13 @@
#define HDSIZE (sizeof couthd) /**.o file header size*/
struct hdr {
short ch_magic; /*c.out magic number 060016 = $600E*/
long ch_tsize; /*text size*/
long ch_dsize; /*data size*/
long ch_bsize; /*bss size*/
long ch_ssize; /*symbol table size*/
long ch_stksize; /*stack size*/
long ch_entry; /*entry point*/
short ch_rlbflg; /*relocation bits suppressed flag*/
} couthd={0};
#define MAGIC 0x601a /* bra .+26 instruction*/

View File

@@ -0,0 +1,166 @@
/****************************************************************************/
/* */
/* C P M . H */
/* --------- */
/* Copyright 1982 by Digital Research Inc. All rights reserved. */
/* */
/* Edits: */
/* */
/* 25-June-83 sw Add user number to file "fd" structure. */
/* */
/* This file contains CP/M specific definitions for the CP/M */
/* C Run Time Library. */
/* This file is intended only for inclusion with those functions */
/* dealing directly with the BDOS, as well as any function which */
/* has hardware dependent code (byte storage order, for instance). */
/* */
/* <portab.h> must be included BEFORE this file. */
/* */
/****************************************************************************/
/*
* CP/M FCB definition
*/
struct fcbtab /****************************/
{ /* */
BYTE drive; /* Disk drive field */
BYTE fname[8]; /* File name */
BYTE ftype[3]; /* File type */
BYTE extent; /* Current extent number */
BYTE s1,s2; /* "system reserved" */
BYTE reccnt; /* Record counter */
BYTE resvd[16]; /* More "system reserved" */
LONG record; /* Note -- we overlap the */
/* current record field to */
/* make this useful. */
}; /****************************/
#define SECSIZ 128 /* size of CP/M sector */
#define _MAXSXFR 1 /* max # sectors xferrable */
#define _MAXSHFT 12 /* shift right BDOS rtn val */
/* to obtain nsecs on err */
/****************************/
/****************************************************************************/
/* */
/* Channel Control Block (CCB) */
/* */
/* One CCB is allocated (statically) for each of the 16 possible open */
/* files under C (including STDIN, STDOUT, STDERR). Permanent data */
/* regarding the channel is kept here. */
/* */
/* */
/****************************************************************************/
struct ccb /************************************/
{ /* */
WORD flags; /*sw Flags byte */
BYTE user; /*sw User # */
BYTE chan; /* Channel number being used */
LONG offset; /* File offset word (bytes) */
LONG sector; /* Sector currently in buffer */
LONG hiwater; /* High water mark */
struct fcbtab fcb; /* File FCB (may have TTY info)*/
BYTE buffer[SECSIZ]; /* Read/write buffer */
}; /************************************/
#define MAXCCBS 16 /* Maximum # CC Blocks */
extern struct ccb _fds[MAXCCBS]; /* Declare storage */
#define FD struct ccb /* FD Type definition */
/************************************/
/* Flags word bit definitions */
/************************************/
#define OPENED 0x01 /* Channel is OPEN */
#define ISTTY 0x02 /* Channel open to TTT */
#define ISLPT 0x04 /* Channel open to LPT */
#define ISREAD 0x08 /* Channel open readonly */
#define ISASCII 0x10 /* ASCII file attached */
#define ATEOF 0x20 /* End of file encountered */
#define DIRTY 0x40 /* Buffer needs writing */
#define ISSPTTY 0x80 /* Special tty info */
#define ISAUX 0x100 /*sw Auxiliary device */
/************************************/
#define READ 0 /* Read mode parameter for open */
#define WRITE 1 /* Write mode */
/* CCB manipulation macros *************************************/
#define _getccb(i) (&_fds[i]) /* Get CCB addr */
/* Error handling *************************************/
EXTERN WORD errno; /* error place for assigning */
EXTERN WORD __cpmrv; /* the last BDOS return value */
EXTERN WORD _errcpm; /* place to save __cpmrv */
#define RETERR(val,err) {errno=(err);_errcpm=__cpmrv;return(val);}
/************************************/
/****************************************************************************/
/* */
/* B D O S F u n c t i o n D e f i n i t i o n s */
/* ------------------------------------------------- */
/* */
/* Following are BDOS function definitions used by the C runtime */
/* library. */
/* */
/****************************************************************************/
/****************************/
#define EXIT 0 /* Exit to BDOS */
#define CONOUT 2 /* Direct console output */
#define LSTOUT 5 /* Direct list device output*/
#define CONIO 6 /* Direct console I/O */
#define CONBUF 10 /* Read console buffer */
#define OPEN 15 /* OPEN a disk file */
#define CLOSE 16 /* Close a disk file */
#define SEARCHF 17 /* Search for first */
#define SEARCHN 18 /* Search next */
#define DELETE 19 /* Delete a disk file */
#define CREATE 22 /* Create a disk file */
#define SETDMA 26 /* Set DMA address */
#define USER 32 /*sw Get / set user number */
#define B_READ 33 /* Read Random record */
#define B_WRITE 34 /* Write Random record */
#define CHAIN 47 /* Chain to program */
#define FILSIZ 35 /* Compute File Size */
#define SETMSC 44 /* Set Multi-Sector Count */
#define SETVEC 61 /* Set exception vector */
/****************************/
/****************************************************************************/
/* Other CP/M definitions */
/****************************************************************************/
#define TERM "CON:" /* Console file name */
#define LIST "LST:" /* List device file name */
#define EOFCHAR 0x1a /* End of file character-^Z */
/****************************/
/****************************************************************************/
/* Hardware dependencies */
/****************************************************************************/
#define HILO /* used when bytes stored */
/* Hi,Lo */
/****************************/
#ifdef HILO /* Hi/Lo storage used in */
struct { /* 68K */
BYTE lbhihi; /* Use this for accessing */
BYTE lbhilo; /* ordered bytes in 32 bit*/
BYTE lblohi; /* LONG qtys. */
BYTE lblolo; /* */
}; /* */
struct { /* Use this for accessing */
WORD lwhi; /* ordered words in 32 bit*/
WORD lwlo; /* LONG qtys. */
}; /* */
#else /****************************/
struct { /* Lo/Hi storage use on */
BYTE lblolo; /* PDP-11, VAX, 8086,... */
BYTE lblohi; /* */
BYTE lbhilo; /* */
BYTE lbhihi; /* */
}; /* */
struct { /* */
WORD lwlo; /* */
WORD lwhi; /* */
}; /* */
#endif /****************************/
/*************************** end of cpm.h ***********************************/

View File

@@ -0,0 +1,39 @@
/**************************************************************************
* CTYPE.H - macros to classify ASCII-coded integers by table lookup.
*
*
* Note: Integer args are undefined for all int values > 127,
* except for macro 'isascii()'.
* Assumes:
* User will link with standard library functions.
* Compiler can handle declarator initializers and
* '#defines' with parameters.
***************************************************************************/
/* Define bit patterns for character classes */
#define __c 01
#define __p 02
#define __d 04
#define __u 010
#define __l 020
#define __s 040
#define __cs 041
#define __ps 042
#ifndef CTYPE
extern char __atab[];
#endif
#define isascii(ch) ((ch) < 0200)
#define isalpha(ch) (__atab[ch] & (__u | __l))
#define isupper(ch) (__atab[ch] & __u)
#define islower(ch) (__atab[ch] & __l)
#define isdigit(ch) (__atab[ch] & __d)
#define isalnum(ch) (__atab[ch] & (__u | __l | __d))
#define isspace(ch) (__atab[ch] & __s)
#define ispunct(ch) (__atab[ch] & __p)
#define isprint(ch) (__atab[ch] & (__u | __l | __d | __p))
#define iscntrl(ch) (__atab[ch] & __c)
#define tolower(ch) (isupper(ch) ? (ch)-'A'+'a' : (ch) )
#define toupper(ch) (islower(ch) ? (ch)-'a'+'A' : (ch) )
#define toascii(ch) ((ch) & 0177)

View File

@@ -0,0 +1,45 @@
/*
* errno.h - error codes
*/
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#define ENOTBLK 15
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
/* math software */
#define EDOM 33
#define ERANGE 34
/* hereafter is available to CP/M specials */
#define ENODSPC 35
/****** end of errno.h ******/

View File

@@ -0,0 +1,25 @@
/*
* This file defines procedure names used by the assembler, compiler,
* etc. to be the names used in this library.
*
* (In case you haven't guessed, the "k" in "klib" stands for:
*
* K L U D G E !)
*/
#define creat xcreat
#define open xopen
#define fopen xfopen
#define getc xgetc
#define getw xgetw
#define fcreat xfcreat
#define putw xputw
#define putc xputc
#define putchar(x) fputc(x,stdout)
#define strcmp xstrcmp
#define index xindex
#define strcpy xstrcpy
/*
* Defining the names in this manner allows using the V7 UNIX library
* to run the asinine V6 calls in the Alcyon software.
*
*/

View File

@@ -0,0 +1,10 @@
/*
* Use this file to determine what kind of machine you want the
* Alcyon stuff to run on ....
*/
#define MC68000 1 /* 68000 version */
/*#define VAX 1*/ /* VAX Version */
/*#define PDP11 1*/ /* PDP-11 Version*/
#define CPM 1 /* CP/M Operating System*/
/*#define UNIX 1*/ /* UNIX Operating System*/
/*#define VMS 1*/ /* VMS Operating System*/

View File

@@ -0,0 +1,22 @@
/* HEADER FILE FOR PASCAL FILE I/O
* copyright (c) 1980 by Whitesmiths, Ltd.
*/
typedef struct {
TEXT *p_buf;
BYTES p_size;
TEXT p_mode;
UTINY p_fd;
} PFILE;
/* modes
*/
#define P_EOF 0
#define P_EOLN 1
#define P_INVAL 2
#define P_VALID 3
#define P_WRITE 4
#define P_WROTE 5
#define NFILES 16
#define P_TFD 0200

View File

@@ -0,0 +1,54 @@
/*****************************************************************************
*
* C P / M C R U N T I M E L I B H E A D E R F I L E
* -------------------------------------------------------------
* Copyright 1982 by Digital Research Inc. All rights reserved.
*
* This is an include file for assisting the user to write portable
* programs for C.
*
*****************************************************************************/
#define ALCYON 1 /* using Alcyon compiler */
/*
* Standard type definitions
*/
/***************************/
#define BYTE char /* Signed byte */
#define BOOLEAN char /* 2 valued (true/false) */
#define WORD short /* Signed word (16 bits) */
#define UWORD unsigned int /* unsigned word */
#define LONG long /* signed long (32 bits) */
#define ULONG unsigned long /* Unsigned long */
#define REG register /* register variable */
#define LOCAL auto /* Local var on 68000 */
#define EXTERN extern /* External variable */
#define MLOCAL static /* Local to module */
#define GLOBAL /**/ /* Global variable */
#define VOID /**/ /* Void function return */
#define DEFAULT int /* Default size */
#define FLOAT float /* Floating point */
#define DOUBLE double /* Double precision */
/***************************/
#ifdef ALCYON
#define UBYTE char
#else
#define UBYTE unsigned char /* Unsigned byte */
#endif
/****************************************************************************/
/* Miscellaneous Definitions: */
/****************************************************************************/
#define FAILURE (-1) /* Function failure return val */
#define SUCCESS (0) /* Function success return val */
#define YES 1 /* "TRUE" */
#define NO 0 /* "FALSE" */
#define FOREVER for(;;) /* Infinite loop declaration */
#define NULL 0 /* Null pointer value */
#define ZERO 0 /* Zero value */
#define EOF (-1) /* EOF Value */
#define TRUE (1) /* Function TRUE value */
#define FALSE (0) /* Function FALSE value */
/*************************** end of portab.h ********************************/

View File

@@ -0,0 +1,87 @@
/* format of a symbol entry in the main table*/
#include "machine.h"
#define SEEKREL 1 /*relative seek flag*/
#define OSTSIZE 14 /*symbol table entry length on object file*/
/* without table link*/
# define STESIZE 18 /*byte length of symbol table entry*/
struct symtab {
char name[8]; /*symbol name*/
short flags; /*bit flags*/
long vl1; /*symbol value*/
char *tlnk; /*table link*/
};
struct symtab *symptr;
/* flags for symbols*/
# define SYDF 0100000 /*defined*/
# define SYEQ 0040000 /*equated*/
# define SYGL 0020000 /*global - entry or external*/
# define SYER 0010000 /*equated register*/
# define SYXR 0004000 /*external reference*/
# define SYDA 0002000 /*DATA based relocatable*/
# define SYTX 0001000 /*TEXT based relocatable*/
# define SYBS 0000400 /*BSS based relocatable*/
struct irts {
char *irle; /*ptr to last entry in chain*/
char *irfe; /*ptr to first entry in chain*/
};
#ifdef VAX
struct {
short loword;
short hiword;
};
#endif
#ifdef PDP11
struct {
short loword;
short hiword;
};
#endif
#ifdef MC68000
struct {
short hiword;
short loword;
};
#endif
#ifdef VAX
struct {
char lobyte;
char hibyte;
};
#endif
#ifdef PDP11
struct {
char lobyte;
char hibyte;
};
#endif
#ifdef MC68000
struct {
char hibyte;
char lobyte;
};
#endif
/* relocation bit definitions:*/
#define RBMASK 07 /*tells type of relocation*/
#define INSABS 7 /*first word of instr -- absolute*/
#define DABS 0 /*data word absolute*/
#define TRELOC 2 /* TEXT relocatable*/
#define DRELOC 1 /* DATA relocatable*/
#define BRELOC 3 /* BSS relocatable*/
#define EXTVAR 4 /* ref to external variable*/
#define LUPPER 5 /* upper word of long*/
struct buf{
int fildes;
int nunused;
char *xfree;
char buff[512];
};
struct buf ibuf={0};
char *ifilname=0;

View File

@@ -0,0 +1,35 @@
/****************************************************************************/
/* */
/* L o n g j u m p H e a d e r F i l e */
/* --------------------------------------- */
/* */
/* Copyright 1982 by Digital Research. All rights reserved. */
/* */
/* Long jumps on the 68K are implemented as follows: */
/* */
/* 1). Routine "setjmp" is called to setup a special */
/* buffer for return. The return address, stack */
/* pointer and frame pointer are saved. This allows */
/* the calling program to do the proper number of */
/* "pops". */
/* */
/* 2). At some later time, the procedure "longjmp" is */
/* called. The programmer sees a return from the */
/* previous "setjmp" as the result. */
/* */
/* Calling sequence: */
/* */
/* #include <setjmp.h> (definitions) */
/* jmp_buf env; (define a buffer for saved stuff) */
/* */
/* setjmp(env); */
/* a: */
/* */
/* longjmp(env,val); */
/* */
/* Setjmp returns a WORD of 0 on first call, and "val" on the */
/* subsequent "longjmp" call. The longjmp call causes execution to */
/* resume at "a:" above. */
/* */
/****************************************************************************/
typedef LONG jmp_buf[13];

View File

@@ -0,0 +1,14 @@
/* sgtty.h - tty control information */
/* Note reduced contents for CP/M implementation... */
struct sgttyb{
char sg_ispeed; /* ignored */
char sg_ospeed; /* ignored */
char sg_erase; /* ignored */
char sg_kill; /* ignored */
int sg_flags;
};
#define RAW 0000040
#define CRMOD 0000020
#define ECHO 0000010
#define LCASE 0000004
#define CBREAK 0000002

View File

@@ -0,0 +1,32 @@
/****************************************************************************/
/* */
/* S i g n a l H e a d e r F i l e */
/* ----------------------------------- */
/* */
/* Copyright 1982 by Digital Research, Inc. All rights reserved. */
/* */
/* Define the "signal" arguments, so anyone using the function will */
/* not get compile-time errors. Some functions are not implemented. */
/* */
/****************************************************************************/
#define NSIG 16 /* 16 simulated signals */
#define SIGHUP 1 /* Hangup */
#define SIGINT 2 /* Interrupt (^C) */
#define SIGQUIT 3 /* Quit signal */
#define SIGILL 4 /* Illegal Instruction trap */
#define SIGTRAP 5 /* Trace Trap */
#define SIGIOT 6 /* IOT instruction (on PDP-11) */
#define SIGEMT 7 /* EMT instruction (TRAP on 68k) */
#define SIGFPE 8 /* Floating point exception */
#define SIGKILL 9 /* Kill (cannot be intercepted) */
#define SIGBUS 10 /* BUSERR (non-ex memory reference) */
#define SIGSEGV 11 /* Segmentation (MMU) violation */
#define SIGSYS 12 /* Bad argument to system call */
#define SIGPIPE 13 /* Write on a broken pipe */
#define SIGALRM 14 /* Alarm clock (what a name!) */
#define SIGTERM 15 /* Software termination signal */
/************************************/
#define BADSIG (-1L) /* Error return */
#define SIG_DFL (0L) /* Default action on signal call */
#define SIG_IGN (1L) /* Ignore */
/************************************/

View File

@@ -0,0 +1,74 @@
/* THE STANDARD HEADER
* copyright (c) 1978 by Whitesmiths, Ltd.
*/
/* the pseudo storage classes
*/
#define FAST register
#define GLOBAL extern
#define IMPORT extern
#define INTERN static
#define LOCAL static
/* the pseudo types
*/
#ifdef UTEXT
typedef unsigned char TEXT;
#else
typedef char TEXT;
#endif
typedef TEXT TBOOL;
typedef char TINY;
typedef double DOUBLE;
typedef int ARGINT, BOOL, VOID;
typedef long LONG;
typedef short COUNT, FILE, METACH;
typedef unsigned BYTES;
typedef unsigned char UTINY;
typedef unsigned long ULONG;
typedef unsigned short BITS, UCOUNT;
/* system parameters
*/
#define STDIN 0
#define STDOUT 1
#define STDERR 2
#define YES 1
#define NO 0
#define NULL 0
#define FOREVER for (;;)
#define BUFSIZE 512
#define BWRITE -1
#define READ 0
#define WRITE 1
#define UPDATE 2
#define EOF -1
#define BYTMASK 0377
/* macros
*/
#define abs(x) ((x) < 0 ? -(x) : (x))
#define gtc(pf) (0 < (pf)->_nleft ? (--(pf)->_nleft, \
*(pf)->_pnext++ & BYTMASK) : getc(pf))
#define isalpha(c) (islower(c) || isupper(c))
#define isdigit(c) ('0' <= (c) && (c) <= '9')
#define islower(c) ('a' <= (c) && (c) <= 'z')
#define isupper(c) ('A' <= (c) && (c) <= 'Z')
#define iswhite(c) ((c) <= ' ' || 0177 <= (c))
#define max(x, y) (((x) < (y)) ? (y) : (x))
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define ptc(pf, c) (((pf)->_nleft < 512) ? (pf)->_buf[(pf)->_nleft++] = (c) :\
putc(pf, c))
#define tolower(c) (isupper(c) ? ((c) + ('a' - 'A')) : (c))
#define toupper(c) (islower(c) ? ((c) - ('a' - 'A')) : (c))
/* the file IO structure
*/
typedef struct fio
{
FILE _fd;
COUNT _nleft;
COUNT _fmode;
TEXT *_pnext;
TEXT _buf[BUFSIZE];
} FIO;

View File

@@ -0,0 +1,68 @@
/*****************************************************************************
*
* C P / M C H E A D E R F I L E
* -----------------------------------
* Copyright 1982 by Digital Research Inc. All rights reserved.
*
* This is the standard include file for the CP/M C Run Time Library.
*
*****************************************************************************/
/* */
#include <portab.h> /* Portability Definitions */
/* */
/****************************************************************************
* Stream I/O File Definitions
*****************************************************************************/
#define BUFSIZ 512 /* Standard (ascii) buf size */
#define MAXFILES 16 /* Max # open files ( < 32 ) */
struct _iobuf { /* */
WORD _fd; /* file descriptor for low level io */
WORD _flag; /* stream info flags */
BYTE *_base; /* base of buffer */
BYTE *_ptr; /* current r/w pointer */
WORD _cnt; /* # chars to be read/have been wrt */
}; /* */
#ifndef FILE /* conditionally include: */
extern struct _iobuf _iob[MAXFILES]; /* an array of this info */
#define FILE struct _iobuf /* stream definition */
#endif /************************************/
/* flag byte definition */
#define _IOREAD 0x01 /* readable file */
#define _IOWRT 0x02 /* writeable file */
#define _IOABUF 0x04 /* alloc'd buffer */
#define _IONBUF 0x08 /* no buffer */
#define _IOERR 0x10 /* error has occurred */
#define _IOEOF 0x20 /* EOF has occurred */
#define _IOLBUF 0x40 /* handle as line buffer */
#define _IOSTRI 0x80 /* this stream is really a string */
#define _IOASCI 0x100 /* this was opened as an ascii file */
/************************************/
#define stdin (&_iob[0]) /* standard input stream */
#define stdout (&_iob[1]) /* " output " */
#define stderr (&_iob[2]) /* " error " */
/************************************/
#define clearerr(p) ((p)->_flag & ~_IOERR) /* clear error flag */
#define feof(p) ((p)->_flag & _IOEOF) /* EOF encountered on stream */
#define ferror(p) ((p)->_flag & _IOERR) /* error encountered on stream */
#define fileno(p) ((p)->_fd) /* get stream's file descriptor */
#define getchar() getc(stdin) /* get char from stdin */
#define putchar(c) putc(c,stdout) /* put char to stdout */
#define putc fputc
#define getc fgetc
/****************************************************************************/
/* */
/* M A C R O S */
/* ----------- */
/* */
/* Define some stuff as macros .... */
/* */
/****************************************************************************/
#define abs(x) ((x) < 0 ? -(x) : (x)) /* Absolute value function */
#define max(x,y) (((x) > (y)) ? (x) : (y)) /* Max function */
#define min(x,y) (((x) < (y)) ? (x) : (y)) /* Min function */
/*************************** end of stdio.h *********************************/

View File

@@ -0,0 +1 @@
#define UTEXT 1

View File

@@ -0,0 +1,29 @@
/* VMS INTERFACE DEFINES
* copyright (c) 1980 by Whitesmiths, Ltd.
*/
/* basic parameters
*/
#define FAIL -1
#define NFILES 16
#define NOBLOCK 010000000000
/* codes for flags and access
*/
#define WREAD 0001
#define WWRITE 0002
#define WOPEN 0004
#define WTTY 0010
#define WCR 0020
#define WFIX 0040
#define WDIRT 0100
#define WREMOVE 0200
/* the Whitesmiths VMS control block
*/
typedef struct {
BITS flags;
COUNT bleft;
TEXT *bnext, *pbuf, *rab;
LONG lseek, lact, lend;
} RCB;

View File

@@ -0,0 +1,4 @@
vax b:readme.doc $$frants
vax b:serial.c $$frants
vax b:serial.dat $$frants
vax b:sernotes.doc $$frants

View File

@@ -0,0 +1,34 @@
The serialization program needs the following function in CLIB:
alrem
The compiler generates jsr alrem instead of jsr _alrem.
Solution -----> add another label to CLIB called alrem: pointing
to _alrem.
A>c serial
A>clink serial
A>serial 1 10000
Put files to serialize in a file called : SERIAL.DAT.
EX> pip.rel
stat.rel
ed.rel
nm68.rel
.
.
.
cpm.rel

View File

@@ -0,0 +1,269 @@
/*----------------------------------------------------------------------*\
| serial.c v1.0 |
| SERIALIZATION PROGRAM FOR CP/M-68K |
| ================================== |
| |
| date: 1/3/83 |
| ---- |
| |
| last modified: 2/3/83 |
| ------------- |
| |
| description: |
| ----------- This program replaces up to 20 occurances |
| of "654321" in all files found in "SERIAL.DAT". |
| The string "654321" is replaced by a serial |
| number. Leading zeros will be filled in by |
| the program. The starting and ending serial |
| number's are read in from the command line. |
| The user is prompted for the serialization |
| drive. |
| |
| |
| COPYRIGHT (C) 1983 |
| DIGITAL RESEARCH |
| BOX 579 |
| PACIFIC GROVE, CA. 93950 |
| |
\*----------------------------------------------------------------------*/
#include "stdio.h" /* standard I/O library */
#define islower(c) ('a' <= (c) && (c) <= 'z')
#define toupper(c) (islower(c) ? ((c)-040) : (c))
#define RESET 13
#define SELECT 14
/********************************/
/* GLOBAL VARIABLES */
struct _serial /********************************/
{ /* */
BYTE filename[13]; /* file to serialize */
}; /* */
struct _serial serial[150]; /* array of structures */
/* */
BYTE enddata[] = "xxxxxxxxxxxx"; /* end of filenames marker */
BYTE marker[] = "654321"; /* place in file to sub serial #*/
BYTE snum[] = "000000"; /* serial number */
BYTE drive = 0; /* serialization drive */
BYTE chtab[] = "0123456789"; /* table of digits */
FILE *stream; /* pointer to a stream file */
/********************************/
/********************************/
/* FUNCTIONS */
/********************************/
FILE *fopen(); /* returns a stream I/O pointer */
FILE *fopenb(); /* returns a stream I/O pointer */
BYTE *trans(); /* returns a pointer to a string*/
LONG atol(); /* returns a long number */
LONG ftell(); /* returns a long number */
/********************************/
main(argc,argv)
WORD argc;
BYTE *argv[];
{
REG LONG start_num; /* starting serial number */
REG LONG final_num; /* final serial number */
REG LONG num; /* current serial number */
BYTE buffer[32]; /* read buffer */
BYTE boot; /* y or n to system tracks */
if(argc != 3)
{
printf("\nUsage: A>serial starting ending");
exit(0);
}
printf("Serial.68K V1.0");
init(); /* try to open data file */
boot = 'N'; /* no serializing of system trks*/
/* check range of serial number's */
if(atol(argv[1]) > 999999L || atol(argv[2]) > 999999L ||
atol(argv[1]) < 0L || atol(argv[2]) < 0L)
{
printf("\nERROR: Serial # out of range: [0-999999]");
exit(0);
}
printf("\nSerialization drive ? "); gets(buffer);
drive = toupper(buffer[0]);
/* verify to user the serial number range */
printf("\nSTARTING serial number is: %s",argv[1]);
printf("\nFINAL serial number is : %s",argv[2]);
if(boot == 'Y')
printf("\nSystem tracks will be serialized");
printf("\n\n");
/************************************************/
/* */
/* MAIN SERIALIZATION LOOP */
/* ----------------------- */
/* */
/************************************************/
for(num = atol(argv[1]); num <= atol(argv[2]); num++)
{
__BDOS(RESET,(long)0);
printf("\n\nInsert new diskette in drive %c and type RETURN",drive);
getchar();
printf("\nCURRENT serial number is: %LD\n",num);
if(boot == 'Y')
boottrk(num);
patch(num);
}
}
/************************/
VOID init() /* Open SERIAL.DAT */
/* Read SERIAL.DAT */
/************************/
{
BYTE buf[40];
REG UWORD j;
REG struct _serial *p;
if((stream = fopen("SERIAL.DAT","r")) == NULL)
{
printf("\nUnable to open SERIAL.DAT");
exit(0);
}
/* read in the data line by line */
/* and fill the structure serial */
fgets(buf,40,stream);
p = &serial;
do
{
j = 0;
while((p->filename[j] = buf[j++]) != '\n');
p->filename[j-1] = '\0';
p++;
fgets(buf,40,stream);
}
while(!(feof(stream)));
for(j = 0;j < 12;j++)
p->filename[j] = 'x';
p->filename[12] = '\0';
fclose(stream);
}
/************************/
VOID patch(num) /* Plug Serialization */
/* bytes into file */
/************************/
LONG num;
{
REG struct _serial *p;
REG UWORD i,j;
LONG offset[21];
REG BYTE *pp;
REG UWORD ch;
REG WORD fd;
__BDOS(SELECT,(long)drive-'A');
p = &serial;
while(strcmp(p,enddata))
{
printf("\nSerializing: %s ",p);
for(i = 1;i <= (12 - strlen(p));i++)
printf(" ");
if((stream = fopenb(p,"r")) == NULL)
printf("Unable to open file: %s",p);
else
{
for(j = 0;j < 21;j++)
offset[j] = -1L;
i = j = 0;
pp = marker;
rewind(stream);
while(1)
{
ch = fgetc(stream);
if(feof(stream))
break;
if(ch == *pp)
{
i++;
if(pp == marker)
offset[j] = ftell(stream);
pp++;
}
else
{
pp = marker;
offset[j] = -1L;
i = 0;
}
if(i == 6)
{
j++;
if(j == 20)
break;
i = 0;
pp = marker;
}
}
fclose(stream);
if(offset[0] == -1L)
printf("file cannot be serialized");
else
{
fd = openb(p, 2);
if ( fd == -1 ) printf("cannot write to file");
else
{
j = 0;
while(offset[j] != -1L)
{
lseek(fd, --offset[j++], 0);
write(fd, trans(num), 6);
}
printf("Serialization complete %d",j);
close(fd);
}
}
}
p++;
}
}
VOID boottrk(num)
LONG num;
{
printf("\nSerializing Boot tracks");
}
BYTE *trans(num)
LONG num;
{
REG BYTE *p;
LONG x;
p = snum;
x = 100000;
while(x)
{
*p++ = chtab[num/x];
num %= x;
x /= 10;
}
return(snum);
}

View File

@@ -0,0 +1,8 @@
ed.68k
pip.68k
stat.68k
clib
nm68.68k
sendc68.68k
cpmlib

View File

@@ -0,0 +1,53 @@
CP/M-68K RELEASE SOFTWARE
========================= 1/19/83
DIRECTORY FILES THAT HAVE XXXX-0000-654321
========= ================================
AS68.DIR MAIN.C
CCP.DIR NONE
DOCS.DIR NONE
PIPEDSTAT.DIR UT68K.SA
TOOLS.DIR COPY.C
INIT.S
FORMAT.S
BDOS.DIR BDOSMISC.C
CGEN.DIR MAIN.C
KLIB.DIR NONE
PREPROC.DIR MAIN.C
BIOS.DIR NONE
CLIB.DIR COPYRT.S
LINK.DIR RELOC.C
SIZE68.C
AR68.C
LO68.C
DUMP.C
SENDC68.C
NM68.C
RELNOTES.DIR NONE
VMSLIB.DIR NONE
BOOT.DIR BDOSMAIN.C
DDT.DIR DDT1.C
DDTLOAD.S
PARSER.DIR MAIN.C
SERIAL.DIR NONE