Browse Source

Merge trunk -> wbw

import/raw
wayne 13 years ago
parent
commit
b5b3dc2b51
  1. 3079
      branches/wbw/Source/master-cfg.asm
  2. 62
      branches/wbw/XSource/Makefile
  3. 692
      branches/wbw/cpurom/Makefile
  4. 1
      branches/wbw/cpurom/cleanxp.bat
  5. BIN
      branches/wbw/cpurom/doc/agm1264f.pdf
  6. BIN
      branches/wbw/cpurom/doc/bdoscalls.webarchive
  7. BIN
      branches/wbw/cpurom/doc/bios.webarchive
  8. BIN
      branches/wbw/cpurom/doc/fcb.webarchive
  9. 92
      branches/wbw/cpurom/doc/jrch2b.doc
  10. BIN
      branches/wbw/cpurom/doc/make.pdf
  11. BIN
      branches/wbw/cpurom/doc/sdcc-z80-mode.png
  12. BIN
      branches/wbw/cpurom/doc/watcom-tools.pdf
  13. 558
      branches/wbw/cpurom/exp/common.mak
  14. 26
      branches/wbw/cpurom/exp/makefile.mac
  15. 24
      branches/wbw/cpurom/exp/makefile.win
  16. 95
      branches/wbw/cpurom/inc/agm1264f.h
  17. 89
      branches/wbw/cpurom/inc/cpmbdos.h
  18. 7
      branches/wbw/cpurom/inc/cprintf.h
  19. 28
      branches/wbw/cpurom/inc/diskio.h
  20. 7
      branches/wbw/cpurom/inc/ds1302.h
  21. 15
      branches/wbw/cpurom/inc/i8255.h
  22. 16
      branches/wbw/cpurom/inc/jrctypes.h
  23. 15
      branches/wbw/cpurom/inc/ns16550.h
  24. 8
      branches/wbw/cpurom/inc/ns16550.inc
  25. 12
      branches/wbw/cpurom/inc/portab.h
  26. 52
      branches/wbw/cpurom/inc/sbcv2.h
  27. 47
      branches/wbw/cpurom/inc/scsi2ide.h
  28. 20
      branches/wbw/cpurom/inc/scsi2ide.inc
  29. 24
      branches/wbw/cpurom/inc/z53c80.h
  30. 3
      branches/wbw/cpurom/makeclean.bat
  31. 3
      branches/wbw/cpurom/makecpurom.bat
  32. 646
      branches/wbw/cpurom/makefile.xp
  33. 3
      branches/wbw/cpurom/makexp.bat
  34. BIN
      branches/wbw/cpurom/ref/JRC0521.ZIP
  35. 2587
      branches/wbw/cpurom/ref/bdosb01.asm
  36. BIN
      branches/wbw/cpurom/ref/n8-romim.ref
  37. 68
      branches/wbw/cpurom/src/baseline.c
  38. 2654
      branches/wbw/cpurom/src/bdosb01.s
  39. 2733
      branches/wbw/cpurom/src/cbios.s
  40. 1708
      branches/wbw/cpurom/src/cbiosn8.s
  41. 1345
      branches/wbw/cpurom/src/ccpb03.s
  42. 79
      branches/wbw/cpurom/src/copyfile.c
  43. 46
      branches/wbw/cpurom/src/cpm0.s
  44. 65
      branches/wbw/cpurom/src/cpmbdos.s
  45. 267
      branches/wbw/cpurom/src/cprintf.c
  46. 97
      branches/wbw/cpurom/src/crt0.s
  47. 9
      branches/wbw/cpurom/src/crt0jplp.s
  48. 44
      branches/wbw/cpurom/src/crt0scrm.s
  49. 1764
      branches/wbw/cpurom/src/dbgmon.s
  50. 128
      branches/wbw/cpurom/src/dwgh2b.c
  51. 281
      branches/wbw/cpurom/src/fdisk.c
  52. 528
      branches/wbw/cpurom/src/jrch2b.c
  53. 19
      branches/wbw/cpurom/src/lechocr.c
  54. 19
      branches/wbw/cpurom/src/lechocrlf.c
  55. 45
      branches/wbw/cpurom/src/lecholf.c
  56. 19
      branches/wbw/cpurom/src/lecholfcr.c
  57. 130
      branches/wbw/cpurom/src/load.c
  58. 191
      branches/wbw/cpurom/src/loadern8.s
  59. 26
      branches/wbw/cpurom/src/retired/i8255.c
  60. 45
      branches/wbw/cpurom/src/retired/ns16550.c
  61. 159
      branches/wbw/cpurom/src/sysgen.c
  62. 15
      branches/wbw/cpurom/tmp/stuff/baseline.arf
  63. 15
      branches/wbw/cpurom/tmp/stuff/baseline.lk
  64. 15
      branches/wbw/cpurom/tmp/stuff/baseline.lnk
  65. 13
      branches/wbw/cpurom/tmp/stuff/n8.arf
  66. 13
      branches/wbw/cpurom/tmp/stuff/n8.lk
  67. 13
      branches/wbw/cpurom/tmp/stuff/n8.lnk
  68. 9
      branches/wbw/cpurom/tmp/stuff/scsi2ide.arf
  69. 9
      branches/wbw/cpurom/tmp/stuff/scsi2ide.lk
  70. 9
      branches/wbw/cpurom/tmp/stuff/scsi2ide.lnk

3079
branches/wbw/Source/master-cfg.asm

File diff suppressed because it is too large

62
branches/wbw/XSource/Makefile

@ -95,14 +95,6 @@
# Uncomment and update values below to hardcode settings:
#
# 1/19/2013 dwg - tested zeta,
CONFIG := S100
ROMSIZE := 512
CPU := 80
SYS := CPM
#CONFIG := zeta
#ROMSIZE := 512
#CPU := 180
@ -115,13 +107,18 @@ SYS := CPM
#SYS := CPM
#ROMNAME := n8_2312
#CONFIG := N8VEM
#CONFIG := n8vem
#ROMSIZE := 512
#CPU := 180
#SYS := CPM
#ROMNAME := N8VEM
#ROMNAME := n8vem
CONFIG := s100
ROMSIZE := 512
CPU := 80
SYS := CPM
ROMNAME := s100
CPUROM := master-cfg
ifndef ROMNAME
ROMNAME := $(CONFIG)
@ -157,6 +154,7 @@ ASMIMG := $(TASM) $(ASMOPT80) -b -fE5
NULL :=
SPACE := ${NULL} ${NULL}
%.bin: %.asm
$(ASM80) $< $@
@ -175,9 +173,17 @@ $(error Usage: make CONFIG=<config> ROMSIZE=[512|1024] CPU=[80|180] SYS=[CPM|ZSY
endif
endif
# The STDS macro names all the sub-includes so they all can be copied
# in from the Source folder. $(STDS) is the first dependency of the "all"
# target, therefore assuring that these files are here in time for their
# use in any assembly that includes the top level file, "std.asm".
STDS = std-n8.inc std-n8vem.inc std-s100.inc std-s2i.inc std-zeta.inc
all: $(STDS) tasm80.tab tasm85.tab $(OUTDIR)/$(ROMNAME).rom $(OUTDIR)/$(ROMNAME).sys $(OUTDIR)/$(ROMNAME).com
#ifdef $(CPUROM)
CONDIT = $(OUTDIR)/$(CPUROM).rom
#endif
all: $(STDS) tasm80.tab tasm85.tab $(OUTDIR)/$(ROMNAME).rom $(OUTDIR)/$(ROMNAME).sys $(OUTDIR)/$(ROMNAME).com $(CONDIT)
rm -f *.asm
rm -f *.bin
rm -f *.inc *.tab *.tmp
@ -211,7 +217,13 @@ bootrom.bin : bootrom.asm std.asm build.inc ver.inc memmgr.asm config_$(CONFIG).
bootapp.bin: bootapp.asm std.asm build.inc ver.inc
$(TASM) $(ASMOPT80) $< $@
#ifdef CPUROM
$(OUTDIR)/$(CPUROM).rom: $(CPUROM).asm std.asm build.inc config_$(CONFIG).asm
cp config_$(CONFIG).asm config.asm
$(ASMIMG) $(CPUROM).asm $(OUTDIR)/$(CPUROM).rom
#endif
pgzero.bin: pgzero.asm std.asm build.inc ver.inc
$(TASM) $(ASMOPT80) $< $@
@ -250,6 +262,13 @@ $(OUTDIR)/$(ROMNAME).com: bootapp.bin syscfg.bin loader.bin hbios.bin dbgmon.bin
$(OUTDIR)/$(ROMNAME).sys: prefix.bin os.bin
cat prefix.bin os.bin >>$@
$(OUTDIR)/$(CPUROM).bin: $(CPUROM).asm std.asm
$(ASMIMG) $(CPUROM).asm $@
std.asm: $(SRC)std.asm
cp $< $@
$(CVT) $@
ansi.asm: $(SRC)ansi.asm
cp $< $@
$(CVT) $@
@ -322,6 +341,12 @@ loader.asm: $(SRC)loader.asm util.asm
cp $(SRC)loader.asm $@
$(CVT) $@
#ifdef $(CPUROM)
$(CPUROM).asm: $(SRC)/$(CPUROM).asm
cp $< $@
$(CVT) $@
#endif
memmgr.asm: $(SRC)memmgr.asm
cp $< $@
$(CVT) $@
@ -366,6 +391,10 @@ romfill.asm: $(SRC)romfill.asm
cp $< $@
$(CVT) $@
s100-i3.asm: $(SRC)s100-i3.asm
cp $< $@
$(CVT) $@
sd.asm: $(SRC)sd.asm
cp $< $@
$(CVT) $@
@ -374,8 +403,11 @@ sd_data.asm: $(SRC)sd_data.asm
cp $< $@
$(CVT) $@
std.asm: $(SRC)std.asm
cp $< $@
# By adding all the sub-includes as dependencies for std.asm, this assures that
# whichever one we are using will be present during the assembly of any modules
# that include std.asm.
std.asm: $(SRC)std.asm std-n8.inc std-n8vem.inc std-s100.inc std-s2i.inc std-zeta.inc
cp $(SRC)std.asm $@
$(CVT) $@
std-n8.inc: $(SRC)std-n8.inc

692
branches/wbw/cpurom/Makefile

@ -0,0 +1,692 @@
########################################################
# Makefile for Doug's Unified BIOS 8/07/2011 #
# The BIOS and associated utilities are generated #
# using the Small Device C Compiler (SDCC) & tools #
# With multiplatform enhancements by John Coffman #
# #
# sdcc.l00 added because stupid Windoze 'echo' appends #
# a confusing SPACE to the end of every line. #
########################################################
#####################################################
# SPREFIX tells where the SDCC package in installed #
# The SDCC package is used to assemble Z80 portions #
# of the software such as the ROM and perhaps some #
# .COM files such as FDISK. #
#####################################################
#################################################################
# TPREFIX tells where the host development tools are installed. #
# The host tools are used to manipulate the Z80 objects after #
# the basic assemblies and compilations have been completed. #
#################################################################
###################################################################
# SDCC is not available on the DOS host, so something else may be #
# used at the descretion of the builder. (TASM for instance). #
###################################################################
###################################################################
# The COPY, DEL and RENAME macros are used to customize the build #
# rules for the host enviroonment. #
###################################################################
#-------------------------------------------
# Choose one only, then Make will work for
# your platform.
#CFG = $(shell uname)
# Mac OS X returns 'Darwin'
# Linux returns 'Linux'
#CFG = dos
#CFG = linux
#CFG = macosx
CFG = windows
#-------------------------------------------
ifeq ($(CFG),Darwin)
DELIM = /
SPREFIX = /Developer/sdcc
SDAS = $(SPREFIX)/bin/sdasz80
SDASFLG = -plosff -Iinc
SDCC = $(SPREFIX)/bin/sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = $(SPREFIX)/share/sdcc/lib/z80
SDLD = $(SPREFIX)/bin/sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCFLG = -I inc
COPY = cp
DEL = rm
DELFLG = -f
# use native ECHO o Mac OS X
ECHO = echo
REN = mv
EXE =
endif
#-------------------------------------------
ifeq ($(CFG),windows)
DELIM = \
SDRIVE = C:
SPREFIX = $(SDRIVE)\Program Files (x86)\sdcc
SDAS = $(SPREFIX)\bin\sdasz80
SDASFLG = -plosff
SDCC = $(SPREFIX)\bin\sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = $(SPREFIX)\lib\z80
SDLD = $(SPREFIX)\bin\sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCOPT = -I inc
COPY = copy
DEL = erase
DELFLG =
REN = rename
# This is special handling for John Coffman to get around funky windows
# behavior where echo adds spurious space o end f line
# ECHO = { lecho | lechocr | lecholf | lechocrlf | lecholfcr }
#ECHO = $(BIN)$(DELIM)lechocr
#ECHO = $(BIN)$(DELIM)lecho
EXE = .exe
endif
#-------------------------------------------
ifeq ($(CFG),Linux)
DELIM = /
SPREFIX = /home/$(USER)
SDAS = $(SPREFIX)/bin/sdasz80
SDASFLG = -plosff
SDCC = $(SPREFIX)/bin/sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = /usr/local/share/sdcc/lib/z80
SDLD = $(SPREFIX)/bin/sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCFLG = -I inc
COPY = cp
DEL = rm
DELFLG = -f
REN = mv
# Use native 'echo' on Linux
ECHO = echo
EXE =
endif
#-------------------------------------------
ifeq ($(CFG),dos)
DELIM = \
SPREFIX =
SDAS =
SDASFLG =
SDCC =
SDCCFLG =
SDCCLIB =
SDLD =
SDLDFLG =
TPREFIX =
TCC = wcl
TCCOPT =
COPY = copy
DEL = erase
DELFLG =
REN = rename
EXE = .exe
endif
############################################################
# Misc other macros
BIN = bin$(DELIM)
COM = com$(DELIM)
INC = inc$(DELIM)
LIB = lib$(DELIM)
LST = lst$(DELIM)
MAP = map$(DELIM)
OBJ = obj$(DELIM)
REF = ref$(DELIM)
ROM = rom$(DELIM)
SRC = src$(DELIM)
TMP = tmp$(DELIM)
# CP/M-80 v2.2 Command files written in SDCC
COMFILES = $(COM)copyfile.com $(COM)fdisk.com
# Components used by CP/M-80 v2.2 Command files
COMRELS = $(OBJ)cpm0.rel $(OBJ)cpmbdos.rel $(OBJ)cprintf.rel
# Components of ROM image containing CP/M for SBC V2
CPMRELS = $(OBJ)crt0.rel $(OBJ)dbgmon.rel $(OBJ)bdosb01.rel \
$(OBJ)ccpb03.rel $(OBJ)cbios.rel
# Components of ROM image used in test protocols
ROMRELS = $(OBJ)crt0jplp.rel $(OBJ)crt0scrm.rel
# Components that control hardware in SBC V2
SBCV2HW =
# Components that control hardware in the SCSI2IDE
SCSI2IDEHW = $(OBJ)z53c80.rel
FDISK = $(BIN)fdisk$(EXE)
DWGH2B = $(BIN)dwgh2b$(EXE)
INCFILES = $(INC)cpmbdos.h $(INC)cprintf.h $(INC)portab.h
JRCH2B = $(BIN)jrch2b$(EXE)
LOAD = $(BIN)load$(EXE)
MK = Makefile
#QUIET = @
# ROM images for SBC V2 and N8
ROMFILES = $(ROM)scsiscrm.rom $(ROM)scsijplp.rom $(ROM)scsi2ide.rom $(ROM)baseline.rom $(ROM)n8.rom
SCSI2IDE = $(ROM)scsi2ide.rom
SYSGEN = $(BIN)sysgen$(EXE)
VERIFY = $(BIN)verify$(EXE)
# C programs compiled on host system used in build
TOOLS = $(FDISK) $(DWGH2B) $(LOAD) $(JRCH2B) $(SYSGEN)
# Versions of 'echo' compiled on host system
ETOOLS = $(BIN)lechocr $(BIN)lecholf $(BIN)lechocrlf $(BIN)lecholfcr
# dribdos.rel is not part of the production set yet
##TEST = dribdos.rel
############################################################
#all: $(ETOOLS) $(TOOLS) $(BINFILES) $(COMFILES) $(CPMFILES) $(ROMFILES)
#all: $(TEST) $(ROMFILES) $(COMFILES)
roms: $(ROMFILES)
scsi2ide: $(SCSI2IDE)
############################################################
# A test assembly of DRI source code for BDOS (from SIMH)
dribdos.rel: $(SRC)dribdos.s
$(QUIET)$(SDAS) $(SDASFLG) dribdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dribdos.lst $(LST)
############################################################
############################################################
# Build SCSIJPLP ROM image
$(ROM)scsijplp.rom: $(OBJ)scsijplp.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.bin $(ROM)scsijplp.rom
$(QUIET)$(DEL) $(DELFLG) scsijplp.*
$(OBJ)scsijplp.bin: $(OBJ)scsijplp.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsijplp
$(OBJ)scsijplp.hex: $(OBJ)scsijplp.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.ihx $(OBJ)scsijplp.hex
$(OBJ)scsijplp.ihx: $(OBJ)crt0jplp.rel $(TMP)scsijplp.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lk
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsijplp.lnk
$(QUIET)$(COPY) $(COPYFLG) scsijplp.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsijplp.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsijplp.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsijplp.arf
$(ECHO) -i scsijplp.ihx >> $(TMP)scsijplp.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsijplp.arf
$(ECHO) -l z80 >> $(TMP)scsijplp.arf
$(ECHO) $(OBJ)crt0jplp.rel >> $(TMP)scsijplp.arf
$(ECHO) -e >> $(TMP)scsijplp.arf
############################################################
############################################################
# Build SCSISCRM ROM image
$(ROM)scsiscrm.rom: $(OBJ)scsiscrm.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.bin $(ROM)scsiscrm.rom
$(QUIET)$(DEL) $(DELFLG) scsiscrm.*
$(OBJ)scsiscrm.bin: $(OBJ)scsiscrm.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsiscrm
$(OBJ)scsiscrm.hex: $(OBJ)scsiscrm.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.ihx $(OBJ)scsiscrm.hex
$(OBJ)scsiscrm.ihx: $(OBJ)crt0scrm.rel $(TMP)scsiscrm.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lk
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsiscrm.lnk
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsiscrm #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsiscrm.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsiscrm.arf
$(ECHO) -i scsiscrm.ihx >> $(TMP)scsiscrm.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsiscrm.arf
$(ECHO) -l z80 >> $(TMP)scsiscrm.arf
$(ECHO) $(OBJ)crt0scrm.rel >> $(TMP)scsiscrm.arf
$(ECHO) -e >> $(TMP)scsiscrm.arf
############################################################
############################################################
# Build SCSI2IDE ROM image
$(ROM)scsi2ide.rom: $(OBJ)scsi2ide.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.bin $(ROM)scsi2ide.rom
$(QUIET)$(DEL) $(DELFLG) scsi2ide.*
$(OBJ)scsi2ide.bin: $(OBJ)scsi2ide.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsi2ide
$(OBJ)scsi2ide.hex: $(OBJ)scsi2ide.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.ihx $(OBJ)scsi2ide.hex
$(OBJ)scsi2ide.ihx: $(CPMRELS) $(SCSI2IDEHW) $(OBJ)scsi2ide.rel $(TMP)scsi2ide.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lk
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsi2ide.lnk
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsi2ide.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsi2ide.arf
$(ECHO) -i scsi2ide.ihx >> $(TMP)scsi2ide.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsi2ide.arf
$(ECHO) -l z80 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CBIOS = 0xE600 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _DBGMON = 0x8000 >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)scsi2ide.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)dbgmon.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)ccpb03.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)bdosb01.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)cbios.rel >> $(TMP)scsi2ide.arf
$(ECHO) -e >> $(TMP)scsi2ide.arf
########################################################
# Compile C portion of the scsi2ide EEPROM Image
$(OBJ)scsi2ide.rel: $(SRC)scsi2ide.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)scsi2ide.c
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.lst $(LST)
############################################################
############################################################
# Build SBC V2 ROM image
$(ROM)baseline.rom: $(OBJ)baseline.bin $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.bin $(ROM)baseline.rom
$(QUIET)$(DEL) $(DELFLG) baseline.*
$(OBJ)baseline.bin: $(OBJ)baseline.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)baseline
$(OBJ)baseline.hex: $(OBJ)baseline.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.ihx $(OBJ)baseline.hex
$(OBJ)baseline.ihx: $(CPMRELS) $(SBCV2HW) $(OBJ)baseline.rel $(TMP)baseline.arf $(MK)
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lk
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)baseline.lnk
$(QUIET)$(COPY) $(COPYFLG) baseline.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.map $(MAP)
#########################################################
# Dynamically generate linker control file for baseline #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)baseline.arf: $(MK)
$(ECHO) -mjx > $(TMP)baseline.arf
$(ECHO) -i baseline.ihx >> $(TMP)baseline.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)baseline.arf
$(ECHO) -l z80 >> $(TMP)baseline.arf
$(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)baseline.arf
$(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)baseline.arf
$(ECHO) -b _CBIOS = 0xE600 >> $(TMP)baseline.arf
$(ECHO) -b _DBGMON = 0x8000 >> $(TMP)baseline.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)baseline.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)cbios.rel >> $(TMP)baseline.arf
$(ECHO) -e >> $(TMP)baseline.arf
########################################################
# Compile C portion of the Baseline PROM Image
$(OBJ)baseline.rel: $(SRC)baseline.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)baseline.c
$(QUIET)$(COPY) $(COPYFLG) baseline.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.lst $(LST)
############################################################
# Build N8 ROM image
#
# Save the resulting merged image in the Rom folder
#
$(ROM)n8.rom: $(OBJ)n8-romim.bin $(MK)
$(QUIET)$(COPY) $(OBJ)n8-romim.bin $(ROM)n8.rom
$(QUIET)$(DEL) $(DELFLG) n8.*
#
# Convert the Intel hex file into a binary, similar
# to the results of the "copy /B ..."
#
$(OBJ)n8-romim.bin: $(OBJ)sysimage.hex $(REF)n8-romim.ref $(SYSGEN) $(HEX2BIN) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)sysimage
$(QUIET)$(COPY) $(REF)n8-romim.ref $(OBJ)n8-romim.bin
$(QUIET)$(SYSGEN) -i $(OBJ)sysimage.bin $(OBJ)n8-romim.bin
#
# Take the output of the linker and rename to the more
# recognizable .hex form and the expected name "sysimage.hex"
#
$(OBJ)sysimage.hex: $(OBJ)n8.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)n8.ihx $(OBJ)sysimage.hex
#
# Combine the independently assembled components into one piece
# and output Intel hex file (ihx)
#
$(OBJ)n8.ihx: $(OBJ)loadern8.rel $(OBJ)dbgmon.rel $(OBJ)ccpb03.rel $(OBJ)bdosb01.rel $(OBJ)cbiosn8.rel $(TMP)n8.arf $(MK)
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lk
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)n8.lnk
$(QUIET)$(COPY) $(COPYFLG) n8.ihx $(OBJ)n8.ihx
$(QUIET)$(COPY) $(COPYFLG) n8.map $(MAP)
$(OBJ)cbiosn8.rel: $(SRC)cbiosn8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbiosn8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.lst $(LST)
$(OBJ)loadern8.rel: $(SRC)loadern8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)loadern8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)loadern8.rel $(OBJ)
$(QUIET)$(COPY $(COPYFLG) $(SRC)loadern8.lst $(LST)
########################################################
# Dynamically generate the linker control file for N8 #
# Now uses the macro controlled ECHO feature #
########################################################
$(TMP)n8.arf: Makefile
$(ECHO) -mjx > $(TMP)n8.arf
$(ECHO) -i n8.ihx >> $(TMP)n8.arf
$(ECHO) -k /usr/local/share/sdcc/lib/z80 >> $(TMP)n8.arf
$(ECHO) -l z80 >> $(TMP)n8.arf
$(ECHO) -b _CCPB03 = 0x0900 >> $(TMP)n8.arf
$(ECHO) -b _BDOSB01 = 0x1100 >> $(TMP)n8.arf
$(ECHO) -b _CBIOS = 0x1f00 >> $(TMP)n8.arf
$(ECHO) $(OBJ)loadern8.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)cbiosn8.rel >> $(TMP)n8.arf
$(ECHO) -e >> $(TMP)n8.arf
############################################################
# Hardware specific assemblies (most likely used by BIOS's)
#
# Assemble hardware control code for the Zilog Z53C8003V5C
#
$(OBJ)z53c80.rel: $(SRC)z53c80.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)z53c80.c
$(QUIET)$(COPY) $(COPYFLG) z53c80.rel $(OBJ)
$(QUIET)$(DEL) $(DELFLG) z53c80.*
#
# Compile ersatz printf routine for use in CP/M-80 command files
#
$(OBJ)cprintf.rel: $(SRC)cprintf.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)cprintf.c
$(QUIET)$(COPY) $(COPYFLG) cprintf.rel obj
$(QUIET)$(DEL) $(DELFLG) cprintf.*
############################################################
# Build CP/M 2.2 command files (copyfile.com, fdisk.com)
#-----------------------------------------------------------
$(COM)copyfile.com: $(OBJ)copyfile.com $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.com $(COM)copyfile.com
$(QUIET)$(DEL) $(DELFLG) copyfile.*
$(OBJ)copyfile.com: $(OBJ)copyfile.hex $(LOAD) $(BINFILES) $(MK)
$(QUIET)$(LOAD) $(OBJ)copyfile
$(OBJ)copyfile.hex: $(OBJ)copyfile.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.ihx $(OBJ)copyfile.hex
$(OBJ)copyfile.ihx: $(OBJ)copyfile.rel $(COMRELS) $(TMP)copyfile.arf $(MK)
$(QUIET)$(COPY) $(TMP)copyfile.arf $(TMP)copyfile.lnk
$(QUIET)$(SDLD) $(LOPTS) -nf $(TMP)copyfile.lnk
$(QUIET)$(COPY) $(COPYFLG) copyfile.ihx obj
$(QUIET)$(COPY) $(COPYFLG) copyfile.map map
##############################################################
# Dynamicaly create linker command file for copyfile utility #
# Now uses the macro controlled ECHO feature #
##############################################################
$(TMP)copyfile.arf: Makefile
$(ECHO) -mjx > $(TMP)copyfile.arf
$(ECHO) -i copyfile.ihx >> $(TMP)copyfile.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)copyfile.arf
$(ECHO) -l z80 >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)copyfile.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)copyfile.arf
$(ECHO) -e >> $(TMP)copyfile.arf
$(OBJ)copyfile.rel: $(SRC)copyfile.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)copyfile.c
$(QUIET)$(COPY) copyfile.rel obj
$(QUIET)$(DEL) $(DELFLG) copyfile.rel
ls obj
#-----------------------------------------------------------
#
# Use locally compiled 'load' command to covert Intel
# hex formal file to a binary CP/M-80 command file.
#
$(COM)fdisk.com: $(OBJ)fdisk.hex $(TOOLS) $(MK)
$(QUIET)$(BIN)load $(OBJ)fdisk
$(QUIET)$(COPY) $(COPYFLG) $(OBJ)fdisk.com com
$(QUIET)$(DEL) $(DELFLG) fdisk.*
#
# rename 'ihx' output of linker to 'hex'
$(OBJ)fdisk.hex: $(OBJ)fdisk.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)fdisk.ihx $(OBJ)fdisk.hex
$(OBJ)fdisk.ihx: $(OBJ)fdisk.rel $(TMP)fdisk.arf $(MK)
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(COPYFLG) fdisk.ihx $(OBJ)fdisk.ihx
$(QUIET)$(COPY) $(COPYFLG) fdisk.map map
$(OBJ)fdisk.rel: $(SRC)fdisk.c $(INCFILES) $(MK)
$(QUIET)$(SDCC) -I inc $(SDCCFLG) $(SRC)fdisk.c
$(QUIET)$(COPY) $(COPYFLG) fdisk.rel $(OBJ)
############################################################################
# Dynamically created linker command file for fdisk utility (CP/M version) #
# Now uses macro controlled ECHO feature #
############################################################################
$(TMP)fdisk.arf: $(MK)
$(ECHO) -mjx > $(TMP)fdisk.arf
$(ECHO) -i fdisk.ihx >> $(TMP)fdisk.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)fdisk.arf
$(ECHO) -l z80 >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)fdisk.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)fdisk.arf
$(ECHO) -e >> $(TMP)fdisk.arf
#-----------------------------------------------------------
# Also build host version of fdisk for testing purposes
$(BIN)fdisk$(EXE): $(SRC)fdisk.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)fdisk.c -o $(BIN)fdisk
############################################################
# Build CP/M-80 Command File Structure Files
$(OBJ)cpm0.rel: $(SRC)cpm0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpm0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.lst $(LST)
$(OBJ)cpmbdos.rel: $(SRC)cpmbdos.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpmbdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.lst $(LST)
############################################################
# Build ROM Image structure files
$(OBJ)crt0.rel: $(SRC)crt0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.lst $(LST)
$(OBJ)crt0jplp.rel: $(SRC)crt0jplp.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0jplp.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.lst $(LST)
$(OBJ)crt0scrm.rel: $(SRC)crt0scrm.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0scrm.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.lst $(LST)
$(OBJ)bdosb01.rel: $(SRC)bdosb01.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)bdosb01.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.lst $(LST)
$(OBJ)ccpb03.rel: $(SRC)ccpb03.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)ccpb03.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.lst $(LST)
#
# Assemble hardware control code for SBC V2
#
$(OBJ)cbios.rel: $(SRC)cbios.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbios.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.lst $(LST)
#
# Assemble a monitor program for the SBC V2
#
$(OBJ)dbgmon.rel: $(SRC)dbgmon.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)dbgmon.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.lst $(LST)
###########################################################
# Build host based tools ( dwgh2b, jrch2b, load, verify)
$(DWGH2B): $(SRC)dwgh2b.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)dwgh2b.c -o $(BIN)dwgh2b$(EXE)
#
# Compile John Coffman's hex2bin program
#
$(JRCH2B): $(SRC)jrch2b.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)jrch2b.c -o $(BIN)jrch2b$(EXE)
$(QUIET)$(COPY) $(COPYFLG) $(BIN)jrch2b $(BIN)jrcb2h
#
# Compile Doug's "load" program
#
$(LOAD): $(SRC)load.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)load.c -o $(BIN)load$(EXE)
$(SYSGEN): $(SRC)sysgen.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)sysgen.c -o $(BIN)sysgen$(EXE)
#
# Compile Doug's verif program that compares binary file regions
#
$(VERIFY): $(SRC)verify.c Makefile $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)verify.c -o $(BIN)verify
$(BIN)lechocr: $(SRC)lechocr.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocr.c -o $(BIN)lechocr
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocr.c
$(QUIET)$(COPY) lechocr.exe $(BIN)
$(BIN)lecholf: $(SRC)lecholf.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholf.c -o $(BIN)lecholf
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholf.c
$(COPY) lecholf.exe $(BIN)
$(BIN)lechocrlf: $(SRC)lechocrlf.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocrlf.c -o $(BIN)lechocrlf
$(BIN)lecholfcr: $(SRC)lecholfcr.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholfcr.c -o $(BIN)lecholfcr
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholfcr.c -o $(BIN)lecholfcr
############################################################
# Builder specific utility rules
dwginstall:
$(COPY) $(COMFILES) ~/Documents/devobox/cdrive
############################################################
#
# Delete all dynamically generated files that don't need to be
# saved.
#
clean:
$(QUIET)$(DEL) $(DELFLG) *.hex *.ihx *.lst *.rel *.rst *.lnk *.lk
$(QUIET)$(DEL) $(DELFLG) *.sym *.map *.noi *.asm *.com *.ini *.bin
$(QUIET)$(DEL) $(DELFLG) obj/* bin/* com/* rom/* tmp/* map/* lst/*
##################
# eof - Makefile #
##################

1
branches/wbw/cpurom/cleanxp.bat

@ -0,0 +1 @@
wmake -f makefile.xp clean

BIN
branches/wbw/cpurom/doc/agm1264f.pdf

Binary file not shown.

BIN
branches/wbw/cpurom/doc/bdoscalls.webarchive

Binary file not shown.

BIN
branches/wbw/cpurom/doc/bios.webarchive

Binary file not shown.

BIN
branches/wbw/cpurom/doc/fcb.webarchive

Binary file not shown.

92
branches/wbw/cpurom/doc/jrch2b.doc

@ -0,0 +1,92 @@
Usage:
hex2bin <options> [<flags> <filename.hex>]+
bin2hex <options> <flags> <filename.bin>
Options:
-o <output filename> -- default is 'out.bin' or 'out.hex'
No suffix is added to the filename, so the full
file name must be specified.
-p <pad byte> -- default is 0xFF, which is the erased
value for most ROM's. Pad bytes are not explicitly
written out when 'bin2hex' is used. This reduces
the size of sparse ROM images.
-R <ROM size> -- may be any value. Normally this will be
specified as '128k' or 0x10000. The suffixes 'k'
and 'M' are recognized. The default value is 64k
for 'hex2bin' and 1M for 'bin2hex'.
-v [<verbosity level>] -- used primarily for debugging. A
verbosity level of 3 will print each line as it is
processed.
Options are global, and may be specified anywhere on the command
line. Only 'flags', below, are position sensitive. Flags must
be specified immediately before the file name they are to affect.
They do not affect more that a single file. They reset to their
default values before the next input file, scanning left to
right, is processed.
Flags:
Flag values apply only to the following file, and are reset
to the default values before the next file is processed. The
source and destination flags allow code to be relocated
within the ROM so that code may be loaded at a different
location than where it will ultimately be run.
-d <destination address in output file> -- default is 0.
data will only be loaded between the limits of
the -d <dest> address and the -D <limit> address
minus 1.
-D <destination limit in output file> -- default is 16M. No data
will be loaded at or above this address.
-s <source address in input file> -- default is 0. Hex input
is only processed if it falls at addresses in the
.hex input file between the -s <srs> address and the
-S <limit> address minus 1. Likewise, Bin input
is only processed if it falls between similar limits
in the input ROM image.
-S <source limit in hex file> -- default is 16M. No input
data at or above this address will be processed.
Numeric values on the command line may be specified in any C-like
syntax: 0x0000 is hexadecimal, 1234 is decimal, and 0177 is
octal. In addition the suffixes 'k' for kilo- and 'M' for mega-
cause the preceding values to be multiplied by 1024 or 1048576,
respectively.
Examples:
hex2bin -p 0xFF -R32k cpm22.hex -o cpmtest.bin
hex2bin -o cpmtest.bin cpm22.hex -R 0x8000 -p255
The preceding two lines have identical effects in all
respects.
hex2bin -R 1M -s 0xd000 -d 0x0800 -D0x2800 image.hex \
pagezero.hex -oROMIMAGE.bin
The above line loads the 'pagezero.hex' file at the exact
addresses specified in the file; however, the 'image.hex' file
is assembled at 0xD000, must run at 0xD000, but is loaded
between 0x800 <= addr < 0x2800. It is presumed that the
code will be relocated to the correct address before it is
executed.
bin2hex -R128k romimage.bin -o image.hex
Simple conversion from a BIN file to a HEX file. The ROM
data is limited to 128k.
bin2hex -s 0x1000 -S 0x2000 -d 0x21000 romimage.bin \
-o Relocated.hex
Extract from a ROM image file all of the data between 0x1000
and 0x1FFF, inclusive, and write to an Intel hex file for
re-loading two 64k segments higher in a future ROM.
(end)

BIN
branches/wbw/cpurom/doc/make.pdf

Binary file not shown.

BIN
branches/wbw/cpurom/doc/sdcc-z80-mode.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
branches/wbw/cpurom/doc/watcom-tools.pdf

Binary file not shown.

558
branches/wbw/cpurom/exp/common.mak

@ -0,0 +1,558 @@
# mak/makebody.mfi 8/8/2011 dwg -
# Misc other macros
BIN = bin$(DELIM)
COM = com$(DELIM)
INC = inc$(DELIM)
LIB = lib$(DELIM)
LST = lst$(DELIM)
MAP = map$(DELIM)
OBJ = obj$(DELIM)
REF = ref$(DELIM)
ROM = rom$(DELIM)
SRC = src$(DELIM)
TMP = tmp$(DELIM)
# CP/M-80 v2.2 Command files written in SDCC
COMFILES = $(COM)copyfile.com $(COM)fdisk.com
# Components used by CP/M-80 v2.2 Command files
COMRELS = $(OBJ)cpm0.rel $(OBJ)cpmbdos.rel $(OBJ)cprintf.rel
# Components of ROM image containing CP/M for SBC V2
CPMRELS = $(OBJ)crt0.rel $(OBJ)dbgmon.rel $(OBJ)bdosb01.rel \
$(OBJ)ccpb03.rel $(OBJ)cbios.rel
# Components of ROM image used in test protocols
ROMRELS = $(OBJ)crt0jplp.rel $(OBJ)crt0scrm.rel
# Components that control hardware in SBC V2
SBCV2HW =
# Components that control hardware in the SCSI2IDE
SCSI2IDEHW = $(OBJ)z53c80.rel
FDISK = $(BIN)fdisk$(EXE)
DWGH2B = $(BIN)dwgh2b$(EXE)
INCFILES = $(INC)cpmbdos.h $(INC)cprintf.h $(INC)portab.h
JRCH2B = $(BIN)jrch2b$(EXE)
LOAD = $(BIN)load$(EXE)
MK = Makefile
#QUIET = @
# ROM images for SBC V2 and N8
ROMFILES = $(ROM)scsiscrm.rom $(ROM)scsijplp.rom $(ROM)scsi2ide.rom $(ROM)baseline.rom $(ROM)n8.rom
SCSI2IDE = $(ROM)scsi2ide.rom
SYSGEN = $(BIN)sysgen$(EXE)
VERIFY = $(BIN)verify$(EXE)
# C programs compiled on host system used in build
TOOLS = $(FDISK) $(DWGH2B) $(LOAD) $(JRCH2B) $(SYSGEN)
# Versions of 'echo' compiled on host system
ETOOLS = $(BIN)lechocr $(BIN)lecholf $(BIN)lechocrlf $(BIN)lecholfcr
# dribdos.rel is not part of the production set yet
##TEST = dribdos.rel
############################################################
#all: $(ETOOLS) $(TOOLS) $(BINFILES) $(COMFILES) $(CPMFILES) $(ROMFILES)
#all: $(TEST) $(ROMFILES) $(COMFILES)
roms: $(ROMFILES)
scsi2ide: $(SCSI2IDE)
############################################################
# A test assembly of DRI source code for BDOS (from SIMH)
dribdos.rel: $(SRC)dribdos.s
$(QUIET)$(SDAS) $(SDASFLG) dribdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dribdos.lst $(LST)
############################################################
############################################################
# Build SCSIJPLP ROM image
$(ROM)scsijplp.rom: $(OBJ)scsijplp.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.bin $(ROM)scsijplp.rom
$(QUIET)$(DEL) $(DELFLG) scsijplp.*
$(OBJ)scsijplp.bin: $(OBJ)scsijplp.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsijplp
$(OBJ)scsijplp.hex: $(OBJ)scsijplp.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.ihx $(OBJ)scsijplp.hex
$(OBJ)scsijplp.ihx: $(OBJ)crt0jplp.rel $(TMP)scsijplp.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lk
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsijplp.lnk
$(QUIET)$(COPY) $(COPYFLG) scsijplp.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsijplp.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsijplp.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsijplp.arf
$(ECHO) -i scsijplp.ihx >> $(TMP)scsijplp.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsijplp.arf
$(ECHO) -l z80 >> $(TMP)scsijplp.arf
$(ECHO) $(OBJ)crt0jplp.rel >> $(TMP)scsijplp.arf
$(ECHO) -e >> $(TMP)scsijplp.arf
############################################################
############################################################
# Build SCSISCRM ROM image
$(ROM)scsiscrm.rom: $(OBJ)scsiscrm.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.bin $(ROM)scsiscrm.rom
$(QUIET)$(DEL) $(DELFLG) scsiscrm.*
$(OBJ)scsiscrm.bin: $(OBJ)scsiscrm.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsiscrm
$(OBJ)scsiscrm.hex: $(OBJ)scsiscrm.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.ihx $(OBJ)scsiscrm.hex
$(OBJ)scsiscrm.ihx: $(OBJ)crt0scrm.rel $(TMP)scsiscrm.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lk
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsiscrm.lnk
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsiscrm #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsiscrm.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsiscrm.arf
$(ECHO) -i scsiscrm.ihx >> $(TMP)scsiscrm.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsiscrm.arf
$(ECHO) -l z80 >> $(TMP)scsiscrm.arf
$(ECHO) $(OBJ)crt0scrm.rel >> $(TMP)scsiscrm.arf
$(ECHO) -e >> $(TMP)scsiscrm.arf
############################################################
############################################################
# Build SCSI2IDE ROM image
$(ROM)scsi2ide.rom: $(OBJ)scsi2ide.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.bin $(ROM)scsi2ide.rom
$(QUIET)$(DEL) $(DELFLG) scsi2ide.*
$(OBJ)scsi2ide.bin: $(OBJ)scsi2ide.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsi2ide
$(OBJ)scsi2ide.hex: $(OBJ)scsi2ide.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.ihx $(OBJ)scsi2ide.hex
$(OBJ)scsi2ide.ihx: $(CPMRELS) $(SCSI2IDEHW) $(OBJ)scsi2ide.rel $(TMP)scsi2ide.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lk
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsi2ide.lnk
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsi2ide.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsi2ide.arf
$(ECHO) -i scsi2ide.ihx >> $(TMP)scsi2ide.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsi2ide.arf
$(ECHO) -l z80 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CBIOS = 0xE600 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _DBGMON = 0x8000 >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)scsi2ide.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)dbgmon.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)ccpb03.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)bdosb01.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)cbios.rel >> $(TMP)scsi2ide.arf
$(ECHO) -e >> $(TMP)scsi2ide.arf
########################################################
# Compile C portion of the scsi2ide EEPROM Image
$(OBJ)scsi2ide.rel: $(SRC)scsi2ide.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)scsi2ide.c
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.lst $(LST)
############################################################
############################################################
# Build SBC V2 ROM image
$(ROM)baseline.rom: $(OBJ)baseline.bin $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.bin $(ROM)baseline.rom
$(QUIET)$(DEL) $(DELFLG) baseline.*
$(OBJ)baseline.bin: $(OBJ)baseline.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)baseline
$(OBJ)baseline.hex: $(OBJ)baseline.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.ihx $(OBJ)baseline.hex
$(OBJ)baseline.ihx: $(CPMRELS) $(SBCV2HW) $(OBJ)baseline.rel $(TMP)baseline.arf $(MK)
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lk
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)baseline.lnk
$(QUIET)$(COPY) $(COPYFLG) baseline.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.map $(MAP)
#########################################################
# Dynamically generate linker control file for baseline #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)baseline.arf: $(MK)
$(ECHO) -mjx > $(TMP)baseline.arf
$(ECHO) -i baseline.ihx >> $(TMP)baseline.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)baseline.arf
$(ECHO) -l z80 >> $(TMP)baseline.arf
$(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)baseline.arf
$(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)baseline.arf
$(ECHO) -b _CBIOS = 0xE600 >> $(TMP)baseline.arf
$(ECHO) -b _DBGMON = 0x8000 >> $(TMP)baseline.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)baseline.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)cbios.rel >> $(TMP)baseline.arf
$(ECHO) -e >> $(TMP)baseline.arf
########################################################
# Compile C portion of the Baseline PROM Image
$(OBJ)baseline.rel: $(SRC)baseline.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)baseline.c
$(QUIET)$(COPY) $(COPYFLG) baseline.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.lst $(LST)
############################################################
# Build N8 ROM image
#
# Save the resulting merged image in the Rom folder
#
$(ROM)n8.rom: $(OBJ)n8-romim.bin $(MK)
$(QUIET)$(COPY) $(OBJ)n8-romim.bin $(ROM)n8.rom
$(QUIET)$(DEL) $(DELFLG) n8.*
#
# Convert the Intel hex file into a binary, similar
# to the results of the "copy /B ..."
#
$(OBJ)n8-romim.bin: $(OBJ)sysimage.hex $(REF)n8-romim.ref $(SYSGEN) $(HEX2BIN) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)sysimage
$(QUIET)$(COPY) $(REF)n8-romim.ref $(OBJ)n8-romim.bin
$(QUIET)$(SYSGEN) -i $(OBJ)sysimage.bin $(OBJ)n8-romim.bin
#
# Take the output of the linker and rename to the more
# recognizable .hex form and the expected name "sysimage.hex"
#
$(OBJ)sysimage.hex: $(OBJ)n8.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)n8.ihx $(OBJ)sysimage.hex
#
# Combine the independently assembled components into one piece
# and output Intel hex file (ihx)
#
$(OBJ)n8.ihx: $(OBJ)loadern8.rel $(OBJ)dbgmon.rel $(OBJ)ccpb03.rel $(OBJ)bdosb01.rel $(OBJ)cbiosn8.rel $(TMP)n8.arf $(MK)
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lk
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)n8.lnk
$(QUIET)$(COPY) $(COPYFLG) n8.ihx $(OBJ)n8.ihx
$(QUIET)$(COPY) $(COPYFLG) n8.map $(MAP)
$(OBJ)cbiosn8.rel: $(SRC)cbiosn8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbiosn8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.lst $(LST)
$(OBJ)loadern8.rel: $(SRC)loadern8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)loadern8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)loadern8.rel $(OBJ)
$(QUIET)$(COPY $(COPYFLG) $(SRC)loadern8.lst $(LST)
########################################################
# Dynamically generate the linker control file for N8 #
# Now uses the macro controlled ECHO feature #
########################################################
$(TMP)n8.arf: Makefile
$(ECHO) -mjx > $(TMP)n8.arf
$(ECHO) -i n8.ihx >> $(TMP)n8.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)n8.arf
$(ECHO) -l z80 >> $(TMP)n8.arf
$(ECHO) -b _CCPB03 = 0x0900 >> $(TMP)n8.arf
$(ECHO) -b _BDOSB01 = 0x1100 >> $(TMP)n8.arf
$(ECHO) -b _CBIOS = 0x1f00 >> $(TMP)n8.arf
$(ECHO) $(OBJ)loadern8.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)cbiosn8.rel >> $(TMP)n8.arf
$(ECHO) -e >> $(TMP)n8.arf
############################################################
# Hardware specific assemblies (most likely used by BIOS's)
#
# Assemble hardware control code for the Zilog Z53C8003V5C
#
$(OBJ)z53c80.rel: $(SRC)z53c80.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)z53c80.c
$(QUIET)$(COPY) $(COPYFLG) z53c80.rel $(OBJ)
$(QUIET)$(DEL) $(DELFLG) z53c80.*
#
# Compile ersatz printf routine for use in CP/M-80 command files
#
$(OBJ)cprintf.rel: $(SRC)cprintf.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)cprintf.c
$(QUIET)$(COPY) $(COPYFLG) cprintf.rel obj
$(QUIET)$(DEL) $(DELFLG) cprintf.*
############################################################
# Build CP/M 2.2 command files (copyfile.com, fdisk.com)
#-----------------------------------------------------------
$(COM)copyfile.com: $(OBJ)copyfile.com $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.com $(COM)copyfile.com
$(QUIET)$(DEL) $(DELFLG) copyfile.*
$(OBJ)copyfile.com: $(OBJ)copyfile.hex $(LOAD) $(BINFILES) $(MK)
$(QUIET)$(LOAD) $(OBJ)copyfile
$(OBJ)copyfile.hex: $(OBJ)copyfile.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.ihx $(OBJ)copyfile.hex
$(OBJ)copyfile.ihx: $(OBJ)copyfile.rel $(COMRELS) $(TMP)copyfile.arf $(MK)
$(QUIET)$(COPY) $(TMP)copyfile.arf $(TMP)copyfile.lnk
$(QUIET)$(SDLD) $(LOPTS) -nf $(TMP)copyfile.lnk
$(QUIET)$(COPY) $(COPYFLG) copyfile.ihx obj
$(QUIET)$(COPY) $(COPYFLG) copyfile.map map
##############################################################
# Dynamicaly create linker command file for copyfile utility #
# Now uses the macro controlled ECHO feature #
##############################################################
$(TMP)copyfile.arf: Makefile
$(ECHO) -mjx > $(TMP)copyfile.arf
$(ECHO) -i copyfile.ihx >> $(TMP)copyfile.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)copyfile.arf
$(ECHO) -l z80 >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)copyfile.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)copyfile.arf
$(ECHO) -e >> $(TMP)copyfile.arf
$(OBJ)copyfile.rel: $(SRC)copyfile.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)copyfile.c
$(QUIET)$(COPY) copyfile.rel obj
$(QUIET)$(DEL) $(DELFLG) copyfile.rel
ls obj
#-----------------------------------------------------------
#
# Use locally compiled 'load' command to covert Intel
# hex formal file to a binary CP/M-80 command file.
#
$(COM)fdisk.com: $(OBJ)fdisk.hex $(TOOLS) $(MK)
$(QUIET)$(BIN)load $(OBJ)fdisk
$(QUIET)$(COPY) $(COPYFLG) $(OBJ)fdisk.com com
$(QUIET)$(DEL) $(DELFLG) fdisk.*
#
# rename 'ihx' output of linker to 'hex'
$(OBJ)fdisk.hex: $(OBJ)fdisk.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)fdisk.ihx $(OBJ)fdisk.hex
$(OBJ)fdisk.ihx: $(OBJ)fdisk.rel $(TMP)fdisk.arf $(MK)
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(COPYFLG) fdisk.ihx $(OBJ)fdisk.ihx
$(QUIET)$(COPY) $(COPYFLG) fdisk.map map
$(OBJ)fdisk.rel: $(SRC)fdisk.c $(INCFILES) $(MK)
$(QUIET)$(SDCC) -I inc $(SDCCFLG) $(SRC)fdisk.c
$(QUIET)$(COPY) $(COPYFLG) fdisk.rel $(OBJ)
############################################################################
# Dynamically created linker command file for fdisk utility (CP/M version) #
# Now uses macro controlled ECHO feature #
############################################################################
$(TMP)fdisk.arf: $(MK)
$(ECHO) -mjx > $(TMP)fdisk.arf
$(ECHO) -i fdisk.ihx >> $(TMP)fdisk.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)fdisk.arf
$(ECHO) -l z80 >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)fdisk.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)fdisk.arf
$(ECHO) -e >> $(TMP)fdisk.arf
#-----------------------------------------------------------
# Also build host version of fdisk for testing purposes
$(BIN)fdisk$(EXE): $(SRC)fdisk.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)fdisk.c -o $(BIN)fdisk
############################################################
# Build CP/M-80 Command File Structure Files
$(OBJ)cpm0.rel: $(SRC)cpm0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpm0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.lst $(LST)
$(OBJ)cpmbdos.rel: $(SRC)cpmbdos.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpmbdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.lst $(LST)
############################################################
# Build ROM Image structure files
$(OBJ)crt0.rel: $(SRC)crt0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.lst $(LST)
$(OBJ)crt0jplp.rel: $(SRC)crt0jplp.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0jplp.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.lst $(LST)
$(OBJ)crt0scrm.rel: $(SRC)crt0scrm.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0scrm.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.lst $(LST)
$(OBJ)bdosb01.rel: $(SRC)bdosb01.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)bdosb01.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.lst $(LST)
$(OBJ)ccpb03.rel: $(SRC)ccpb03.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)ccpb03.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.lst $(LST)
#
# Assemble hardware control code for SBC V2
#
$(OBJ)cbios.rel: $(SRC)cbios.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbios.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.lst $(LST)
#
# Assemble a monitor program for the SBC V2
#
$(OBJ)dbgmon.rel: $(SRC)dbgmon.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)dbgmon.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.lst $(LST)
###########################################################
# Build host based tools ( dwgh2b, jrch2b, load, verify)
$(DWGH2B): $(SRC)dwgh2b.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)dwgh2b.c -o $(BIN)dwgh2b$(EXE)
#
# Compile John Coffman's hex2bin program
#
$(JRCH2B): $(SRC)jrch2b.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)jrch2b.c -o $(BIN)jrch2b$(EXE)
$(QUIET)$(COPY) $(COPYFLG) $(BIN)jrch2b $(BIN)jrcb2h
#
# Compile Doug's "load" program
#
$(LOAD): $(SRC)load.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)load.c -o $(BIN)load$(EXE)
$(SYSGEN): $(SRC)sysgen.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)sysgen.c -o $(BIN)sysgen$(EXE)
#
# Compile Doug's verif program that compares binary file regions
#
$(VERIFY): $(SRC)verify.c Makefile $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)verify.c -o $(BIN)verify
$(BIN)lechocr: $(SRC)lechocr.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocr.c -o $(BIN)lechocr
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocr.c
$(QUIET)$(COPY) lechocr.exe $(BIN)
$(BIN)lecholf: $(SRC)lecholf.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholf.c -o $(BIN)lecholf
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholf.c
$(COPY) lecholf.exe $(BIN)
$(BIN)lechocrlf: $(SRC)lechocrlf.c $(MK)
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lechocrlf.c -o $(BIN)lechocrlf
$(BIN)lecholfcr: $(SRC)lecholfcr.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholfcr.c -o $(BIN)lecholfcr
$(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholfcr.c -o $(BIN)lecholfcr
############################################################
# Builder specific utility rules
dwginstall:
$(COPY) $(COMFILES) ~/Documents/devobox/cdrive
############################################################
#
# Delete all dynamically generated files that don't need to be
# saved.
#
clean:
$(QUIET)$(DEL) $(DELFLG) *.hex *.ihx *.lst *.rel *.rst *.lnk *.lk
$(QUIET)$(DEL) $(DELFLG) *.sym *.map *.noi *.asm *.com *.ini *.bin
$(QUIET)$(DEL) $(DELFLG) obj$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) bin$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) com$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) rom$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) tmp$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) map$(DELIM)*.*
$(QUIET)$(DEL) $(DELFLG) lst$(DELIM)*.*
##################
# eof - Makefile #
##################

26
branches/wbw/cpurom/exp/makefile.mac

@ -0,0 +1,26 @@
# ubios/makefile.mac 8/8/2011 dwg -
DELIM = /
SPREFIX = /Developer/sdcc
SDAS = $(SPREFIX)/bin/sdasz80
SDASFLG = -plosff -Iinc
SDCC = $(SPREFIX)/bin/sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = $(SPREFIX)/share/sdcc/lib/z80
SDLD = $(SPREFIX)/bin/sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCFLG = -I inc
COPY = cp
DEL = rm
DELFLG = -f
# use native ECHO o Mac OS X
ECHO = echo
REN = mv
EXE =
include common.mak

24
branches/wbw/cpurom/exp/makefile.win

@ -0,0 +1,24 @@
DELIM = \
SDRIVE = C:
SPREFIX = $(SDRIVE)\sdcc
SDAS = $(SPREFIX)\bin\sdasz80
SDASFLG = -plosff
SDCC = $(SPREFIX)\bin\sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = $(SPREFIX)\lib\z80
SDLD = $(SPREFIX)\bin\sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCOPT = -I inc
COPY = copy
DEL = erase
DELFLG = /Q
REN = rename
ECHO = $(BIN)lecholf
EXE = .exe
.include common.mak

95
branches/wbw/cpurom/inc/agm1264f.h

@ -0,0 +1,95 @@
/*
*
* agm1264f.h 5/14/2011 dwg -
* 8 lines of 21 characters
*
*/
/*
1 2
123456789012345678901
---------------------
1 |1234 11223344 1234 |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
---------------------
/* This is a 7x5 character layout showing how much text data can be display on the agm1264f
1 1 1
1 2 3 4 5 6 7 8 9 0 1 2
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
---------------------------------------------------------------------------------------------------------------------------------
0 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
1 | 2 |
2 | 3 |
3 | 4 |
4 | 5 |
5 | 6 |
6 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
7 | |
8 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
9 | 2 |
10 | 3 |
1 | 4 |
2 | 5 |
3 | 6 |
4 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
5 | |
6 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
7 | 2 |
8 | 3 |
9 | 4 |
20 | 5 |
1 | 6 |
2 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
3 | |
4 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
5 | 2 |
6 | 3 | |
7 | 4 |
8 | 5 |
9 | 6 |
30 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
1 | |
2 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
3 | 2 |
4 | 3 |
5 | 4 |
6 | 5 |
7 | 6 |
8 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
9 | |
40 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
1 | 2 |
2 | 3 |
3 | 4 |
4 | 5 |
5 | 6 |
6 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
7 | |
8 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
9 | 2 |
50 | 3 |
1 | 4 |
2 | 5 |
3 | 6 |
4 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
5 | |
6 | 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
7 | 2 |
8 | 3 |
9 | 4 |
60 | 5 |
1 | 6 |
2 | 72345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 |
3 | |
---------------------------------------------------------------------------------------------------------------------------------
*/

89
branches/wbw/cpurom/inc/cpmbdos.h

@ -0,0 +1,89 @@
/*
* CP/M-80 v2.2 BDOS Interfaces
* Copyright (C) Douglas W. Goodall
* For Non-Commercial use by N8VEM
* 5/10/2011 dwg - initial version
*/
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#define C_READ 1
#define C_WRITE 2
#define A_READ 3
#define A_WRITE 4
#define L_WRITE 5
#define C_RAWIO 6
#define GETIOBYTE 7
#define SETIOBYTE 8
#define C_WRITESTR 9
#define C_READSTR 10
#define F_OPEN 15
#define F_CLOSE 16
#define F_DELETE 19
#define F_READ 20
#define F_WRITE 21
#define F_MAKE 22
#define F_RENAME 23
#define DRV_LOGINVEC 24
#define DRV_GET 25
#define F_DMAOFF 26
#define DRV_ALLOCVEC 27
#define DRV_SETRO 28
#define DRV_ROVEC 29
#define F_ATTRIB 30
#define DRV_DPB 31
#define F_USERNUM 32
#define F_READRAND 33
#define F_WRITERAND 34
#define F_SIZE 35
#define F_RANDREC 36
#define DRV_RESET 37
#define F_WRITEZF 40
struct BDOSCALL {
unsigned char func8;
unsigned int parm16;
};
unsigned char cpmbdos(struct BDOSCALL *p);
struct FCB {
unsigned char drive;
char filename[8];
char filetype[3];
unsigned char ex;
unsigned char s1;
unsigned char s2;
unsigned char rc;
unsigned char al[16];
unsigned char cr;
unsigned char r0;
unsigned char r1;
unsigned char r2;
};
struct READSTR {
unsigned char size;
unsigned char len;
char bytes[80];
} rsbuffer;
struct BDOSCALL readstr = { C_READSTR, { (unsigned int)&rsbuffer } };
char * mygets(char *p)
{
memset(rsbuffer.bytes,0,sizeof(rsbuffer.bytes));
rsbuffer.size = sizeof(rsbuffer.bytes);
rsbuffer.len = 0;
cpmbdos(&readstr);
rsbuffer.bytes[rsbuffer.len] = '\n';
strcpy(p,rsbuffer.bytes);
return p;
}
#define gets mygets
/*****************/
/* eof - cpm80.h */
/*****************/

7
branches/wbw/cpurom/inc/cprintf.h

@ -0,0 +1,7 @@
/* cprintf.h */
int cprintf(const char * fmt, ...);
#define printf cprintf

28
branches/wbw/cpurom/inc/diskio.h

@ -0,0 +1,28 @@
/*
* diskio.h
*
*/
__sfr __at (DISKIO_IDE + 0x00) pIDELO;
__sfr __at (DISKIO_IDE + 0x01) pIDEERR;
__sfr __at (DISKIO_IDE + 0x02) pIDESECTC;
__sfr __at (DISKIO_IDE + 0x03) pIDESECTN;
__sfr __at (DISKIO_IDE + 0x04) pIDECYLLO;
__sfr __at (DISKIO_IDE + 0x05) pIDECYLHI;
__sfr __at (DISKIO_IDE + 0x06) pIDEHEAD;
__sfr __at (DISKIO_IDE + 0x07) pIDESTTS;
__sfr __at (DISKIO_IDE + 0x08) pIDEHI;
__sfr __at (DISKIO_IDE + 0x0E) pIDECTRL;
__sfr __at (DISKIO_FLP + 0x06) pFMSR;
__sfr __at (DISKIO_FLP + 0x07) pFDATA;
__sfr __at (DISKIO_FLP + 0x0A) pFLATCH;
__sfr __at (DISKIO_FLP + 0x0C) pFDMA;
/*
*
* eof - diskio.h
*
*/

7
branches/wbw/cpurom/inc/ds1302.h

@ -0,0 +1,7 @@
/*
*
* ds1302 Dallas Real Time Clock module
*
*/

15
branches/wbw/cpurom/inc/i8255.h

@ -0,0 +1,15 @@
/*
* i8255.h Intel 8255
*
*/
void uart_init(U8 baud);
U8 uart_conin(void);
void uart_conout(U8 data);
/*
*
* eof - i8255.h
*
*/

16
branches/wbw/cpurom/inc/jrctypes.h

@ -0,0 +1,16 @@
#ifndef __MYTYPES_H
#define __MYTYPES_H 1
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
#ifdef __SDCC__
#define outp(port,byte) port = (byte)
#define inp(port) (port)
#endif
#define nelem(x) (sizeof(x)/sizeof(x[0]))
#endif /* __MYTYPES_H */

15
branches/wbw/cpurom/inc/ns16550.h

@ -0,0 +1,15 @@
/*
* n16550.h National 16550
*
*/
#define UART_DLAB 0x80
#define UART_BAUD_9600 12
#define UART_RDA 0x01
#define UART_TBE 0x20
/*
*
* eof - n16550.h
*
*/

8
branches/wbw/cpurom/inc/ns16550.inc

@ -0,0 +1,8 @@
; ns16550.inc 8/7/2011 dwg - National 16550
UART_DLAB = 0x80
UART_BAUD_9600 = 12
UART_RDA = 0x01
UART_TBE = 0x20
; eof - ns16550.inc

12
branches/wbw/cpurom/inc/portab.h

@ -0,0 +1,12 @@
/************/
/* portab.h */
/************/
#define TRUE 1
#define FALSE 0
#define U8 unsigned char
/******************/
/* eof - portab.h */
/******************/

52
branches/wbw/cpurom/inc/sbcv2.h

@ -0,0 +1,52 @@
/*
* sbcv2.h - Macros describing the N8VEM SBC V2
*
*/
#define SBCV2
/* set i/o base to first block of 32 addresses
possible are 0x00 0x20 0x40 0x60 0x80 0xA0 0xC0 0xE0
depending oon setting of dip switches on board
*/
#define SBCV2_IO_BASE 0x00
#define UART_IO_BASE ( SBCV2_IO_BASE + 0x68 )
__sfr __at (UART_IO_BASE+0) rUART_RBR;
__sfr __at (UART_IO_BASE+0) wUART_THR;
__sfr __at (UART_IO_BASE+0) wUART_DIV_LO;
__sfr __at (UART_IO_BASE+1) wUART_DIV_HI;
__sfr __at (UART_IO_BASE+1) wUART_IER;
__sfr __at (UART_IO_BASE+2) rUART_IIR;
__sfr __at (UART_IO_BASE+3) wUART_LCR;
__sfr __at (UART_IO_BASE+4) wUART_MCR;
__sfr __at (UART_IO_BASE+5) rUART_LSR;
__sfr __at (UART_IO_BASE+6) rUART_MSR;
__sfr __at (UART_IO_BASE+7) wUART_FCR;
#define DISKIO_IDE 0x20
#define DISKIO_FLP 0x30
#define PPORT 0x60
#define MPCL 0x70
__sfr __at (MPCL + 0x08) pMPCL_RAM;
__sfr __at (MPCL + 0x0c) pMPCL_ROM;
#define RAMTARG_CPM 0x2000
#define ROMSTART_CPM 0x0000
#define CCPSIZ_CPM 0x2000
#define LOADER_ORG 0x0000
#define CPM_ORG 0x0A00
#define MON_ORG 0x3800
#define ROM_G 0x5000
#define ROM_F 0x8000
/*
#define VDU_DRV 0xF8100
*/

47
branches/wbw/cpurom/inc/scsi2ide.h

@ -0,0 +1,47 @@
/*
*
* scsi2ide.h - Macros describing the N8VEM SCSI2IDE
* Friday July 29, 2011 Douglas W. Goodall
*
*/
#define SCSI2IDE
/* set i/o base to first block of 32 addresses
possible are 0x00 0x20 0x40 0x60 0x80 0xA0 0xC0 0xE0
depending oon setting of dip switches on board
*/
#define SCSI2IDE_IO_BASE 0x00
#define IDE_IO_BASE ( SCSI2IDE_IO_BASE + 0 )
#define SCSI_IO_BASE ( SCSI2IDE_IO_BASE + 8 )
#define UART_IO_BASE ( SCSI2IDE_IO_BASE + 16 )
#define DACK_IO_BASE ( SCSI2IDE_IO_BASE + 24 )
__sfr __at (UART_IO_BASE+0) rUART_RDR;
__sfr __at (UART_IO_BASE+0) wUART_TDR;
__sfr __at (UART_IO_BASE+0) wUART_DIV_LO;
__sfr __at (UART_IO_BASE+1) wUART_DIV_HI;
__sfr __at (UART_IO_BASE+1) wUART_IER;
__sfr __at (UART_IO_BASE+2) rUART_IIR;
__sfr __at (UART_IO_BASE+3) wUART_LCR;
__sfr __at (UART_IO_BASE+4) wUART_MCR;
__sfr __at (UART_IO_BASE+5) rUART_LSR;
__sfr __at (UART_IO_BASE+6) rUART_MSR;
__sfr __at (UART_IO_BASE+7) wUART_FCR;
__sfr __at (SCSI_IO_BASE+0) rSCSI_CSCSID;
__sfr __at (SCSI_IO_BASE+0) wSCSI_OD;
__sfr __at (SCSI_IO_BASE+1) rwSCSI_IC;
__sfr __at (SCSI_IO_BASE+2) rwSCSI_M;
__sfr __at (SCSI_IO_BASE+3) rwSCSI_TC;
__sfr __at (SCSI_IO_BASE+4) rSCSI_CSCSIBS;
__sfr __at (SCSI_IO_BASE+4) wSCSI_SE;
__sfr __at (SCSI_IO_BASE+5) rSCSI_BS;
__sfr __at (SCSI_IO_BASE+5) wSCSI_SDMAS;
__sfr __at (SCSI_IO_BASE+6) rSCSI_ID;
__sfr __at (SCSI_IO_BASE+6) wSCSI_SDMATR;
__sfr __at (SCSI_IO_BASE+7) rSCSI_RPI;
__sfr __at (SCSI_IO_BASE+7) wSCSI_SDMAIR;

20
branches/wbw/cpurom/inc/scsi2ide.inc

@ -0,0 +1,20 @@
; scsi2ide.inc 8/7/2011 dwg - macros describing the N8VEM SCSI2IDE
SCSI2IDE_IO_BASE = 0
UART_IO_BASE = SCSI2IDE_IO_BASE+16
rUART_RDR = UART_IO_BASE + 0
wUART_TDR = UART_IO_BASE + 0
wUART_DIV_LO = UART_IO_BASE + 0
wUART_DIV_HI = UART_IO_BASE + 1
wUART_IER = UART_IO_BASE + 1
rUART_IIR = UART_IO_BASE + 2
wUART_LCR = UART_IO_BASE + 3
wUART_MCR = UART_IO_BASE + 4
rUART_LSR = UART_IO_BASE + 5
rUART_MSR = UART_IO_BASE + 6
wUART_FCR = UART_IO_BASE + 7
; eof - scsi2ide.inc

24
branches/wbw/cpurom/inc/z53c80.h

@ -0,0 +1,24 @@
/*
* z53c80.h Zilog Z53C8003VSC
*
*/
/*
__sfr __at (UART + 0) pPORTA;
__sfr __at (UART + 1) pPORTB;
__sfr __at (UART + 2) pPORTC;
__sfr __at (UART + 3) pCNTRL;
*/
void scsi_init(void);
/*
U8 uart_conin(void);
void uart_conout(U8 data);
*/
/*
*
* eof - z53c80.h
*
*/

3
branches/wbw/cpurom/makeclean.bat

@ -0,0 +1,3 @@
wmake -f makefile.xp clean
rem wmake -f makefile.xp
dir rom

3
branches/wbw/cpurom/makecpurom.bat

@ -0,0 +1,3 @@
wmake -f makefile.xp clean
wmake -f makefile.xp etools rom\scsiscrm.rom
dir rom

646
branches/wbw/cpurom/makefile.xp

@ -0,0 +1,646 @@
########################################################
# Makefile for Doug's Unified BIOS 1/28/2013 #
# The BIOS and associated utilities are generated #
# using the Small Device C Compiler (SDCC) & tools #
# With multiplatform enhancements by John Coffman #
# #
# sdcc.l00 added because stupid Windoze 'echo' appends #
# a confusing SPACE to the end of every line. #
########################################################
#####################################################
# SPREFIX tells where the SDCC package in installed #
# The SDCC package is used to assemble Z80 portions #
# of the software such as the ROM and perhaps some #
# .COM files such as FDISK. #
#####################################################
#################################################################
# TPREFIX tells where the host development tools are installed. #
# The host tools are used to manipulate the Z80 objects after #
# the basic assemblies and compilations have been completed. #
#################################################################
###################################################################
# SDCC is not available on the DOS host, so something else may be #
# used at the descretion of the builder. (TASM for instance). #
###################################################################
###################################################################
# The COPY, DEL and RENAME macros are used to customize the build #
# rules for the host enviroonment. #
###################################################################
#-------------------------------------------
# Choose one only, then Make will work for
# your platform.
#CFG = $(shell uname)
# Mac OS X returns 'Darwin'
# Linux returns 'Linux'
#CFG = dos
#CFG = linux
#CFG = macosx
CFG = windows
#-------------------------------------------
DELIM = \
SDRIVE = C:
SPREFIX = $(SDRIVE)\Program Files\sdcc
#SDAS = $(SPREFIX)\bin\sdasz80
SDAS = sdasz80
SDASFLG = -plosff -Iinc
#SDCC = $(SPREFIX)\bin\sdcc
SDCC = sdcc
SDCCFLG = -c -mz80 -D__SDCC__=1 -I inc
SDCCLIB = $(SPREFIX)\lib\z80
#SDLD = $(SPREFIX)\bin\sdldz80
SDLD = sdldz80
SDLDFLG =
TPREFIX =
TCC = gcc
TCCOPT = -I inc
COPY = copy
DEL = erase
DELFLG = /Q
REN = rename
# This is special handling for John Coffman to get around funky windows
# behavior where echo adds spurious space o end f line
# ECHO = { lecho | lechocr | lecholf | lechocrlf | lecholfcr }
#ECHO = $(BIN)$(DELIM)lechocr
ECHO = $(BIN)lecholf
EXE = .exe
#-------------------------------------------
############################################################
# Misc other macros
BIN = bin$(DELIM)
COM = com$(DELIM)
INC = inc$(DELIM)
LIB = lib$(DELIM)
LST = lst$(DELIM)
MAP = map$(DELIM)
OBJ = obj$(DELIM)
REF = ref$(DELIM)
ROM = rom$(DELIM)
SRC = src$(DELIM)
TMP = tmp$(DELIM)
# CP/M-80 v2.2 Command files written in SDCC
COMFILES = $(COM)copyfile.com $(COM)fdisk.com
# Components used by CP/M-80 v2.2 Command files
COMRELS = $(OBJ)cpm0.rel $(OBJ)cpmbdos.rel $(OBJ)cprintf.rel
# Components of ROM image containing CP/M for SBC V2
CPMRELS = $(OBJ)crt0.rel $(OBJ)dbgmon.rel $(OBJ)bdosb01.rel $(OBJ)ccpb03.rel $(OBJ)cbios.rel
# Components of ROM image used in test protocols
ROMRELS = $(OBJ)crt0jplp.rel $(OBJ)crt0scrm.rel
# Components that control hardware in SBC V2
SBCV2HW =
# Components that control hardware in the SCSI2IDE
SCSI2IDEHW = $(OBJ)z53c80.rel
FDISK = $(BIN)fdisk$(EXE)
DWGH2B = $(BIN)dwgh2b$(EXE)
INCFILES = $(INC)cpmbdos.h $(INC)cprintf.h $(INC)portab.h
JRCH2B = $(BIN)jrch2b$(EXE)
LOAD = $(BIN)load$(EXE)
MK = Makefile
#QUIET = @
# ROM images for SBC V2 and N8
ROMFILES = $(ROM)scsiscrm.rom $(ROM)scsijplp.rom $(ROM)n8.rom $(ROM)baseline.rom $(ROM)n8.rom
SCSI2IDE = $(ROM)scsi2ide.rom
SYSGEN = $(BIN)sysgen$(EXE)
VERIFY = $(BIN)verify$(EXE)
# C programs compiled on host system used in build
TOOLS = $(FDISK) $(DWGH2B) $(LOAD) $(JRCH2B) $(SYSGEN)
# Versions of 'echo' compiled on host system
ETOOLS = $(BIN)lechocr.exe $(BIN)lecholf.exe $(BIN)lechocrlf.exe $(BIN)lecholfcr.exe
# dribdos.rel is not part of the production set yet
##TEST = dribdos.rel
############################################################
all: $(ETOOLS) $(TOOLS) $(BINFILES) $(COMFILES) $(CPMFILES) $(ROMFILES)
#all: $(TEST) $(ROMFILES) $(COMFILES)
etools: $(ETOOLS)
roms: $(ROMFILES)
scsi2ide: $(SCSI2IDE)
############################################################
# A test assembly of DRI source code for BDOS (from SIMH)
dribdos.rel: $(SRC)dribdos.s
$(QUIET)$(SDAS) $(SDASFLG) dribdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dribdos.lst $(LST)
############################################################
############################################################
# Build SCSIJPLP ROM image
$(ROM)scsijplp.rom: $(OBJ)scsijplp.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.bin $(ROM)scsijplp.rom
$(QUIET)$(DEL) $(DELFLG) scsijplp.*
$(OBJ)scsijplp.bin: $(OBJ)scsijplp.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsijplp
$(OBJ)scsijplp.hex: $(OBJ)scsijplp.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsijplp.ihx $(OBJ)scsijplp.hex
$(OBJ)scsijplp.ihx: $(OBJ)crt0jplp.rel $(TMP)scsijplp.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lk
$(QUIET)$(COPY) $(TMP)scsijplp.arf $(TMP)scsijplp.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsijplp.lnk
$(QUIET)$(COPY) $(COPYFLG) scsijplp.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsijplp.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsijplp.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsijplp.arf
$(ECHO) -i scsijplp.ihx >> $(TMP)scsijplp.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsijplp.arf
$(ECHO) -l z80 >> $(TMP)scsijplp.arf
$(ECHO) $(OBJ)crt0jplp.rel >> $(TMP)scsijplp.arf
$(ECHO) -e >> $(TMP)scsijplp.arf
############################################################
############################################################
############################################################
############################################################
# Build SCSISCRM ROM image
$(ROM)scsiscrm.rom: $(OBJ)scsiscrm.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.bin $(ROM)scsiscrm.rom
$(QUIET)$(DEL) $(DELFLG) scsiscrm.*
$(OBJ)scsiscrm.bin: $(OBJ)scsiscrm.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsiscrm
$(OBJ)scsiscrm.hex: $(OBJ)scsiscrm.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsiscrm.ihx $(OBJ)scsiscrm.hex
$(OBJ)scsiscrm.ihx: $(OBJ)crt0scrm.rel $(TMP)scsiscrm.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lk
$(QUIET)$(COPY) $(TMP)scsiscrm.arf $(TMP)scsiscrm.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsiscrm.lnk
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsiscrm.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsiscrm #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsiscrm.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsiscrm.arf
$(ECHO) -i scsiscrm.ihx >> $(TMP)scsiscrm.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsiscrm.arf
$(ECHO) -l z80 >> $(TMP)scsiscrm.arf
$(ECHO) $(OBJ)crt0scrm.rel >> $(TMP)scsiscrm.arf
$(ECHO) -e >> $(TMP)scsiscrm.arf
############################################################
############################################################
############################################################
############################################################
# Build SCSI2IDE ROM image
$(ROM)scsi2ide.rom: $(OBJ)scsi2ide.bin $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.bin $(ROM)scsi2ide.rom
$(QUIET)$(DEL) $(DELFLG) scsi2ide.*
$(OBJ)scsi2ide.bin: $(OBJ)scsi2ide.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)scsi2ide
$(OBJ)scsi2ide.hex: $(OBJ)scsi2ide.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)scsi2ide.ihx $(OBJ)scsi2ide.hex
$(OBJ)scsi2ide.ihx: $(CPMRELS) $(SCSI2IDEHW) $(OBJ)scsi2ide.rel $(TMP)scsi2ide.arf $(MK)
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lk
$(QUIET)$(COPY) $(TMP)scsi2ide.arf $(TMP)scsi2ide.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)scsi2ide.lnk
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.map $(MAP)
#########################################################
# Dynamically generate linker control file for scsi2ide #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)scsi2ide.arf: $(MK)
$(ECHO) -mjx > $(TMP)scsi2ide.arf
$(ECHO) -i scsi2ide.ihx >> $(TMP)scsi2ide.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)scsi2ide.arf
$(ECHO) -l z80 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _CBIOS = 0xE600 >> $(TMP)scsi2ide.arf
# $(ECHO) -b _DBGMON = 0x8000 >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)scsi2ide.arf
$(ECHO) $(OBJ)scsi2ide.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)dbgmon.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)ccpb03.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)bdosb01.rel >> $(TMP)scsi2ide.arf
# $(ECHO) $(OBJ)cbios.rel >> $(TMP)scsi2ide.arf
$(ECHO) -e >> $(TMP)scsi2ide.arf
########################################################
# Compile C portion of the scsi2ide EEPROM Image
$(OBJ)scsi2ide.rel: $(SRC)scsi2ide.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)scsi2ide.c
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) scsi2ide.lst $(LST)
############################################################
############################################################
# Build SBC V2 ROM image
$(ROM)baseline.rom: $(OBJ)baseline.bin $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.bin $(ROM)baseline.rom
$(QUIET)$(DEL) $(DELFLG) baseline.*
$(OBJ)baseline.bin: $(OBJ)baseline.hex $(DWGH2B) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)baseline
$(OBJ)baseline.hex: $(OBJ)baseline.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)baseline.ihx $(OBJ)baseline.hex
$(OBJ)baseline.ihx: $(CPMRELS) $(SBCV2HW) $(OBJ)baseline.rel $(TMP)baseline.arf $(MK)
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lk
$(QUIET)$(COPY) $(TMP)baseline.arf $(TMP)baseline.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)baseline.lnk
$(QUIET)$(COPY) $(COPYFLG) baseline.ihx $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.map $(MAP)
#########################################################
# Dynamically generate linker control file for baseline #
# (now uses the macro controlled ECHO feature #
#########################################################
$(TMP)baseline.arf: $(MK)
$(ECHO) -mjx > $(TMP)baseline.arf
$(ECHO) -i baseline.ihx >> $(TMP)baseline.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)baseline.arf
$(ECHO) -l z80 >> $(TMP)baseline.arf
$(ECHO) -b _CCPB03 = 0xD000 >> $(TMP)baseline.arf
$(ECHO) -b _BDOSB01 = 0xD800 >> $(TMP)baseline.arf
$(ECHO) -b _CBIOS = 0xE600 >> $(TMP)baseline.arf
$(ECHO) -b _DBGMON = 0x8000 >> $(TMP)baseline.arf
$(ECHO) $(OBJ)crt0.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)baseline.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)baseline.arf
$(ECHO) $(OBJ)cbios.rel >> $(TMP)baseline.arf
$(ECHO) -e >> $(TMP)baseline.arf
########################################################
# Compile C portion of the Baseline PROM Image
$(OBJ)baseline.rel: $(SRC)baseline.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) -c $(SRC)baseline.c
$(QUIET)$(COPY) $(COPYFLG) baseline.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) baseline.lst $(LST)
############################################################
# Build N8 ROM image
#
# Save the resulting merged image in the Rom folder
#
$(ROM)n8.rom: $(OBJ)n8-romim.bin $(MK)
$(QUIET)$(COPY) $(OBJ)n8-romim.bin $(ROM)n8.rom
$(QUIET)$(DEL) $(DELFLG) n8.*
#
# Convert the Intel hex file into a binary, similar
# to the results of the "copy /B ..."
#
$(OBJ)n8-romim.bin: $(OBJ)sysimage.hex $(REF)n8-romim.ref $(SYSGEN) $(HEX2BIN) $(MK)
$(QUIET)$(DWGH2B) $(OBJ)sysimage
$(QUIET)$(COPY) $(REF)n8-romim.ref $(OBJ)n8-romim.bin
$(QUIET)$(SYSGEN) -i $(OBJ)sysimage.bin $(OBJ)n8-romim.bin
#
# Take the output of the linker and rename to the more
# recognizable .hex form and the expected name "sysimage.hex"
#
$(OBJ)sysimage.hex: $(OBJ)n8.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)n8.ihx $(OBJ)sysimage.hex
#
# Combine the independently assembled components into one piece
# and output Intel hex file (ihx)
#
$(OBJ)n8.ihx: $(OBJ)loadern8.rel $(OBJ)dbgmon.rel $(OBJ)ccpb03.rel $(OBJ)bdosb01.rel $(OBJ)cbiosn8.rel $(TMP)n8.arf $(MK)
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lk
$(QUIET)$(COPY) $(TMP)n8.arf $(TMP)n8.lnk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)n8.lnk
$(QUIET)$(COPY) $(COPYFLG) n8.ihx $(OBJ)n8.ihx
$(QUIET)$(COPY) $(COPYFLG) n8.map $(MAP)
$(OBJ)cbiosn8.rel: $(SRC)cbiosn8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbiosn8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbiosn8.lst $(LST)
$(OBJ)loadern8.rel: $(SRC)loadern8.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)loadern8.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)loadern8.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)loadern8.lst $(LST)
########################################################
# Dynamically generate the linker control file for N8 #
# Now uses the macro controlled ECHO feature #
########################################################
$(TMP)n8.arf: Makefile
$(ECHO) -mjx > $(TMP)n8.arf
$(ECHO) -i n8.ihx >> $(TMP)n8.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)n8.arf
$(ECHO) -l z80 >> $(TMP)n8.arf
$(ECHO) -b _CCPB03 = 0x0900 >> $(TMP)n8.arf
$(ECHO) -b _BDOSB01 = 0x1100 >> $(TMP)n8.arf
$(ECHO) -b _CBIOS = 0x1f00 >> $(TMP)n8.arf
$(ECHO) $(OBJ)loadern8.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)dbgmon.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)ccpb03.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)bdosb01.rel >> $(TMP)n8.arf
$(ECHO) $(OBJ)cbiosn8.rel >> $(TMP)n8.arf
$(ECHO) -e >> $(TMP)n8.arf
############################################################
# Hardware specific assemblies (most likely used by BIOS's)
#
# Assemble hardware control code for the Zilog Z53C8003V5C
#
$(OBJ)z53c80.rel: $(SRC)z53c80.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)z53c80.c
$(QUIET)$(COPY) $(COPYFLG) z53c80.rel $(OBJ)
$(QUIET)$(DEL) $(DELFLG) z53c80.*
#
# Compile ersatz printf routine for use in CP/M-80 command files
#
$(OBJ)cprintf.rel: $(SRC)cprintf.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)cprintf.c
$(QUIET)$(COPY) $(COPYFLG) cprintf.rel obj
$(QUIET)$(DEL) $(DELFLG) cprintf.*
############################################################
# Build CP/M 2.2 command files (copyfile.com, fdisk.com)
#-----------------------------------------------------------
$(COM)copyfile.com: $(OBJ)copyfile.com $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.com $(COM)copyfile.com
$(QUIET)$(DEL) $(DELFLG) copyfile.*
$(OBJ)copyfile.com: $(OBJ)copyfile.hex $(LOAD) $(BINFILES) $(MK)
$(QUIET)$(LOAD) $(OBJ)copyfile
$(OBJ)copyfile.hex: $(OBJ)copyfile.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)copyfile.ihx $(OBJ)copyfile.hex
$(OBJ)copyfile.ihx: $(OBJ)copyfile.rel $(COMRELS) $(TMP)copyfile.arf $(MK)
$(QUIET)$(COPY) $(TMP)copyfile.arf $(TMP)copyfile.lnk
$(QUIET)$(SDLD) $(LOPTS) -nf $(TMP)copyfile.lnk
$(QUIET)$(COPY) $(COPYFLG) copyfile.ihx obj
$(QUIET)$(COPY) $(COPYFLG) copyfile.map map
##############################################################
# Dynamicaly create linker command file for copyfile utility #
# Now uses the macro controlled ECHO feature #
##############################################################
$(TMP)copyfile.arf: Makefile
$(ECHO) -mjx > $(TMP)copyfile.arf
$(ECHO) -i copyfile.ihx >> $(TMP)copyfile.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)copyfile.arf
$(ECHO) -l z80 >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)copyfile.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)copyfile.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)copyfile.arf
$(ECHO) -e >> $(TMP)copyfile.arf
$(OBJ)copyfile.rel: $(SRC)copyfile.c $(MK)
$(QUIET)$(SDCC) $(SDCCFLG) $(SRC)copyfile.c
$(QUIET)$(COPY) copyfile.rel obj
$(QUIET)$(DEL) $(DELFLG) copyfile.rel
# ls obj
#-----------------------------------------------------------
#
# Use locally compiled 'load' command to covert Intel
# hex formal file to a binary CP/M-80 command file.
#
$(COM)fdisk.com: $(OBJ)fdisk.hex $(TOOLS) $(MK)
$(QUIET)$(BIN)load $(OBJ)fdisk
$(QUIET)$(COPY) $(COPYFLG) $(OBJ)fdisk.com com
$(QUIET)$(DEL) $(DELFLG) fdisk.*
#
# rename 'ihx' output of linker to 'hex'
$(OBJ)fdisk.hex: $(OBJ)fdisk.ihx $(MK)
$(QUIET)$(COPY) $(OBJ)fdisk.ihx $(OBJ)fdisk.hex
$(OBJ)fdisk.ihx: $(OBJ)fdisk.rel $(TMP)fdisk.arf $(MK)
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(TMP)fdisk.arf $(TMP)fdisk.lk
$(QUIET)$(SDLD) $(SDLDFLG) -nf $(TMP)fdisk.lnk
$(QUIET)$(COPY) $(COPYFLG) fdisk.ihx $(OBJ)fdisk.ihx
$(QUIET)$(COPY) $(COPYFLG) fdisk.map map
$(OBJ)fdisk.rel: $(SRC)fdisk.c $(INCFILES) $(MK)
$(QUIET)$(SDCC) -I inc $(SDCCFLG) $(SRC)fdisk.c
$(QUIET)$(COPY) $(COPYFLG) fdisk.rel $(OBJ)
############################################################################
# Dynamically created linker command file for fdisk utility (CP/M version) #
# Now uses macro controlled ECHO feature #
############################################################################
$(TMP)fdisk.arf: $(MK)
$(ECHO) -mjx > $(TMP)fdisk.arf
$(ECHO) -i fdisk.ihx >> $(TMP)fdisk.arf
$(ECHO) -k $(SDCCLIB) >> $(TMP)fdisk.arf
$(ECHO) -l z80 >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpm0.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)fdisk.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cpmbdos.rel >> $(TMP)fdisk.arf
$(ECHO) $(OBJ)cprintf.rel >> $(TMP)fdisk.arf
$(ECHO) -e >> $(TMP)fdisk.arf
#-----------------------------------------------------------
# Also build host version of fdisk for testing purposes
$(BIN)fdisk$(EXE): $(SRC)fdisk.c $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)fdisk.c -o $(BIN)fdisk
############################################################
# Build CP/M-80 Command File Structure Files
$(OBJ)cpm0.rel: $(SRC)cpm0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpm0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpm0.lst $(LST)
$(OBJ)cpmbdos.rel: $(SRC)cpmbdos.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cpmbdos.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cpmbdos.lst $(LST)
############################################################
# Build ROM Image structure files
$(OBJ)crt0.rel: $(SRC)crt0.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0.lst $(LST)
$(OBJ)crt0jplp.rel: $(SRC)crt0jplp.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0jplp.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0jplp.lst $(LST)
$(OBJ)crt0scrm.rel: $(SRC)crt0scrm.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)crt0scrm.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)crt0scrm.lst $(LST)
$(OBJ)bdosb01.rel: $(SRC)bdosb01.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)bdosb01.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)bdosb01.lst $(LST)
$(OBJ)ccpb03.rel: $(SRC)ccpb03.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)ccpb03.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)ccpb03.lst $(LST)
#
# Assemble hardware control code for SBC V2
#
$(OBJ)cbios.rel: $(SRC)cbios.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)cbios.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)cbios.lst $(LST)
#
# Assemble a monitor program for the SBC V2
#
$(OBJ)dbgmon.rel: $(SRC)dbgmon.s $(MK)
$(QUIET)$(SDAS) $(SDASFLG) $(SRC)dbgmon.s
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.rel $(OBJ)
$(QUIET)$(COPY) $(COPYFLG) $(SRC)dbgmon.lst $(LST)
###########################################################
# Build host based tools ( dwgh2b, jrch2b, load, verify)
$(DWGH2B): $(SRC)dwgh2b.c $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)dwgh2b.c -o $(BIN)dwgh2b$(EXE)
#
# Compile John Coffman's hex2bin program
#
$(JRCH2B): $(SRC)jrch2b.c $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)jrch2b.c -o $(BIN)jrch2b$(EXE)
# $(QUIET)$(COPY) $(COPYFLG) $(BIN)jrch2b $(BIN)jrcb2h
#
# Compile Doug's "load" program
#
$(LOAD): $(SRC)load.c $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)load.c -o $(BIN)load$(EXE)
$(SYSGEN): $(SRC)sysgen.c $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)sysgen.c -o $(BIN)sysgen$(EXE)
#
# Compile Doug's verif program that compares binary file regions
#
$(VERIFY): $(SRC)verify.c Makefile $(MK)
$(QUIET)$(TCC) $(TCCOPT) $(SRC)verify.c -o $(BIN)verify
$(BIN)lechocr.exe: $(SRC)lechocr.c $(MK)
# $(QUIET)$(TCC) $(TCCOPT) $(SRC)lechocr.c -o $(BIN)lechocr
$(TCC) $(TCCOPT) $(SRC)lechocr.c -o lechocr.exe
$(COPY) lechocr.exe $(BIN)
$(BIN)lecholf.exe: $(SRC)lecholf.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholf.c -o $(BIN)lecholf
$(TCC) $(TCCOPT) $(SRC)lecholf.c -o lecholf.exe
$(COPY) lecholf.exe $(BIN)
$(BIN)lechocrlf.exe: $(SRC)lechocrlf.c $(MK)
# $(QUIET)$(TCC) $(TCCOPT) $(SRC)lechocrlf.c -o $(BIN)lechocrlf
$(TCC) $(TCCOPT) $(SRC)lechocrlf.c -o lechocrlf.exe
$(COPY) lechocrlf.exe $(BIN)
$(BIN)lecholfcr.exe: $(SRC)lecholfcr.c $(MK)
# $(QUIET)$(TCC) $(TCCFLG) $(SRC)lecholfcr.c -o $(BIN)lecholfcr
$(TCC) $(TCCOPT) $(SRC)lecholfcr.c -o lecholfcr.exe
$(COPY) lecholfcr.exe $(BIN)
############################################################
# Builder specific utility rules
dwginstall:
$(COPY) $(COMFILES) ~/Documents/devobox/cdrive
############################################################
#
# Delete all dynamically generated files that don't need to be
# saved.
#
clean:
$(QUIET)$(DEL) $(DELFLG) *.hex *.ihx *.lst *.rel *.rst *.lnk *.lk *.exe
$(QUIET)$(DEL) $(DELFLG) *.sym *.map *.noi *.asm *.com *.ini *.bin
$(QUIET)$(DEL) $(DELFLG) obj$(DELIM)*.* bin$(DELIM)*.* com$(DELIM)*.* rom$(DELIM)*.* tmp$(DELIM)*.* map$(DELIM)*.* lst$(DELIM)*.*
##################
# eof - Makefile #
##################

3
branches/wbw/cpurom/makexp.bat

@ -0,0 +1,3 @@
wmake -f makefile.xp clean
wmake -f makefile.xp
dir rom

BIN
branches/wbw/cpurom/ref/JRC0521.ZIP

Binary file not shown.

2587
branches/wbw/cpurom/ref/bdosb01.asm

File diff suppressed because it is too large

BIN
branches/wbw/cpurom/ref/n8-romim.ref

Binary file not shown.

68
branches/wbw/cpurom/src/baseline.c

@ -0,0 +1,68 @@
/*
* baseline.c - Diagnostic EPROM for the N8VEM SBC V2
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "portab.h"
#include "sbcv2.h"
#include "ns16550.h"
/* #include "cpmbdos.h" */
/* THESE ARE USED BY THE LIBRARY ROUTINES */
char getchar(void)
{
/*
struct BDOSCALL cread = { C_READ, { (unsigned int)0 } };
return cpmbdos(&cread);
*/
return 0;
}
void outchar(char c)
{
if(c) ;
/*
struct BDOSCALL cwrite = { C_WRITE, { (unsigned int)c } };
cpmbdos(&cwrite);
*/
}
void xdisable(void)
{
}
void xenable(void)
{
}
void intmode(U8 xmode)
{
if(xmode);
}
int main(void)
{
pMPCL_ROM = 0x80;
pMPCL_RAM = 0x81;
memcpy(0,0x0E5,0x2000);
pMPCL_ROM = 0x80;
pMPCL_RAM = 0x00;
xdisable();
intmode(1);
pMPCL_ROM = 0x00;
pMPCL_RAM = 0x00;
memcpy(RAMTARG_CPM,ROMSTART_CPM,CCPSIZ_CPM);
pMPCL_ROM = 0x80;
pMPCL_RAM = 0x00;
return (0);
}

2654
branches/wbw/cpurom/src/bdosb01.s

File diff suppressed because it is too large

2733
branches/wbw/cpurom/src/cbios.s

File diff suppressed because it is too large

1708
branches/wbw/cpurom/src/cbiosn8.s

File diff suppressed because it is too large

1345
branches/wbw/cpurom/src/ccpb03.s

File diff suppressed because it is too large

79
branches/wbw/cpurom/src/copyfile.c

@ -0,0 +1,79 @@
/*
* copyfile.c 5/11/2011 dwg -
* Main C module uses cpmbdos.h bindings to access system services
* Copyright (C) Douglas Goodall All Rights Reserved
* For non-commercial use by N8VEM Community
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stdlib.h"
#include "cpmbdos.h"
#include "cprintf.h"
char sine[] = "copyfile.c(com) 5/11/2011 dwg - $";
struct FCB * prifcb = (struct FCB *)0x5c;
struct FCB * secfcb = (struct FCB *)0x6c;
struct FCB srcfcb;
struct FCB dstfcb;
struct BDOSCALL writestr = { C_WRITESTR, { (unsigned int)&sine } };
struct BDOSCALL makedst = { F_MAKE, { (unsigned int)&dstfcb } };
struct BDOSCALL opensrc = { F_OPEN, { (unsigned int)&srcfcb } };
struct BDOSCALL readsrc = { F_READ, { (unsigned int)&srcfcb } };
struct BDOSCALL writedst = { F_WRITE, { (unsigned int)&dstfcb } };
struct BDOSCALL closesrc = { F_CLOSE, { (unsigned int)&srcfcb } };
struct BDOSCALL closedst = { F_CLOSE, { (unsigned int)&dstfcb } };
struct BDOSCALL cwrite = { C_WRITE, { (unsigned int)'?' } };
struct BDOSCALL cread = { C_READ, { (unsigned int)0 } };
/* THESE ARE USED BY THE LIBRARY ROUTINES */
char getchar(void)
{
struct BDOSCALL cread = { C_READ, { (unsigned int)0 } };
return cpmbdos(&cread);
}
void outchar(char c)
{
struct BDOSCALL cwrite = { C_WRITE, { (unsigned int)c } };
cpmbdos(&cwrite);
}
int main(void)
{
int rc;
cpmbdos(&writestr);
strncpy(srcfcb.filename,prifcb->filename,8+3);
srcfcb.ex = srcfcb.rc = srcfcb.cr = 0;
rc = cpmbdos(&opensrc); printf("\nrc from opensrc was %2d, ",rc);
if(rc != 0) {
printf("\nSorry, cannot open source file\n");
return(EXIT_FAILURE);
}
strncpy(dstfcb.filename,secfcb->filename,8+3);
dstfcb.ex = dstfcb.rc = dstfcb.cr = 0;
rc = cpmbdos(&makedst); printf("rc from makedst was %2d",rc);
if(rc != 0) {
printf("\nSorry, cannot open destination file\n");
cpmbdos(&closesrc);
return(EXIT_FAILURE);
}
rc = cpmbdos(&readsrc); printf("\nrc from read was %2d, ",rc);
while(0 == rc) {
rc = cpmbdos(&writedst); printf( "rc from write was %2d", rc);
rc = cpmbdos(&readsrc); printf("\nrc from read was %2d, ",rc);
}
rc = cpmbdos(&closesrc); printf("\nrc from closesrc was %2d, ",rc);
rc = cpmbdos(&closedst); printf( "rc from closedst was %2d", rc);
return EXIT_SUCCESS;
}

46
branches/wbw/cpurom/src/cpm0.s

@ -0,0 +1,46 @@
;--------------------------------------------------------------------------
; cpm0.s - Generic cpm0.s for a Z80 CP/M-80 v2.2 Application
; Copyright (C) 2011, Douglas Goodall All Rights Reserved.
;--------------------------------------------------------------------------
.globl _main
.area _CODE
.ds 0x0100
init:
;; Define an adequate stack
ld sp,#stktop
;; Initialise global variables
call gsinit
;; Call the C main routine
call _main
ld c,#0
call 5
;; Ordering of segments for the linker.
.area _TPA
.area _HOME
.area _CODE
.area _GSINIT
.area _GSFINAL
.area _DATA
.area _STACK
.ds 256
stktop:
.area _GSINIT
gsinit::
.area _GSFINAL
ret
.db 0xe5
;;;;;;;;;;;;;;;;
; eof - cpm0.s ;
;;;;;;;;;;;;;;;;

65
branches/wbw/cpurom/src/cpmbdos.s

@ -0,0 +1,65 @@
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.0.2 #6489 (May 10 2011) (Mac OS X x86_64)
; This file was generated Wed May 11 05:28:20 2011
;--------------------------------------------------------
.module cpmbdos
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _cpmbdos
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; overlayable items in ram
;--------------------------------------------------------
.area _OVERLAY
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;cpmbdos.c:1: unsigned char cpmbdos(void * p)
; ---------------------------------
; Function cpmbdos
; ---------------------------------
_cpmbdos_start::
_cpmbdos:
push ix
ld ix,#0
add ix,sp
;cpmbdos.c:3: return 2;
ld l,4(ix)
ld h,5(ix)
ld c,(hl)
inc hl
ld e,(hl)
inc hl
ld d,(hl)
call 5
pop ix
ret
_cpmbdos_end::
.area _CODE
.area _CABS

267
branches/wbw/cpurom/src/cprintf.c

@ -0,0 +1,267 @@
/* Copyright (C) 1996 Robert de Bath <robert@mayday.compulink.co.uk>
* This file is part of the Linux-8086 C library and is distributed
* under the GNU Library General Public License.
*/
/* Modified 14-Jan-2002 by John Coffman <johninsd@san.rr.com> for inclusion
* in the set of LILO diagnostics. This code is the property of Robert
* de Bath, and is used with his permission.
*/
/* Modified 14-Sep-2010 by John Coffman <johninsd@gmail.com> for use with
* the N8VEM SBC-188 BIOS project.
*/
#include <stdlib.h>
#include <stdarg.h>
#undef printf
#define ASM_CVT 0
#ifndef strlen
int strlen(char *s);
#endif
void outchar(char ch);
#define putch(ch) outchar((char)ch)
#ifndef NULL
# define NULL ((void*)0L)
#endif
#define __fastcall
#define NUMLTH 11
static unsigned char * __fastcall __numout(long i, int base, unsigned char out[]);
int cprintf(const char * fmt, ...)
{
register int c;
int count = 0;
int type, base;
long val;
char * cp;
char padch=' ';
int minsize, maxsize;
unsigned char out[NUMLTH+1];
va_list ap;
va_start(ap, fmt);
while(c=*fmt++)
{
count++;
if(c!='%')
{
if (c=='\n') putch('\r');
putch(c);
}
else
{
type=1;
padch = *fmt;
maxsize=minsize=0;
if(padch == '-') fmt++;
for(;;)
{
c=*fmt++;
if( c<'0' || c>'9' ) break;
minsize*=10; minsize+=c-'0';
}
if( c == '.' )
for(;;)
{
c=*fmt++;
if( c<'0' || c>'9' ) break;
maxsize*=10; maxsize+=c-'0';
}
if( padch == '-' ) minsize = -minsize;
else
if( padch != '0' ) padch=' ';
if( c == 0 ) break;
if(c=='h')
{
c=*fmt++;
type = 0;
}
else if(c=='l')
{
c=*fmt++;
type = 2;
}
switch(c)
{
case 'X':
case 'x': base=16; type |= 4; if(0) {
case 'o': base= 8; type |= 4; } if(0) {
case 'u': base=10; type |= 4; } if(0) {
case 'd': base=-10; }
switch(type)
{
case 0: val=va_arg(ap, short); break;
case 1: val=va_arg(ap, int); break;
case 2: val=va_arg(ap, long); break;
case 4: val=va_arg(ap, unsigned short); break;
case 5: val=va_arg(ap, unsigned int); break;
case 6: val=va_arg(ap, unsigned long); break;
default:val=0; break;
}
cp = __numout(val,base,out);
if(0) {
case 's':
cp=va_arg(ap, char *);
}
count--;
c = strlen(cp);
if( !maxsize ) maxsize = c;
if( minsize > 0 )
{
minsize -= c;
while(minsize>0) { putch(padch); count++; minsize--; }
minsize=0;
}
if( minsize < 0 ) minsize= -minsize-c;
while(*cp && maxsize-->0 )
{
putch(*cp++);
count++;
}
while(minsize>0) { putch(' '); count++; minsize--; }
break;
case 'c':
putch(va_arg(ap, int));
break;
default:
putch(c);
break;
}
}
}
va_end(ap);
return count;
}
const char nstring[]="0123456789ABCDEF";
#if ASM_CVT==0
static unsigned char *
__fastcall
__numout(long i, int base, unsigned char *out)
{
int n;
int flg = 0;
unsigned long val;
if (base<0)
{
base = -base;
if (i<0)
{
flg = 1;
i = -i;
}
}
val = i;
out[NUMLTH] = '\0';
n = NUMLTH-1;
do
{
#if 1
out[n] = nstring[val % base];
val /= base;
--n;
#else
out[n--] = nstring[remLS(val,base)];
val = divLS(val,base);
#endif
}
while(val);
if(flg) out[n--] = '-';
return &out[n+1];
}
#else
#asm
! numout.s
!
#if 0
.data
_nstring:
.ascii "0123456789ABCDEF"
.byte 0
#endif
.bss
___out lcomm $C
.text
___numout:
push bp
mov bp,sp
push di
push si
add sp,*-4
mov byte ptr -8[bp],*$0 ! flg = 0
mov si,4[bp] ; i or val.lo
mov di,6[bp] ; i or val.hi
mov cx,8[bp] ; base
test cx,cx ! base < 0 ?
jge .3num
neg cx ! base = -base
or di,di ! i < 0 ?
jns .5num
mov byte ptr -8[bp],*1 ! flg = 1
neg di ! i = -i
neg si
sbb di,*0
.5num:
.3num:
mov byte ptr [___out+$B],*$0 ! out[11] = nul
mov -6[bp],*$A ! n = 10
.9num:
!!! out[n--] = nstring[val % base];
xor dx,dx
xchg ax,di
div cx
xchg ax,di
xchg ax,si
div cx
xchg ax,si ! val(new) = val / base
mov bx,dx ! dx = val % base
mov al,_nstring[bx]
mov bx,-6[bp]
dec word ptr -6[bp]
mov ___out[bx],al
mov ax,si
or ax,di ! while (val)
jne .9num
cmp byte ptr -8[bp],*$0 ! flg == 0 ?
je .Dnum
mov bx,-6[bp]
dec word ptr -6[bp]
mov byte ptr ___out[bx],*$2D ! out[n--] = minus
.Dnum:
mov ax,-6[bp]
add ax,#___out+1
add sp,*4
pop si
pop di
pop bp
ret
#endasm
#endif

97
branches/wbw/cpurom/src/crt0.s

@ -0,0 +1,97 @@
; modified 4/22/2011 for the N8VEM Home Computer Z180 -- John Coffman
;
;--------------------------------------------------------------------------
; crt0.s - Generic crt0.s for a Z80
;
; Copyright (C) 2000, Michael Hope
;
; This library is free software; you can redistribute it and/or modify it
; under the terms of the GNU General Public License as published by the
; Free Software Foundation; either version 2.1, or (at your option) any
; later version.
;
; This library is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this library; see the file COPYING. If not, write to the
; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
; MA 02110-1301, USA.
;
; As a special exception, if you link this library with other files,
; some of which are compiled with SDCC, to produce an executable,
; this library does not by itself cause the resulting executable to
; be covered by the GNU General Public License. This exception does
; not however invalidate any other reasons why the executable file
; might be covered by the GNU General Public License.
;--------------------------------------------------------------------------
;;; .module crt0
.globl _main
.area _HEADER (ABS)
;; Reset vector
.org 0
jp init
.org 0x08
ret
.org 0x10
ret
.org 0x18
ret
.org 0x20
ret
.org 0x28
ret
.org 0x30
ret
.org 0x38
ret
.org 0x66 ; NMI interrupt
retn
.org 0x100
init:
;; Stack at the top of memory.
ld sp,#0xffff
;; Initialise global variables
call gsinit
call _main
jp _exit
;; Ordering of segments for the linker.
.area _HOME
.area _CODE
.area _GSINIT
.area _GSFINAL
.area _DATA
.area _BSEG
.area _BSS
.area _HEAP
.area _CODE
.if 0
__clock::
ld a,#2
rst 0x08
ret
.endif
_exit::
;; Exit - special code to the emulator
ld a,#0
rst 0x08
1$:
halt
jr 1$
.area _GSINIT
gsinit::
.area _GSFINAL
ret

9
branches/wbw/cpurom/src/crt0jplp.s

@ -0,0 +1,9 @@
;--------------------------------------------------------------------------
; crt0jplp.s 8/7/2011 dwg - - Generic crt0.s for a Z80 with jump loop
;--------------------------------------------------------------------------
.area _HEADER (ABS)
.org 0
jploop: jp jploop

44
branches/wbw/cpurom/src/crt0scrm.s

@ -0,0 +1,44 @@
;--------------------------------------------------------------------------
; crt0scrm.s 8/7/2011 dwg - - Generic crt0.s for a Z80 with jump loop
;--------------------------------------------------------------------------
.area _HEADER (ABS)
.org 0
.include "scsi2ide.inc"
.include "ns16550.inc"
scream:
ld a,#UART_DLAB
out (wUART_LCR),a
ld a,#0x00
out (wUART_DIV_HI),a
ld a,#UART_BAUD_9600
out (wUART_DIV_LO),a
ld a,#0
out (wUART_LCR),a
ld a,#0x03
out (wUART_LCR),a
ld a,#0x03
out (wUART_MCR),a
scrmlp:
in a,(rUART_LSR)
and a,#UART_TBE
jp z,scrmlp
ld a,#0x30 ; ascii 0 (zero)
out (wUART_TDR),a
jp scrmlp

1764
branches/wbw/cpurom/src/dbgmon.s

File diff suppressed because it is too large

128
branches/wbw/cpurom/src/dwgh2b.c

@ -0,0 +1,128 @@
// ---------------------------------------------------
// hex2bin.c 21-May-11 Running on Mac OS X 10.6.6
// S/n 2011-1042-654321 Written by Douglas W. Goodall
// Copyright(c)2011 Douglas W. Goodall, United States.
// ---------------------------------------------------
// This file is part of Vintage Modern Assembler Plus Tools.
//
// VMAPT is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VMAPT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VMAPT. If not, see <http://www.gnu.org/licenses/>.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DATA_RECORD 0x00
#define EOF_RECORD 0x01
int main(int argc,char **argv)
{
char g_szBuffer2[128];
char szByteBuffer[2+1];
char *p;
int i;
int iTemp;
char cColon;
char szLength[2+1];
int iLength;
char szAddress[4+1];
unsigned int uiAddress;
char szRecordType[2+1];
unsigned char ucRecordType;
char szData[80];
unsigned char ucBinBuffer[32+1];
char szChecksum[2+1];
unsigned char ucChecksum;
unsigned int uiLastByte = 0;
if(1 == argc) {
printf("usage - hex2bin <hexfilespec>\n");
exit(EXIT_FAILURE);
}
char szBinFile[255];
char szHexFile[255];
strcpy(szHexFile,argv[1]);
strcpy(szBinFile,argv[1]);
strcat(szBinFile,".bin");
strcat(szHexFile,".hex");
unsigned char memory[0xfff0];
memset(memory,0,sizeof(memory));
FILE * fhex = fopen(szHexFile,"r");
if(NULL == fhex) {
printf("Sorry, cannot open %s for input\n",szHexFile);
exit(EXIT_FAILURE);
}
p = fgets(g_szBuffer2,sizeof(g_szBuffer2),fhex);
while(NULL != p) {
g_szBuffer2[strlen(g_szBuffer2)-1] = 0;
cColon = g_szBuffer2[0];
memset(szLength,0,sizeof(szLength));
memcpy(szLength,&g_szBuffer2[1],2);
sscanf(szLength,"%02X",&iLength);
memset(szAddress,0,sizeof(szAddress));
memcpy(szAddress,&g_szBuffer2[3],4);
sscanf(szAddress,"%04X",&uiAddress);
memset(szRecordType,0,sizeof(szRecordType));
memcpy(szRecordType,&g_szBuffer2[7],2);
sscanf(szRecordType,"%02X",&iTemp);
ucRecordType = (unsigned char)iTemp;
if(0 == ucRecordType) {
memset(szData,0,sizeof(szData));
memcpy(szData,&g_szBuffer2[9],iLength*2);
for(i=0;i<iLength;i++) {
memset(szByteBuffer,0,sizeof(szByteBuffer));
memcpy(szByteBuffer,&g_szBuffer2[1+2+4+2+(i*2)],2);
sscanf(szByteBuffer,"%02X",&iTemp);
ucBinBuffer[i] = iTemp;
memory[uiAddress+i] = (unsigned char)iTemp;
}
}
memset(szChecksum,0,sizeof(szChecksum));
memcpy(szChecksum,&g_szBuffer2[1+2+4+2+(iLength*2)],2);
sscanf(szChecksum,"%02X",&iTemp);
ucChecksum = (unsigned char)iTemp;
if(uiLastByte < uiAddress + iLength) {
uiLastByte = uiAddress + iLength;
}
p = fgets(g_szBuffer2,sizeof(g_szBuffer2),fhex);
}
fclose(fhex);
FILE * fbin = fopen(szBinFile,"w");
fwrite(&memory,1,uiLastByte,fbin);
fclose(fbin);
}

281
branches/wbw/cpurom/src/fdisk.c

@ -0,0 +1,281 @@
/***********************************************************/
/* fdisk.c 5/12/2011 dwg - fdisk in sdcc for cp/m-80 v2.2c */
/* written by douglas w goodall for N8VEM community use */
/***********************************************************/
/*
* This is a first cut at a partition editor for CP/M-80 v2.2c
* and perhaps CP/M-80 v3, for the SBC V1 and V2 and perhaps
* the N8VEM Home Computer.
*
* There were two approaches to this program. Dealing with sector
* numbers or dealing with track numbers. Because of the eight bit
* nature of the processor, dealing with track numbers was much
* better for the code generation. The track numbers can be changed
* back into LBA sector numbers later on if desired.
*
* The only problem I forsee would be if we encountered a partition
* table that already had LBA offsets that were no on track boundaries.
* When I worked at DRI, we adjusted the partitions to start and stop
* on track boundaries. Compatibility with existing drive partitions
* sounds nice but is not my highest priority. /s douglas goodall
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "portab.h"
#ifndef __GNUC__
#include "cpmbdos.h"
#include "cprintf.h"
#endif
/*
* 1MB = 1,048,576 bytes
* 32MB = 1,048,576 * 32 = 33,554,432
*
* physical sector is 512 bytes
* physical track is 256 sectors = 131,072
* physical drive is 33,554,432
* physical tracks are 33,554,432 / 131,072 = 256
* physical tracks per physical drive are 256
*
* logical sector is 128 bytes
* logical track is 256 sectors (aka )
* logical drive is 8192KB (aka 8192KB/32KB = 256 logical tracks)
*
*
* 8,388,608 bytes is a logical drive
* 131,072 bytes is a physical track
* 8,388,608 / 131,072 = 64 physical tracks per logical drive
*
* One byte (0-255) will just hold the number of physical tracks needing
* to be shared amoung up to four logical drives.
*
* physical track 0 - partition sector and second-stage loader if needed
* physical tracks 1 - 64 = 8.0MB partition ( 64 * 131,072 = 8,388,608 )
* physical tracks 65 - 128 = 8.0MB partition ( 64 * 131,072 = 8,388,608 )
* physical tracks 129 - 192 = 8.0MB partition ( 64 * 131,072 = 8,388,608 )
* physical tracks 193 - 255 = 7.9MB partition ( 63 * 131,072 = 8,257,536 )
*
*/
#define MAX_PARTS 4
#define TRKS_PER_PHY_DRV 256
#define TRKS_PER_LOG_DRV 64 /* 256 sectors * 512 = 128k */
#define SAFESTRING 80 /* make large enough to avoid accidental overrun */
#define U8 unsigned char
struct PART_TABLE { /* in-memory instance of partition table */
U8 start; /* starting track of a partition */
U8 end; /* ending track of a partition */
} pt[MAX_PARTS] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
U8 bRunning; /* scratchpad used used by the main loop */
U8 end; /* scratchpad used to hold ending track of a part */
U8 Index; /* scratchpad used as index for for loops */
U8 NumParts; /* scratchpad to hold the current number of parts */
U8 LastEnd; /* scratchpad to hold the last track allocated */
U8 NewEnd; /* scratchpad to hold the proposed ending track */
U8 NewMax; /* scratchpad to hold the proposed max part size */
U8 NewSize; /* scratchpad to hold the decided new part size */
U8 NewStart; /* scratchpad to hold the decided starting track */
U8 start; /* scratchpad to hold the starting track of a part */
U8 Avail; /* scratchpad to hold the remaining avialable tracks */
char szChoice[SAFESTRING]; /* string used to receive keystrokes */
char szTemp[SAFESTRING]; /* string used for general purposes */
/* THESE ARE USED BY THE LIBRARY ROUTINES */
#ifndef __GNUC__
char getchar(void)
{
struct BDOSCALL cread = { C_READ, { (unsigned int)0 } };
return cpmbdos(&cread);
}
void outchar(char c)
{
struct BDOSCALL cwrite = { C_WRITE, { (unsigned int)c } };
cpmbdos(&cwrite);
}
#endif
void display_menu(void)
{
if(NumParts < MAX_PARTS) {
if(0 < Avail) {
printf("a - add partition #%d\n",NumParts+1);
}
}
if(0 < NumParts) {
printf("d - delete partition #%d\n",NumParts);
}
if(1 < NumParts) {
printf("D - delete all partitions, 1 - %d\n",NumParts);
}
if(0 == NumParts) {
printf("A - create all 8MB partitions\n");
}
printf("q - quit fdisk\n\n");
}
char query(char *str)
{
printf("%s",str);
gets(szTemp);
if('Y' == szTemp[0]) {
return TRUE;
} else {
return FALSE;
}
}
void delete(void)
{
if(0 < NumParts) {
if(TRUE == query("Delete partition(Y/n)?")) {
pt[NumParts-1].start = 0;
pt[NumParts-1].end = 0;
}
}
}
void deleteall(void)
{
if(0 < NumParts) {
if(TRUE == query("Delete all partitions(Y/n)?")) {
for(Index=0;Index<MAX_PARTS;Index++) {
pt[Index].start = 0;
pt[Index].end = 0;
}
}
}
}
U8 request(char *szPrompt)
{
printf("%s",szPrompt);
gets(szTemp);
return(atoi(szTemp));
}
U8 request2(char *szPrompt,U8 Default)
{
printf(szPrompt,Default);
gets(szTemp);
#ifdef __GNUC__
if(0 == strlen(szTemp)) return(Default);
#else
if(1 == strlen(szTemp)) return(Default);
#endif
return(atoi(szTemp));
}
U8 smaller(U8 a,U8 b)
{
if(a<b) return a;
else return b;
}
void all(void)
{
Avail = TRKS_PER_PHY_DRV-1;
LastEnd = 0;
for(Index=0;Index<MAX_PARTS;Index++) {
if(0 < Avail) {
NewStart = LastEnd + 1;
NewSize = smaller(Avail,TRKS_PER_LOG_DRV);
NewEnd = NewStart + NewSize - 1;
pt[Index].start = NewStart;
pt[Index].end = NewEnd;
LastEnd = NewEnd;
Avail -= NewSize;
}
}
}
void add(void)
{
NewStart = LastEnd + 1;
NewMax = smaller(TRKS_PER_LOG_DRV,Avail);
NewSize = request2("Number of Tracks (Max %d)? ",NewMax);
pt[NumParts].start = LastEnd+1;
pt[NumParts].end = NewStart + NewSize - 1;
}
void view(void)
{
NumParts = 0;
LastEnd = 0;
for(Index=0;Index<MAX_PARTS;Index++) {
start = pt[Index].start;
end = pt[Index].end;
if(0 < (start) ) {
NumParts++;
LastEnd = end;
}
}
Avail = TRKS_PER_PHY_DRV - LastEnd - 1;
printf("N8VEM Partition Editor by Douglas Goodall\n\n");
printf(" Available tracks are %d\n\n",Avail);
NumParts = 0;
for(Index=0;Index<MAX_PARTS;Index++) {
start = pt[Index].start;
end = pt[Index].end;
if(0 != end) {
printf("Part#%d ",Index+1);
printf("Start %6d (0x%05X), ",start,start);
printf("End %6d (0X%05X) ",end,end);
printf("Size %6d (0x%05X) ", end-start+1,end-start+1);
printf("\n");
NumParts++;
}
}
printf("\n");
}
int main()
{
/* FILE * fd = fopen("parttabl.bin","r");
if(NULL != fd) {
fread(&pt,1,sizeof(pt),fd);
fclose(fd);
} else {
memset(&pt,0,(int)sizeof(pt));
}
*/
bRunning = 1;
while(1 == bRunning) {
view();
display_menu();
gets(szChoice);
switch(szChoice[0]) {
case 'a': add(); break;
case 'd': delete(); break;
case 'D': deleteall(); break;
case 'q': bRunning = 0; break;
case 'A': all(); break;
}
}
/*
FILE * fd2 = fopen("parttabl.bin","w");
fwrite(&pt,1,sizeof(pt),fd2);
fclose(fd2);
*/
return (EXIT_SUCCESS);
}

528
branches/wbw/cpurom/src/jrch2b.c

@ -0,0 +1,528 @@
/* hex2bin.c -- yet another reader and writer of Intel hex files
Copyright (C) 2011 John R Coffman <johninsd@gmail.com>.
***********************************************************************
When invoked as 'hex2bin' read a sequence of Intel hex files
and create an overlaid binary file.
When invoked as 'bin2hex' read a binary file and create an
Intel hex file.
All command line numeric constants may be specified in any
radix.
***********************************************************************
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
in the file COPYING in the distribution directory along with this
program. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "jrctypes.h"
#define true 1
#define false 0
#define SEG_MASK 0x00FFFFu
#define LBA_MASK 0x00FF0000ul
#define MAX_MASK (LBA_MASK|SEG_MASK)
#define ONE_MEG 0x100000ul
dword upper_lba = 0; /* upper address */
dword address_mask = SEG_MASK; /* address mask */
byte pad = 0xFF;
byte *buffer;
dword rom_size = 0;
dword overwrite; /* count of possible overwrites */
byte h2b, verbose;
char *outfilename = NULL;
char *binfilename = NULL;
dword source_address, source_limit;
dword dest_address, dest_limit;
FILE *infile;
FILE *outfile;
byte checksum;
char line[1024];
char *lp;
long int lineno;
dword convert_constant(char *str)
{
char *final;
dword value = strtoul(str, &final, 0);
if (*final == 'k' || *final == 'K') value *= 1024ul;
else if (*final == 'M' || *final == 'm') value *= ONE_MEG;
return value;
}
void error(byte level, char *msg)
{
printf("%s(%d): %s\n",
level>1 ? "Error" : "Warning", (int)level, msg);
if (level>1) exit(level);
else if (level==0) printf("line %ld %s", lineno, line);
}
int getnibble(void)
{
char ch;
if (lp) {
ch = *lp++;
if (ch>='0' && ch<='9') ch -= '0';
else if (ch>='A' && ch<='F') ch -= 'A'-10;
else if (ch>='a' && ch<='f') ch -= 'a'-10;
else {
error(0,"Illegal hex digit");
ch = -1;
}
}
else error(0,"Line is too short");
return (int)ch;
}
int getbyte(void)
{
int b = getnibble();
b <<= 4;
b += getnibble();
checksum += b;
return b;
}
int getword(void)
{
int w = getbyte();
w <<= 8;
w += getbyte();
return w;
}
dword getdword(void)
{
dword d = getword();
d <<= 16;
d += getword();
return d;
}
void putbyte(dword address, byte data)
{
if (address < source_address || address > source_limit) return;
address -= source_address;
address += dest_address;
if (address > dest_limit) return;
if (address >= rom_size) {
printf("Line %ld ",lineno); error(2,"Data beyond end of ROM");
}
if (buffer[address] != pad) {
overwrite++;
if (verbose || overwrite<=100) printf("Warning(1): Overwrite at ROM address 0x%lX\n", address);
}
buffer[address] = data;
}
void usage(void)
{
printf("hex2bin.c (bin2hex) -- " __DATE__ " " __TIME__ ".\n"
"Copyright (c) 2011 John R Coffman. All rights reserved.\n"
"Distributed under the GNU General Public License, a copy of which\n"
"is contained in the file COPYING in the distribution directory.\n\n");
if (h2b) printf(
"Usage:\n"
" hex2bin <options> [<flags> <filename>]+\n\n"
" Options:\n"
" -o <output filename>\n"
" -p <pad byte>\n"
" -R <ROM size> default 64K\n"
" -v [<verbosity level>]\n"
" Flags:\n"
" -d <destination address in BIN file>\n"
" -D <destination limit in BIN file>\n"
" -s <source address in HEX file>\n"
" -S <source limit in HEX file>\n"
);
else printf(
"Usage:\n"
" bin2hex <options> [<flags> <filename>]+\n\n"
" Options:\n"
" -o <output filename>\n"
" -p <pad byte>\n"
" -R <ROM size> default 1024K\n"
" -v [<verbosity level>]\n"
" Flags:\n"
" -d <destination address in HEX file>\n"
" -D <destination limit in HEX file>\n"
" -s <source address in BIN file>\n"
" -S <source limit in BIN file>\n"
);
}
void hout_byte(byte data)
{
checksum -= data;
fprintf(outfile, "%02X", (int)data);
}
void hout_word(word data)
{
hout_byte(data>>8);
hout_byte(data);
}
void begin_record(byte length)
{
checksum = 0;
fputc(':', outfile);
hout_byte(length);
}
void end_record(void)
{
hout_byte(checksum);
fputc('\n', outfile);
}
void write_lba(dword address)
{
if (verbose==5) printf("Address: %06lX\n", address);
if ((address & LBA_MASK) != upper_lba) {
upper_lba = address & LBA_MASK;
begin_record(2);
hout_word(0);
if (rom_size > ONE_MEG) {
hout_byte(4); /* linear address */
hout_word(upper_lba>>16);
}
else { /* handle ROMs 1meg and smaller */
hout_byte(2); /* segment address */
hout_word(upper_lba>>4);
}
end_record();
}
}
void write_data(word nbytes, byte *buf, dword address)
{
/* compress from the high end */
while (nbytes && buf[nbytes-1]==pad) --nbytes;
/* compress from the low end */
while (nbytes && *buf==pad) {
++buf;
++address;
--nbytes;
}
if (nbytes) {
write_lba(address);
begin_record(nbytes);
hout_word(address & 0xFFFFu);
hout_byte(0); /* data record */
while(nbytes--) hout_byte(*buf++);
end_record();
}
}
#define min(a,b) ((a)<(b)?(a):(b))
#define NREC 16
void write_hex_file(FILE *outfile)
{
dword nbytes;
dword vaddr;
dword n;
byte *buf;
buf = buffer;
vaddr = 0;
nbytes = rom_size;
n = min(nbytes, NREC);
do {
write_data(n, buf, vaddr);
buf += n;
vaddr += n;
nbytes -= n;
n = min(nbytes, NREC);
} while (n);
/* write the end-of-file record */
fprintf(outfile,":00000001FF\n");
}
void scan_bin_file(char *filename)
{
dword length;
dword nbytes;
int data;
dword inaddr;
infile = fopen(filename, "rb");
if (!infile) {
strcpy(line,"Cannot find file: ");
error(5, strcat(line, filename));
}
fseek(infile,0L,SEEK_END);
length = ftell(infile);
// length = filelength(fileno(infile));
nbytes = 0;
inaddr = dest_address;
if (source_address < length) {
fseek(infile, source_address, SEEK_SET);
while (inaddr<rom_size && inaddr<=dest_limit) {
data = fgetc(infile);
if (data == EOF) break;
buffer[inaddr++] = data;
}
}
fclose(infile);
}
void scan_hex_file(char *filename)
{
byte ldata;
dword laddr;
byte rectype;
dword value;
dword index;
byte data;
byte EndOfFile = 0;
infile = fopen(filename, "rt");
if (!infile) {
strcpy(line,"Cannot find file: ");
error(5, strcat(line, filename));
}
lineno = 0;
do {
lineno++;
lp = fgets(line, nelem(line)-1, infile);
if (lp == NULL) break;
if (*lp++ != ':') {
printf("Comment: %s",--lp);
continue;
}
if (verbose>=3) printf("%s", lp-1);
checksum = 0;
ldata = getbyte();
laddr = getword();
rectype = getbyte();
switch (rectype) {
case 0: /* data record */
index = 0;
while (ldata--) {
data = getbyte();
putbyte(upper_lba + ((laddr + index)&address_mask), data);
index++;
}
break;
case 1: /* end of file record */
EndOfFile = 1;
break;
case 2: /* segment address */
address_mask = SEG_MASK;
value = getword();
upper_lba = value<<4; /* start of segment */
ldata -= 2;
break;
case 4: /* linear upper address */
address_mask = MAX_MASK;
value = getword();
upper_lba = value<<16; /* full 32-bit address range */
ldata -= 2;
break;
case 3: /* start CS:IP */
case 5: /* linear start address */
value = getdword();
ldata -= 4;
default:
error(0,"Unknown record type:");
}
getbyte(); /* get final checksum */
if (checksum) {
error(0,"Checksum failure");
}
} while (lp && !EndOfFile);
fclose(infile);
}
void global_options(int argc, char *argv[])
{
int iarg;
char *cp;
char *tp;
char ch;
h2b = false;
rom_size = ONE_MEG; /* bin2hex default value */
/* decide which conversion to do */
if (strstr(argv[0],"hex2bin")
#ifdef MSDOS
|| strstr(argv[0],"HEX2BIN")
#endif
) {
h2b = true;
rom_size = 64 * 1024ul; /* default value */
} /* assume 'bin2hex' otherwise */
if (argc<2) { usage(); exit(0); }
/* scan the global command line options */
for (iarg = 0; iarg<argc; iarg++) {
cp = argv[iarg];
if (*cp == '-'
#ifdef MSDOS
|| *cp == '/'
#endif
) {
ch = cp[1];
tp = cp + 2;
switch (ch) {
case 'h':
usage();
exit(0);
case 'o': /* outfile name specification */
if (!*tp) tp = argv[++iarg];
outfilename = strdup(tp);
*cp = *tp = 0;
break;
case 'p': /* specify the pad byte */
if (!*tp) tp = argv[++iarg];
pad = (byte)convert_constant(tp);
*cp = *tp = 0;
break;
case 'R': /* ROM file size specification */
if (!*tp) tp = argv[++iarg];
rom_size = convert_constant(tp);
if (rom_size > MAX_MASK+1) error(5, "ROM size too big");
if (rom_size < 256) error(5, "ROM size too small");
*cp = *tp = 0;
break;
case 'v': /* print verbose statistics */
verbose++;
if (!*tp) tp = argv[++iarg];
if (*tp>='1' && *tp<='5' && tp[1]==0) verbose += (*tp - '1');
else tp = cp;
*cp = *tp = 0;
break;
case 'Y': {
int i;
for (i=0; i<argc; i++)
printf(" %s", argv[i]);
printf("\n");
exit(0);
}
default:
break;
}
} // if '-'
} // for (iarg ...
}
void process_cmd_input(int argc, char *argv[])
{
int iarg;
char *cp;
char *tp;
source_address = dest_address = 0;
source_limit = dest_limit = MAX_MASK;
for (iarg=1; iarg<argc; iarg++) {
cp = argv[iarg];
if (*cp == '-'
#ifdef MSDOS
|| *cp == '/'
#endif
) {
++cp;
tp = cp + 1;
switch (*cp) {
case 's': /* source */
if (!*tp) tp = argv[++iarg];
source_address = convert_constant(tp);
break;
case 'S': /* source limit */
if (!*tp) tp = argv[++iarg];
source_limit = convert_constant(tp);
break;
case 'd': /* destination */
if (!*tp) tp = argv[++iarg];
dest_address = convert_constant(tp);
break;
case 'D': /* destination limit */
if (!*tp) tp = argv[++iarg];
dest_limit = convert_constant(tp) - 1;
break;
} // switch
} // if (*cp == '-' ...
else if (*cp) { /* this must be a filename */
if (h2b) scan_hex_file(cp);
else scan_bin_file(cp);
/* reset the local relocation options */
source_address = 0;
dest_address = 0;
source_limit = MAX_MASK;
dest_limit = MAX_MASK;
}
} // for (iarg
}
int main(int argc, char *argv[])
{
dword index;
byte *ptr;
verbose = 0;
global_options(argc, argv);
buffer = malloc(rom_size);
if (!buffer) error(5,"Cannot allocate ROM buffer");
for (ptr=buffer, index=rom_size; index; index--) *ptr++ = pad;
process_cmd_input(argc, argv);
if (!outfilename) {
if (h2b) {
outfilename = "out.bin";
}
else {
outfilename = "out.hex";
}
error(1,"No output file specified");
printf("Using file named '%s' for output\n", outfilename);
}
outfile = fopen(outfilename, h2b ? "wb" : "wt");
if (!outfile) error(5,"Cannot create output file");
if (h2b) while (rom_size--) fputc(*buffer++, outfile);
else write_hex_file(outfile);
fclose(outfile);
return EXIT_SUCCESS;
}

19
branches/wbw/cpurom/src/lechocr.c

@ -0,0 +1,19 @@
/* echocr.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv)
{
char szTemp[128];
int index;
strcpy(szTemp,argv[1]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
printf("%c",0x0d);
return EXIT_SUCCESS;
}

19
branches/wbw/cpurom/src/lechocrlf.c

@ -0,0 +1,19 @@
/* echocrlf.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv)
{
char szTemp[128];
int index;
strcpy(szTemp,argv[1]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
printf("%c%c",0x0d,0x0a);
return EXIT_SUCCESS;
}

45
branches/wbw/cpurom/src/lecholf.c

@ -0,0 +1,45 @@
/* echolf.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv)
{
char szTemp[128];
int index;
strcpy(szTemp,argv[1]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
if(argc>2) {
printf(" ");
strcpy(szTemp,argv[2]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
}
if(argc>3) {
printf(" ");
strcpy(szTemp,argv[3]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
}
if(argc>4) {
printf(" ");
strcpy(szTemp,argv[4]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
}
printf("%c",0x0a);
return EXIT_SUCCESS;
}

19
branches/wbw/cpurom/src/lecholfcr.c

@ -0,0 +1,19 @@
/* echocrlf.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char **argv)
{
char szTemp[128];
int index;
strcpy(szTemp,argv[1]);
for(index=0;index<strlen(szTemp);index++) {
printf("%c",szTemp[index]);
}
printf("%c%c",0x0a,0x0d);
return EXIT_SUCCESS;
}

130
branches/wbw/cpurom/src/load.c

@ -0,0 +1,130 @@
// ---------------------------------------------------
// load.c 21-May-11 Running on Mac OS X 10.6.6
// S/n 2011-1042-654321 Written by Douglas W. Goodall
// Copyright(c)2011 Douglas W. Goodall, United States.
// ---------------------------------------------------
// This file is part of Vintage Modern Assembler Plus Tools.
//
// VMAPT is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VMAPT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VMAPT. If not, see <http://www.gnu.org/licenses/>.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DATA_RECORD 0x00
#define EOF_RECORD 0x01
int main(int argc,char **argv)
{
FILE * fcom, * fhex;
char g_szBuffer2[128];
char szByteBuffer[2+1];
char *p;
int iTemp;
char cColon;
char szLength[2+1];
int iLength;
char szAddress[4+1];
unsigned int uiAddress;
char szRecordType[2+1];
unsigned char ucRecordType;
char szData[80];
unsigned char ucBinBuffer[32+1];
char szChecksum[2+1];
unsigned char ucChecksum;
unsigned int uiLastByte = 0;
char szComFile[255];
char szHexFile[255];
int i;
unsigned char memory[0xfff0];
if(1 == argc) {
printf("usage - load <hexfilespec>\n");
exit(EXIT_FAILURE);
}
strcpy(szHexFile,argv[1]);
strcpy(szComFile,argv[1]);
strcat(szComFile,".com");
strcat(szHexFile,".hex");
memset(memory,0,sizeof(memory));
fhex = fopen(szHexFile,"r");
if(NULL == fhex) {
printf("Sorry, cannot open %s for input\n",szHexFile);
exit(EXIT_FAILURE);
}
p = fgets(g_szBuffer2,sizeof(g_szBuffer2),fhex);
while(NULL != p) {
g_szBuffer2[strlen(g_szBuffer2)-1] = 0;
cColon = g_szBuffer2[0];
memset(szLength,0,sizeof(szLength));
memcpy(szLength,&g_szBuffer2[1],2);
sscanf(szLength,"%02X",&iLength);
memset(szAddress,0,sizeof(szAddress));
memcpy(szAddress,&g_szBuffer2[3],4);
sscanf(szAddress,"%04X",&uiAddress);
memset(szRecordType,0,sizeof(szRecordType));
memcpy(szRecordType,&g_szBuffer2[7],2);
sscanf(szRecordType,"%02X",&iTemp);
ucRecordType = (unsigned char)iTemp;
if(0 == ucRecordType) {
memset(szData,0,sizeof(szData));
memcpy(szData,&g_szBuffer2[9],iLength*2);
for(i=0;i<iLength;i++) {
memset(szByteBuffer,0,sizeof(szByteBuffer));
memcpy(szByteBuffer,&g_szBuffer2[1+2+4+2+(i*2)],2);
sscanf(szByteBuffer,"%02X",&iTemp);
ucBinBuffer[i] = iTemp;
memory[uiAddress+i] = (unsigned char)iTemp;
}
}
memset(szChecksum,0,sizeof(szChecksum));
memcpy(szChecksum,&g_szBuffer2[1+2+4+2+(iLength*2)],2);
sscanf(szChecksum,"%02X",&iTemp);
ucChecksum = (unsigned char)iTemp;
if(uiLastByte < uiAddress + iLength) {
uiLastByte = uiAddress + iLength;
}
p = fgets(g_szBuffer2,sizeof(g_szBuffer2),fhex);
}
fclose(fhex);
fcom = fopen(szComFile,"w");
fwrite(&memory[0x100],1,uiLastByte-0x100,fcom);
fclose(fcom);
}

191
branches/wbw/cpurom/src/loadern8.s

@ -0,0 +1,191 @@
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.0.2 #6489 (May 10 2011) (Mac OS X x86_64)
; This file was generated Sat May 21 07:40:18 2011
;--------------------------------------------------------
.module loaderhc
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _loaderhc
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; overlayable items in ram
;--------------------------------------------------------
.area _OVERLAY
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;loaderhc.c:1: void loaderhc(void)
; ---------------------------------
; Function loaderhc
; ---------------------------------
_loaderhc_start::
_loaderhc:
;***********************************
;* Z180 Home Computer Prototype
;* LOAD MONITOR FROM ROM INTO RAM AND EXECUTE Program
;* Andrew Lynch
;* lynchaj@yahoo.com
;* 15 Feb 2007
;* Updated by Max Scane 26 May 2010 for increase in BIOS size
;* Updated by Max Scane April 2011 for the home computer
;***********************************
.area _HEADER (ABS)
;********************* CONSTANTS ****************************************
RAMTOP = 0xffff ; highest addressable memory location
MONSTART = 0xf800 ; start of 2k for rom monitor f800-ffff
RAMBOTTOM = 0x8000 ; beginning of upper 32k of ram
END = 0xff ; mark ed of text
CR = 0x0d
LF = 0x0a
ESC = 0x1b
ROMSTART_MON = 0x0100 ; Where the Monitor is stored in ROM
RAMTARG_MON = 0xF800 ; Where the Monitor starts in RAM (entry point)
MOVSIZ_MON = 0x0800 ; Monitor is 2KB in length
ROMSTART_CPM = 0x0900 ; Where the CCP+BDOS+BIOS is stored in ROM
RAMTARG_CPM = 0xD400 ; Where the CCP+BDOS+BIOS starts in RAM
MOVSIZ_CPM = 0x1F00 ; CCP, BDOS, + BIOS is 7-8KB in length
Monitor_Entry = 0xF860 ; Monitor Entry Point (May change)
HC_REG_BASE = 0x80 ; HOME COMPUTER I/O REGS $80-$9F
PPI1 = HC_REG_BASE+0x00
ACR = HC_REG_BASE+0x14
RMAP = ACR+2
IO_REG_BASE = 0x40 ; IO register base offset for Z1x80
CNTLA0 = IO_REG_BASE+0x00
CNTLB0 = IO_REG_BASE+0x02
STAT0 = IO_REG_BASE+0x04
TDR0 = IO_REG_BASE+0x6
RDR0 = IO_REG_BASE+0x08
CBR = IO_REG_BASE+0x38
BBR = IO_REG_BASE+0x39
CBAR = IO_REG_BASE+0x3a
ICR = 0x3f ; not relocated!!!
;*******************************************************************
;* START AFTER RESET
;* Function : ready system, load monitor into RAM and start
;*******************************************************************
.ORG 0x0000
jp ENTRY
; place here data for the loader to use for booting (later)
;
; Note before you move the monitor into top of RAM you need to setup
; the MMU. Currently it is setup compatible with the N8VEM V1 as
; 32KB common and 32KB banked
; This may change in the future
;
ENTRY:
DI ; Disable interrupts
ld a,#IO_REG_BASE ; get the Relocation value
; out0 (ICR),a
.db 0x0ed,0x39,ICR
ld a,#0x80 ; setup for a 33/32 KB memory plan
; out0 (CBAR),a
.db 0x0ed,0x39,CBAR
ld a,#0x00
; out0 (BBR),a ; banked area starts at 0
.db 0x0ed,0x39,BBR
ld a,#0x00
; out0 (CBR),a ; so does common area
.db 0x0ed,0x39,CBR
LD SP,#RAMTOP ; Set stack pointer to top of ram
IM 1 ; Set interrupt mode 1
LD HL,#ROMSTART_MON ; where in rom Monitor is stored
LD DE,#RAMTARG_MON ; where in ram to move Monitor to
LD BC,#MOVSIZ_MON ; number of bytes to move from ROM to RAM
LDIR ; Block Copy Monitor to Upper RAM page
LD HL,#ROMSTART_CPM ; where in rom CP/M is stored (first byte)
LD DE,#RAMTARG_CPM ; where in ram to move CP/M to (first byte)
LD BC,#MOVSIZ_CPM ; number of bytes to move from ROM to RAM
LDIR ; Block Copy of CP/M to Upper RAM page
; EI ; enable interrupts (access to Monitor while CP/M running)
JP MONSTART ; jump to Start of Monitor
;************************************************************************
;* MASKABLE INTERRUPT-PROGRAM
;* Function :
;* Input :
;* Output :
;* uses :
;* calls : none
;* info :
;* tested : 2 Feb 2007
;************************************************************************
.ORG 0x0038 ; Int mode 1
RETI ; return from interrupt
;************************************************************************
;* NONMASKABLE INTERRUPT-PROGRAM
;* Function :
;* Input :
;* Output : none
;* uses :
;* calls : none
;* info :
;* tested : 2 Feb 2007
;************************************************************************
.ORG 0x0066 ; HERE IS THE NMI ROUTINE
;;; RETI
RETN ; return from NMI
.ORG 0x00FF
FLAG: .db 0x0FF
_loaderhc_end::
.area _CODE
.area _CABS

26
branches/wbw/cpurom/src/retired/i8255.c

@ -0,0 +1,26 @@
/*
*
* i8255.c
*
*/
#include "portab.h"
#include "sbcv2.h"
#include "i8255.h"
void pport_init()
{
pCNTRL = 0x80;
pPORTA = 0x00;
pCNTRL = 0x00;
pPORTA = 0x00;
pPORTB = 0x00;
pPORTC = 0x00;
}
/*
*
* eof - i8255.c
*
*/

45
branches/wbw/cpurom/src/retired/ns16550.c

@ -0,0 +1,45 @@
/*
*
* ns16550.c
*
*/
#include "portab.h"
#ifdef SBCV2
#include "sbcv2.h"
#endif
#ifdef SCSI2IDE
#include "scsi2ide.h"
#endif
#include "ns16550.h"
void uart_init(U8 baud)
{
wUART_LCR = UART_DLAB;
wUART_DIV_HI = 0x00;
wUART_DIV_LO = UART_BAUD_9600;
wUART_LCR = 0x03;
wUART_MCR = 0x03;
}
U8 uart_conin(void)
{
while(UART_RDA & rUART_LSR) ;
return rUART_DATA;
}
void uart_conout(U8 data)
{
while(UART_TBRE & rUART_LSR) ;
wUART_DATA = data;
}
/*
*
* eof - ns16550.c
*
*/

159
branches/wbw/cpurom/src/sysgen.c

@ -0,0 +1,159 @@
/***********************************************************************
sysgen utility
Copyright (C) 2009, Max Scane
This program allows you to build and manage the N8VEM's system ROM.
There are three possible functions which are selected by command line parameters:
sysgen -C xxx image.file : This command allows you to create a blank file of xxx KB in size
sysgen -e extract.file image.file : This command extracts the 10 KB system "track" to a file
sysgen -i insert.file image.file : This command inserts (writes) the contents of a file to the system "track"
*************************************************************************/
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
void usage(void)
{
printf("N8VEM sysgen v1.0\n");
printf("usage:\n");
printf("sysgen -C xx filename - Create filename xx KB in size\n");
printf("sysgen -i importfile imagefile - Import the contents of importfile to Imagefile\n");
printf("sysgen -e exportfile imagefile - Export system track to exportfile\n");
exit(1);
}
int main(int argc, char *argv[])
{
int i, size, fd1, fd2, nwritten, nread;
int ntotal = 0;
char buffer [10240];
if (argc != 4)
{
printf("\nIncorrect number of parameters\n\n");
usage();
}
if (strcmp(argv[1], "-C") == 0) /* Create command */
{
for (i=0; i<1024; i++) buffer[i] = 229;
fd1 = creat(argv[3],O_WRONLY|S_IRWXU);
if ( fd1 == -1)
{
printf("error creating file %s\n",argv[3]);
exit(1);
}
for (i=0; i< (atoi(argv[2])) ; i++)
{
nwritten = write (fd1, &buffer, 1024);
if (nwritten == -1)
{
printf ("error writing file %s\n",argv[3]);
exit(1);
}
ntotal+=nwritten;
}
printf("wrote %d bytes to file %s\n",ntotal,argv[3]);
close(fd1);
exit(0);
}
if (strcmp(argv[1], "-i") == 0) /* Import command */
{
fd1 = open (argv[2],O_RDONLY);
if (fd1 == -1)
{
printf("error opening input file %s\n",argv[2]);
exit(1);
}
fd2 = open (argv[3], O_WRONLY);
if ( fd2 == -1)
{
printf("error opening output file %s\n",argv[3]);
exit(1);
}
nread = read( fd1, &buffer, 10240);
if (nread == -1)
{
printf ("error reading from input file %s\n", argv[2]);
exit(1);
}
nwritten = write ( fd2, &buffer, nread);
if (nwritten == -1)
{
printf ("error writing to output file %s\n", argv[3]);
exit(1);
}
printf("wrote %d bytes to file %s\n",nwritten,argv[3]);
close(fd1);
close(fd2);
exit(0);
}
if (strcmp(argv[1], "-e") == 0) /* Export command */
{
fd1 = creat(argv[2],O_WRONLY|S_IRWXU); /* export file */
if (fd1 == -1)
{
printf("error creating export file %s\n",argv[2]);
exit(1);
}
fd2 = open(argv[3],O_RDONLY); /* romimage file */
if (fd2 == -1)
{
printf("error opening romimage file %s\n",argv[3]);
exit(1);
}
nread = read( fd2, &buffer, 10240);
if (nread == -1)
{
printf ("error reading from romimage file %s\n",argv[3]);
exit(1);
}
nwritten = write( fd1, &buffer, nread);
if (nwritten == -1)
{
printf ("error writing to outputfile %s\n",argv[2]);
exit(1);
}
printf("wrote %d bytes to file %s\n",nwritten,argv[2]);
close(fd1);
close(fd2);
exit(0);
}
usage();
return EXIT_SUCCESS;
}

15
branches/wbw/cpurom/tmp/stuff/baseline.arf

@ -0,0 +1,15 @@
-mjx
-i baseline.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0xD000
-b _BDOSB01 = 0xD800
-b _CBIOS = 0xE600
-b _DBGMON = 0x8000
obj/crt0.rel
obj/baseline.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbios.rel
-e

15
branches/wbw/cpurom/tmp/stuff/baseline.lk

@ -0,0 +1,15 @@
-mjx
-i baseline.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0xD000
-b _BDOSB01 = 0xD800
-b _CBIOS = 0xE600
-b _DBGMON = 0x8000
obj/crt0.rel
obj/baseline.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbios.rel
-e

15
branches/wbw/cpurom/tmp/stuff/baseline.lnk

@ -0,0 +1,15 @@
-mjx
-i baseline.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0xD000
-b _BDOSB01 = 0xD800
-b _CBIOS = 0xE600
-b _DBGMON = 0x8000
obj/crt0.rel
obj/baseline.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbios.rel
-e

13
branches/wbw/cpurom/tmp/stuff/n8.arf

@ -0,0 +1,13 @@
-mjx
-i n8.ihx
-k /usr/local/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0x0900
-b _BDOSB01 = 0x1100
-b _CBIOS = 0x1f00
obj/loadern8.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbiosn8.rel
-e

13
branches/wbw/cpurom/tmp/stuff/n8.lk

@ -0,0 +1,13 @@
-mjx
-i n8.ihx
-k /usr/local/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0x0900
-b _BDOSB01 = 0x1100
-b _CBIOS = 0x1f00
obj/loadern8.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbiosn8.rel
-e

13
branches/wbw/cpurom/tmp/stuff/n8.lnk

@ -0,0 +1,13 @@
-mjx
-i n8.ihx
-k /usr/local/share/sdcc/lib/z80
-l z80
-b _CCPB03 = 0x0900
-b _BDOSB01 = 0x1100
-b _CBIOS = 0x1f00
obj/loadern8.rel
obj/dbgmon.rel
obj/ccpb03.rel
obj/bdosb01.rel
obj/cbiosn8.rel
-e

9
branches/wbw/cpurom/tmp/stuff/scsi2ide.arf

@ -0,0 +1,9 @@
-mjx
-i scsi2ide.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _DBGMON = 0x8000
obj/crt0.rel
obj/scsi2ide.rel
obj/dbgmon.rel
-e

9
branches/wbw/cpurom/tmp/stuff/scsi2ide.lk

@ -0,0 +1,9 @@
-mjx
-i scsi2ide.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _DBGMON = 0x8000
obj/crt0.rel
obj/scsi2ide.rel
obj/dbgmon.rel
-e

9
branches/wbw/cpurom/tmp/stuff/scsi2ide.lnk

@ -0,0 +1,9 @@
-mjx
-i scsi2ide.ihx
-k /Developer/sdcc/share/sdcc/lib/z80
-l z80
-b _DBGMON = 0x8000
obj/crt0.rel
obj/scsi2ide.rel
obj/dbgmon.rel
-e
Loading…
Cancel
Save