mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 17:04:19 +00:00
Upload
Digital Research
This commit is contained in:
1342
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/bios.c
Normal file
1342
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/bios.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
#define LOADER 1
|
||||
#define CTLTYPE 0
|
||||
#define MEMDSK 0
|
||||
@@ -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
|
||||
|
||||
/************************************************/
|
||||
@@ -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
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/cpmlib
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/cpmlib
Normal file
Binary file not shown.
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
$ lo68 -r -o cpm.rel -ucpm cpmlib biosa.o bios.o
|
||||
@@ -0,0 +1 @@
|
||||
lo68 -r -o cpm.rel -ucpm cpmlib biosa.o bios.o
|
||||
@@ -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
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/ldrlib
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/cross/cpm/ldrlib
Normal file
Binary file not shown.
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
#define LOADER 1
|
||||
#define CTLTYPE 0
|
||||
#define MEMDSK 0
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
$ lo68 -s -t0 -uldr -o cpmldr.sys booter.o ldrlib ldbiosa.o ldbios.o
|
||||
@@ -0,0 +1 @@
|
||||
lo68 -s -t0 -uldr -o cpmldr.sys booter.o ldrlib ldbiosa.o ldbios.o
|
||||
@@ -0,0 +1,4 @@
|
||||
$ set noon
|
||||
$ copy normbios.h biostype.h
|
||||
$ c68 bios
|
||||
$ as68 -u -l biosa.s
|
||||
@@ -0,0 +1,4 @@
|
||||
$ set noon
|
||||
$ copy normbios.h biostype.h
|
||||
$ cc68 bios
|
||||
$ as68 -u -l biosa.s
|
||||
@@ -0,0 +1,3 @@
|
||||
#define LOADER 0
|
||||
#define CTLTYPE 0
|
||||
#define MEMDSK 4
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
$ reloc -b'p1' cpm.rel cpm.sys
|
||||
@@ -0,0 +1 @@
|
||||
reloc -b$1 cpm.rel cpm.sys
|
||||
Reference in New Issue
Block a user