Skip to content

Commit

Permalink
Bootable disk images plus FAT support (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwildie authored Mar 22, 2020
1 parent a6181df commit ec56d0a
Show file tree
Hide file tree
Showing 78 changed files with 9,345 additions and 1,160 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@ This code assumes, and has been tested with, the following hardware:
* [16MB Static RAM Board](http://www.s100computers.com/My%20System%20Pages/16MG%20RAM%20Board/16MG%20RAM%20Board.htm)
* [IDE/CF Board](http://www.s100computers.com/My%20System%20Pages/IDE%20Board/My%20IDE%20Card.htm)

# Release
# Release 0.1.0

The release contains the following files:
Updates included in this release are:
* Bootable CP/M disk images
* Support for CF cards with MBR partition tables.
* Support for "virtual" disks on FAT16/32 file systems.

This release contains the following files:
* boot.srec - This is the boot loader / monitor in SRecord format and must be burnt into the board's EPROMS,normal even/odd configuration.
* bios.srec - This is the bios in SRecord format.
* boot400.sr - This is the patched cpm400.sr and bios.srec concatenated into a single SRecord file
* diskAll.iso - Ten partition, bootable image in iso format using the 4mb-hd format, paritions 0 contains binary files from DISK1 - DISK9 of the CP/M 68K v1.3 binary distribution plus boot400.sr. Partitions 1 contains the assembler source files for the puboot utility, boot loader BIOS and the CP/M BIOS plus submit files.
* drive_a.img - Single partition, bootable image using the 4mb-hd format and contains the binary files from DISK1 - DISK9 of the CP/M 68K V1.3 distribution.
* drive_b.img - Single partition image using the 4mb-hd format and containing the assembler source files for the puboot utility, boot loader BIOS and the CP/M BIOS plus submit files.
* drive_c.img - Single partition, empty image using the 4mb-hd format.

The drive_a.img, drive_b.img and drive_c.img images are intended to be used on a FAT16/32 CF card.

# Release 0.0.1

This release contains the following files:
* boot.srec - This is the boot loader / monitor in SRecord format and must be burnt into the board's EPROMS,normal even/odd configuration.
* bios.srec - This is the bios in SRecord format.
* boot400.sr - This is the patched cpm400.sr and bios.srec concatenated into a single SRecord file
Expand Down Expand Up @@ -88,3 +106,5 @@ Three file system image are built:

# Contributions
The IDE code used in the boot loader/monitor was originally written by John Monahan who also designed the S-100 cards being used. Thank you John.

The FAT16/32 library is from [Ultra-Embedded](http://ultra-embedded.com/fat_filelib/).
1 change: 1 addition & 0 deletions baselibc
Submodule baselibc added at 520dda
21 changes: 17 additions & 4 deletions bios/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AS = m68k-elf-as
ASFLAGS += -m68000
ASFLAGS += --defsym _GNU_=1
ASFLAGS += --defsym _CPM_=0
ASFLAGS += -alms

CC = m68k-elf-gcc
Expand All @@ -11,7 +13,7 @@ CCFLAGS += -nodefaultlibs

LD = m68k-elf-ld

all: target/bios.srec
all: target/bios.srec obj/ldr.srec target/ldbios.s target/bios.s target/buffer.s target/biosend.s

%.s: %.c
$(CC) $(CCFLAGS) -S $<
Expand All @@ -22,13 +24,24 @@ all: target/bios.srec
obj/%.o: %.s
$(AS) $(ASFLAGS) -a=$(@:.o=.lst) -o $@ $<

obj/bios.srec: obj/main.o obj/buffer.o
$(LD) -T bios.lnk obj/main.o obj/buffer.o -Map $(@:.srec=.map) -o $@
obj/bios.srec: obj/bios.o obj/buffer.o obj/biosend.o
$(LD) -T bios.lnk obj/bios.o obj/buffer.o -Map $(@:.srec=.map) -o $@

obj/ldr.srec: obj/ldbios.o

target/bios.srec: obj/bios.srec
srec_cat $< -fill 0x00 -over $< -header="CP/M-68K S100 Bios" -o $@
srec_cat $< -fill 0x00 -over $< -header="CP/M-68K S100 V0.1.0 Bios" -o $@
srec_info $@

target/%.s: %.s
cat cpm_defs.s $< | sed -e 's/\.include\s*"\(.*\)"/include(`\1'"'"')/' \
| m4 \
| sed -e 's/^\*.*//' -e 's/^\(.*\)=\s*\(.*\)/\1 equ \2/' -e 's/.global/globl/' \
| sed -e 's/.word/DC.W/' -e 's/.byte/DC.B/' -e 's/.long/DC.L/' -e 's/\%D/D/g' \
| sed -e 's/\%A/A/g' -e 's/\%SP/SP/' -e 's/\%FP/FP/' -e 's/\.ascii/DC.B/' \
| sed -e 's/0[xX]/$$/g' -e 's/\.ifne/ifne/' -e 's/\.endif/endc/' > $@
unix2dos $@

clean:
rm -rf obj/* target/*
mkdir -p obj target
Expand Down
198 changes: 198 additions & 0 deletions bios/PUTBOOT.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
* @(#)putboot.s 1.5 *
*********************************************************
* *
* Program to Write Boot Tracks for CP/M-68K (tm) *
* *
* Copyright Digital Research 1982 *
* *
* modified for vme/10 *
* *
*********************************************************
*
*
*
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 #0,sect start at sector 0
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
*
wl1: cmp.w spt,d1
ble sok
wl2: move.w #0,sect advance to new track
move.w trk,d0
add.w #1,d0
wl4: 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
Loading

0 comments on commit ec56d0a

Please sign in to comment.