Browse Source

Merge pull request #82 from cm68/master

clean build, bit-identical.
pull/90/head
Wayne Warthen 6 years ago
committed by GitHub
parent
commit
94d5c0f5ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Binary/Apps/Makefile
  2. 6
      Binary/Apps/Tunes/Makefile
  3. 52
      Readme.unix
  4. 4
      Source/Apps/FDU/FDU.asm
  5. 4
      Source/Apps/Tune/Makefile
  6. 9
      Source/Apps/Tune/Tunes/Makefile
  7. 2
      Source/BPBIOS/Makefile
  8. 6
      Source/CPM3/Makefile
  9. 70
      Source/HBIOS/Build.sh
  10. 17
      Source/HBIOS/Makefile
  11. 4
      Source/HBIOS/hbios.asm
  12. 2
      Source/HBIOS/nascom.asm
  13. 40
      Source/Images/Makefile
  14. 6
      Source/Images/diskdefs
  15. 6
      Source/Makefile
  16. 9
      Source/ZPM3/Makefile
  17. 15
      Tools/Makefile.inc
  18. 1
      Tools/unix/bst/Makefile
  19. 8
      Tools/unix/casefn.sh
  20. 7
      Tools/unix/cpmtools/Makefile
  21. 2
      Tools/unix/cpmtools/config.h
  22. 29
      Tools/unix/cpmtools/cpmfs.c
  23. 2
      Tools/unix/uz80as/pp.c
  24. 49
      Tools/unix/uz80as/uz80as.c

6
Binary/Apps/Makefile

@ -1,7 +1,9 @@
TOOLS = ../../Tools
SUBDIRS = Tunes
include $(TOOLS)/Makefile.inc
all::
mkdir -p Tunes
clean::
rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN
rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN Tunes/*

6
Binary/Apps/Tunes/Makefile

@ -1,6 +0,0 @@
TOOLS = ../../../Tools
include $(TOOLS)/Makefile.inc
clean::
rm -f *.pt? *.mym

52
Readme.unix

@ -1,7 +1,49 @@
prerequisites:
this tree now contains makefiles and tools to build on Linux and MacosX
Linux is rather more thoroughly tested compared to os-x.
gcc
yacc
make
g++
to get here, TASM and the propeller generation tools needed to be replaced,
and since the unix filesystem is usually case-sensitive, and CP/M and windows
are not, the cpm tools were made case-insensitive.
TASM was replaced with uz80as, which implements a subset of TASM and fixes some
bugs. however, I needed to add some functionality to make it build the sources
as they exist in this tree. in particular, one thing to be very careful of is
that TASM is not entirely consistent with respect to the .DS directive.
it's usually a bad idea to mix .DS, .FILL, .DB with .ORG.
.DS n is best thought of as .ORG $ + n
.ORG changes the memory pointer, but does not change the file output point.
it works a lot more like M80, SLR* .phase
it assumes that you have some standard system tools and libraries installed
specifically: gcc, gnu make, libncurses
to build:
cd to the top directory and type make.
heavy use is made of make's include facility and pattern rules.
the master rule set is in Tools/Makefile.inc. changes here will affect
almost every Makefile, and where exceptions are needed, the overrides are
applied in the lower Makefiles.
these tools can run a windows-linux regression test, where all the binaries are
compared to a baseline windows build.
Credit:
uz80as was written by Jorge Giner Cordero, jorge.giner@hotmail.com,
and the original source can be found at https://github.com/jorgicor/uz80as
the propeller tools use bstc and openspin, parallax tools from
http://www.fnarfbargle.com/bst.html https://github.com/parallaxinc/OpenSpin
note that bst is not open source or even currently maintained, so I could
not generate a version for 64 bit osx.
cpmtools were the most current I could find, and it has been hacked to do
case-insensitivity. these are not marked, and are not extensive.
zx is from distributed version, and also has local hacks for case insensitivity.
both zx and cpmtools ship with an overly complicated makefile generation system
and this is ignored.
this whole linux build framework is the work of Curt Mayer, curt@zen-room.org.
use it for whatever you like; this is not my day job.

4
Source/Apps/FDU/FDU.asm

@ -2168,7 +2168,7 @@ FSST_COUNT .EQU (($ - FSST) / FSST_ENTSIZ) ; # ENTRIES IN TABLE
;
FCP_CMD .DB 000H ; INPUT: COMMAND CODE
FCP_BUFLEN .DB 00H
FCP_BUF .DS 10H
FCP_BUF .FILL 10H
FCP_BUFSIZ .EQU $-FCP_BUF
FCP_XFRCNT .DW 00H ; BYTES TRANSFERRED DURING COMMAND PHASE
;
@ -2182,7 +2182,7 @@ FXP_BC .DW 00H ; LAST VALUE OF REG BC RECORDED DURING EXECUTION
FXP_DE .DW 00H ; LAST VALUE OF REG DE RECORDED DURING EXECUTION
FXP_HL .DW 00H ; LAST VALUE OF REG HL RECORDED DURING EXECUTION
FXP_BUFLEN .DB 00H
FXP_BUF .DS 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK)
FXP_BUF .FILL 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK)
FXP_BUFSIZ .EQU $-FXP_BUF
;
; FDC STATUS

4
Source/Apps/Tune/Makefile

@ -1,4 +1,3 @@
SUBDIRS = Tunes
OBJECTS = Tune.com
DEST = ../../../Binary/Apps
TOOLS = ../../../Tools
@ -7,3 +6,6 @@ include $(TOOLS)/Makefile.inc
Tune.com: Tune.asm
$(TASM) Tune.asm Tune.com
all::
cp Tunes/* $(DEST)/Tunes

9
Source/Apps/Tune/Tunes/Makefile

@ -1,9 +0,0 @@
OBJECTS = *.pt3 *.mym
NODELETE = $(OBJECTS)
DEST = ../../../../Binary/Apps/Tunes
TOOLS = ../../../../Tools
include $(TOOLS)/Makefile.inc
clobber::
-rm -f $(DEST)/*.pt3 $(DEST)/*.mym

2
Source/BPBIOS/Makefile

@ -31,7 +31,7 @@ zcpr33n.rel zcpr33t.rel:
all:: $(HD0IMG)
clobber::
rm -f $(HD0IMG)
@rm -f $(HD0IMG)
%.img: zcpr33n.rel zcpr33t.rel
$(eval VER := $(subst .img,,$(subst bp,,$@)))

6
Source/CPM3/Makefile

@ -11,7 +11,7 @@ TOOLS = ../../Tools
include $(TOOLS)/Makefile.inc
BIOSOBJS = bioskrnl.rel scb.rel boot.rel chario.rel
BIOSOBJS += move.rel drvtbl.rel diskio.rel
BIOSOBJS += move.rel drvtbl.rel diskio.rel util.rel
COMMA := ,
NULL :=
SPACE := $(NULL) $(NULL)
@ -21,10 +21,10 @@ DEFCPM3 = bnk
#DEFCPM3 = res
clean:: biosclean
rm -f bios3.spr bnkbios3.spr zpmbios3.spr cpmldr.com gencpm.dat options.lib
@rm -f bios3.spr bnkbios3.spr zpmbios3.spr cpmldr.com gencpm.dat options.lib
biosclean:
rm -f $(BIOSOBJS)
@rm -f $(BIOSOBJS)
cpm3res:
make biosclean

70
Source/HBIOS/Build.sh

@ -36,13 +36,14 @@ fi
echo Building for $romname for $platform $config $romsize
if [ $platform == UNA ] ; then
CBIOS=../CBIOS/cbios_una.bin
BIOS=una
else
CBIOS=../CBIOS/cbios_wbw.bin
BIOS=wbw
fi
Apps=(assign fdu format mode osldr rtc survey syscopy sysgen talk timer xm inttest)
timestamp=$(date +%Y-%m-%d)
timestamp="2020-02-20"
blankfile=Blank${romsize}.dat
romdiskfile=RomDisk.tmp
@ -52,15 +53,6 @@ outdir=../../Binary
echo "creating empty rom disk of size $romsize in $blankfile"
LANG=en_US.US-ASCII tr '\000' '\345' </dev/zero | dd of=$blankfile bs=1024 count=`expr $romsize - 128`
# # Initialize working variables
# $OutDir = "../../Binary" # Output directory for final image file
# $RomFmt = "wbw_rom${RomSize}" # Location of files to imbed in ROM disk
# $BlankROM = "Blank${RomSize}KB.dat" # An initial "empty" image for the ROM disk of propoer size
# $RomDiskFile = "RomDisk.tmp" # Temporary filename used to create ROM disk image
# $RomFile = "${OutDir}/${RomName}.rom" # Final name of ROM image
# $ComFile = "${OutDir}/${RomName}.com" # Final name of COM image (command line loadable HBIOS/CBIOS)
# $ImgFile = "${OutDir}/${RomName}.img" # Final name of IMG image (memory loadable HBIOS/CBIOS image)
cat <<- EOF > build.inc
; RomWBW Configured for $platform $config $timestamp
;
@ -72,44 +64,54 @@ ROMSIZE .EQU $romsize
;
EOF
cp ../CPM22/OS2CCP.bin ccp.bin
cp ../CPM22/OS3BDOS.bin bdos.bin
cp ../ZCPR-DJ/zcpr.bin zcpr.bin
cp ../ZSDOS/zsdos.bin zsdos.bin
cp ../Forth/camel80.bin camel80.bin
cp ../Fonts/font*.asm .
make -f Makefile dbgmon.bin prefix.bin romldr.bin eastaegg.bin nascom.bin \
tastybasic.bin imgpad.bin imgpad0.bin
make dbgmon.bin prefix.bin romldr.bin eastaegg.bin nascom.bin \
tastybasic.bin game.bin usrrom.bin imgpad.bin imgpad0.bin
if [ $platform != UNA ] ; then
make -f Makefile hbios_rom.bin hbios_app.bin hbios_img.bin
make hbios_rom.bin hbios_app.bin hbios_img.bin
fi
cat ccp.bin bdos.bin $CBIOS >cpm.bin
cat zcpr.bin zsdos.bin $CBIOS >zsys.bin
cat prefix.bin cpm.bin >cpm.sys
cat prefix.bin zsys.bin >zsys.sys
echo "Building $romname output files..."
cat romldr.bin eastaegg.bin dbgmon.bin cpm.bin zsys.bin >osimg.bin
cat camel80.bin nascom.bin tastybasic.bin imgpad0.bin >osimg1.bin
cat romldr.bin eastaegg.bin dbgmon.bin ../CPM22/cpm_$BIOS.bin ../ZSDOS/zsys_$BIOS.bin >osimg.bin
cat camel80.bin nascom.bin tastybasic.bin game.bin imgpad0.bin usrrom.bin >osimg1.bin
echo "Building ${romsize}KB $romname ROM disk data file..."
cp $blankfile $romdiskfile
$CPMCP -f $romfmt $romdiskfile ../RomDsk/ROM_${romsize}KB/*.* 0:
if [ $(find ../RomDsk/$platform -type f -print 2>/dev/null | wc -l) -gt 0 ] ; then
$CPMCP -f $romfmt $romdiskfile ../RomDsk/$platform/*.* 0:
fi
echo placing files into $romdiskfile
for i in ${apps[@]} ; do
$CPMCP -f $romfmt $romdiskfile ../../Binary/Apps/$i.com 0:
for file in $(ls -1 ../RomDsk/ROM_${romsize}KB/* | sort -V) ; do
echo " " $file
$CPMCP -f $romfmt $romdiskfile $file 0:
done
for i in *.sys ; do
$CPMCP -f $romfmt $romdiskfile $i 0:
if [ -d ../RomDsk/$platform ] ; then
for file in ../RomDsk/$platform/* ; do
echo " " $file
$CPMCP -f $romfmt $romdiskfile $file 0:
done
fi
echo "adding apps to $romdiskfile"
for i in assign fdu format mode osldr rtc survey syscopy sysgen talk timer xm inttest ; do
f=$(../../Tools/unix/casefn.sh ../../Binary/Apps/$i.com)
if [ "$f" = "nofile" ] ; then
echo " " $i "not found"
else
echo " " $f
$CPMCP -f $romfmt $romdiskfile $f 0:
fi
done
if [ $platform != UNA ] ; then
echo "copying systems to $romdiskfile"
$CPMCP -f $romfmt $romdiskfile ../CPM22/cpm_$BIOS.sys 0:cpm.sys
$CPMCP -f $romfmt $romdiskfile ../ZSDOS/zsys_$BIOS.sys 0:zsys.sys
if [ $platform = UNA ] ; then
cp osimg.bin $outdir/UNA_WBW_SYS.bin
cp $romdiskfile $outdir/UNA_WBW_ROM$romsize.bin
cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN $romdiskfile >$romname.rom

17
Source/HBIOS/Makefile

@ -1,10 +1,25 @@
OBJECTS = ZETA2_std.rom
MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \
dbgmon.bin hbios_app.bin imgpad0.bin osimg1.bin romldr.bin \
eastaegg.bin hbios_img.bin imgpad.bin osimg.bin tastybasic.bin \
game.bin usrrom.bin
SUBDIRS =
DEST = ../../Binary/Apps
DEST = ../../Binary
TOOLS =../../Tools
OTHERS = *.bin *.z80 cpm.sys zsys.sys Build.inc
include $(TOOLS)/Makefile.inc
DIFFPATH = $(DIFFTO)/Binary
ZETA2_std.rom:
bash Build.sh ZETA2 std 512
hbios_rom.bin: hbios.asm
$(TASM) -dROMBOOT hbios.asm hbios_rom.bin
hbios_app.bin: hbios.asm
$(TASM) -dAPPBOOT hbios.asm hbios_app.bin
hbios_img.bin: hbios.asm
$(TASM) -dIMGBOOT hbios.asm hbios_img.bin

4
Source/HBIOS/hbios.asm

@ -658,7 +658,7 @@ HBX_BUF .FILL HBX_BUFSIZ,0
.DW HBX_IDENT ; ADDRESS OF HBIOS PROXY START (DEPRECATED)
.DW HBX_IDENT ; ADDRESS OF HBIOS IDENT INFO DATA BLOCK
;
.FILL $MEMTOP - $ ; FILL TO END OF MEMORY (AS NEEDED)
.FILL MEMTOP - $ ; FILL TO END OF MEMORY (AS NEEDED)
.ORG HBX_IMG + HBX_SIZ ; RESET ORG
;
;==================================================================================================
@ -3778,7 +3778,7 @@ PS_FLP_DSTR: .TEXT "SD$" ; PS_FLPSD
; CHARACTER DEVICE STRINGS
;
PS_SDSTRREF:
.DW PS_SDUART, PS_SDASCI, PS_SDTERM,
.DW PS_SDUART, PS_SDASCI, PS_SDTERM
.DW PS_SDPRPCON, PS_SDPPPCON, PS_SDSIO, PS_SDACIA, PS_SDPIO,PS_SDUF
;
PS_SDUART .TEXT "UART$"

2
Source/HBIOS/nascom.asm

@ -512,7 +512,7 @@ ERRORS: .BYTE "NEXT without FOR",0
.BYTE "Out of string space",0
.BYTE "String too long",0
.BYTE "String formula too complex",0
.BYTE "Can't CONTinue",0
.BYTE "Can",$27,"t CONTinue",0
.BYTE "Undefined FN function",0
.BYTE "Missing operand",0
.BYTE "HEX",0

40
Source/Images/Makefile

@ -9,13 +9,15 @@ HDIMGS = hd_cpm22.img hd_zsdos.img hd_nzcom.img \
hd_cpm3.img hd_zpm3.img hd_ws4.img hd_bp.img
OBJECTS = $(FDIMGS) $(HDIMGS) hd_combo.img
OTHERS = $(SYSTEMS) blank144 blankhd
OTHERS = blank144 blankhd
DEST=../../Binary
TOOLS = ../../Tools
include $(TOOLS)/Makefile.inc
DIFFPATH = $(DIFFTO)/Binary
hd_combo.img: $(HDIMGS)
cat $(HDIMGS) > $@
@ -37,7 +39,7 @@ blankhd:
@echo Making Blank Hd of size $(HDSIZE)k
@LANG=en_US.US-ASCII tr '\000' '\345' </dev/zero | dd of=$@ bs=1024 count=$(HDSIZE) 2>/dev/null
%.img:: $(SYSTEMS) blank144 blankhd
%.img: $(SYSTEMS) blank144 blankhd Makefile
@sys= ; \
case $@ in \
(*cpm22*) sys=../CPM22/cpm_wbw.sys;; \
@ -52,17 +54,28 @@ blankhd:
d=$$(echo $(basename $@) | sed s/$$type//) ; \
echo Generating $@ ; \
cp $$proto $@ ; \
if [ "$$sys" ] ; then \
echo copying system $$sys to $@ ; \
$(BINDIR)/mkfs.cpm -f $$fmt -b $$sys $@ ; \
fi ; \
for u in $$(seq 0 15) ; do \
dir=d_$$d/u$$u ; \
if [ -d $$dir ] ; then \
echo " " copying directory $$dir ; \
$(CPMCP) -f $$fmt $@ $$($(CASEFN) $$dir/*.*) $$u: ; \
for i in $$dir/* ; do \
f=$$($(CASEFN) $$i) ; \
echo " " $$f ; \
$(CPMCP) -f $$fmt $@ $$f $$u: ; \
done ; \
fi ; \
done ; \
if [ -f d_$$d.txt ] ; then \
echo " " copying files from d_$$d.txt ; \
grep -v ^# d_$$d.txt | tr -d '\r' | while read file user ; do \
rf=$$($(CASEFN) $$file) ; \
hack= ; \
if [ "$$file" = "../../Binary/Apps/Tunes/*.*" ] ; then hack=../../Binary/Apps/Tunes/Makefile ; fi ; \
rf=$$($(CASEFN) $$hack $$file | sort -V) ; \
echo " " $$rf ; \
if [ "$$rf" = nofile ] ; then \
echo " " $$file missing ; \
else \
@ -70,8 +83,19 @@ blankhd:
fi ; \
done ; \
fi ; \
if [ "$$sys" ] ; then \
echo copying system $$sys to $@ ; \
dd if=$$sys of=$@ conv=notrunc 2>/dev/null ; \
fi
clean::
@rm -f *.ls
imgdiff:
@for i in $(FDIMGS) $(HDIMGS) ; do \
echo $$i ; \
if echo $$i | grep -q ^f ; then \
fmt=wbw_fd144 ; \
else \
fmt=wbw_hd0 ; \
fi ; \
$(BINDIR)/cpmls -i -f $$fmt $$i > $$i.ls ; \
$(BINDIR)/cpmls -i -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \
done \

6
Source/Images/diskdefs

@ -332,7 +332,8 @@ diskdef wbw_hd0
maxdir 512
skew 0
boottrk 1
os 2.2
# os 2.2
os 3
end
diskdef wbw_hd1
@ -389,7 +390,8 @@ diskdef wbw_fd144
maxdir 256
skew 0
boottrk 2
os 2.2
# os 2.2
os 3
end
# RomWBW 360K floppy media

6
Source/Makefile

@ -4,13 +4,13 @@
NOTDONE = Doc
SUBDIRS = Prop
SUBDIRS += Apps
SUBDIRS += CBIOS HBIOS
SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS CPM3
SUBDIRS += CBIOS
SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS
SUBDIRS += HBIOS CPM3
SUBDIRS += ZPM3
SUBDIRS += Forth
NOTDONE += Fonts
SUBDIRS += BPBIOS
SUBDIRS += HBIOS
SUBDIRS += Images
TOOLS = ../Tools
include $(TOOLS)/Makefile.inc

9
Source/ZPM3/Makefile

@ -1,6 +1,9 @@
OBJECTS = zpmldr.com zpmldr.sys cpm3.sys zinstal.zpm startzpm.com zccp.com \
OBJECTS = zpmldr.com zpmldr.sys cpm3.sys startzpm.com zccp.com \
setz3.com clrhist.com autotog.com
OTHERS = biosldr.rel gencpm.com gencpm.dat bnkbios3.spr
ifndef REBUILD_ZPM_TOOLS
NODELETE = setz3.com clrhist.com autotog.com
endif
OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel gencpm.com gencpm.dat bnkbios3.spr
TOOLS =../../Tools
include $(TOOLS)/Makefile.inc
@ -43,8 +46,10 @@ zinstal.zpm: ../ZCCP/zinstal.zpm
startzpm.com: ../ZCCP/startzpm.com
cp $< $@
ifdef REBUILD_ZPM_TOOLS
setz3.com: setz3.z80
clrhist.com: clrhist.z80
autotog.com: autotog.z80
endif

15
Tools/Makefile.inc

@ -24,7 +24,7 @@ RELPATH := $(subst $(TREEROOT),,$(HERE))
#
# where's a copy of this tree for windows so we can diff binaries
#
DIFFTO := /Volumes/Github/RomWBW
DIFFTO := $(shell cd $(TREEROOT)/../RomWBW.windows; pwd)
DIFFPATH := $(DIFFTO)/$(RELPATH)
#
@ -121,13 +121,13 @@ all:: $(OBJECTS)
done ; fi
clean::
-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS)))
@-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS)))
@for dir in $(SUBDIRS) ; do \
( echo "cleaning in `pwd`/$$dir" ; cd "$$dir" ; make clean ) ; \
done
clobber:: clean
-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS)))
@-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS)))
@for dir in $(SUBDIRS) ; do \
( echo "clobbering in `pwd`/$$dir" ; cd "$$dir" ; make clobber ) ; \
done
@ -140,13 +140,16 @@ diff::
@for dir in $(SUBDIRS) ; do \
( echo "diff in $(HERE)/$$dir" ; cd "$$dir" ; make diff ) ; \
done
@for i in $(OBJECTS) ; do \
@for i in $(OBJECTS) $(MOREDIFF) ; do \
sf=$$($(CASEFN) $$i) ; \
df=$$($(CASEFN) $(DIFFPATH)/$$i) ; \
if [ -f $$df -a -f $$sf ] ; then \
if [ "$(VERBOSEDIFF)" ] ; then \
echo compare $$sf and $$df ; \
fi ; \
if ! cmp -s $$sf $$df ; then \
echo $$sf and $$df differ ; \
if [ "$(VERBOSEDIFF)" ] ; then \
echo " " $$sf and $$df differ ; \
if [ "$(VERBOSEDIFF)" = "2" ] ; then \
cmp -bl $$sf $$df ; \
hexdump -Cv $$sf > $$sf.dump ; \
hexdump -Cv $$df > $$(basename $$df).dump.diff ; \

1
Tools/unix/bst/Makefile

@ -13,6 +13,7 @@ DEST = ../../$(UNAME)
all: $(DEST)
-for i in *.$(SUFFIX) ; do \
chmod +x $$i ; \
cp $$i $(DEST)/$$(basename $$i .$(SUFFIX)) ; \
done

8
Tools/unix/casefn.sh

@ -12,7 +12,7 @@ function cleanup {
rm -f $all $search $in
}
trap cleanup EXIT
#trap cleanup EXIT
cleanup
if [ $# -lt 1 ] ; then
@ -53,10 +53,14 @@ for dn in ${dirs[@]} ; do
cd $here
cd $dn
for i in * ; do
# skip any file names containing a space
if echo "$i" | grep -sq " " ; then
continue
fi
echo $dn/$(echo "$i" | tr '[A-Z]' '[a-z]')",$dn/$i" >> $in
done
done
sort $in > $all
sort -t, -k 1,1 $in > $all
join -t, -o 1.2 $all $search | sort -u > $in
if [ $(wc -l < $in) -gt 0 ] ; then

7
Tools/unix/cpmtools/Makefile

@ -10,11 +10,14 @@ CFLAGS = -g
DEFFORMAT = ibm-3740
DEVICE = posix
DISKDEFS=$(shell cd ../../cpmtools ; pwd)/diskdefs
DEFFORMAT=wbw_fd144
CPPFLAGS = -DDISKDEFS=\"$(DISKDEFS)\" -DFORMAT=\"$(DEFFORMAT)\"
DEVICEOBJ = device_posix.o
OBJECTS = cpmls cpmrm cpmcp cpmchmod cpmchattr mkfs.cpm fsck.cpm
OBJECTS = cpmls cpmrm cpmcp cpmchmod cpmchattr mkfs.cpm fsck.cpm fsed.cpm
all: $(OBJECTS) $(DEST)
cp $(OBJECTS) $(DEST)
@ -41,7 +44,7 @@ fsck.cpm: fsck.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ)
$(CC) $(LDFLAGS) -o $@ fsck.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ)
fsed.cpm: fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ)
$(CC) $(LDFLAGS) -o $@ fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ)
$(CC) $(LDFLAGS) -o $@ fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) -lncurses
$(DEST):
mkdir -p $(DEST)

2
Tools/unix/cpmtools/config.h

@ -8,7 +8,7 @@
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_MODE_T 0
#define NEED_NCURSES 0
#define NEED_NCURSES 1
#define HAVE_NCURSES_NCURSES_H 0
#if HAVE_SYS_STAT_H

29
Tools/unix/cpmtools/cpmfs.c

@ -668,6 +668,24 @@ void cpmglob(int optin, int argc, char * const argv[], struct cpmInode *root, in
}
/*}}}*/
FILE *open_diskdefs()
{
FILE *fp;
char *ddenv = getenv("DISKDEFS");
if (fp=fopen("diskdefs","r"))
return fp;
if (fp=fopen(DISKDEFS,"r"))
return fp;
if (ddenv)
if (fp=fopen(ddenv,"r"))
return fp;
fprintf(stderr,"%s: Neither diskdefs%s%s%s nor %s could be opened.\n",
cmd,
ddenv ? ", ": "", ddenv ? ddenv : "", ddenv ? "," : "" , DISKDEFS);
exit(1);
}
/* superblock management */
/* diskdefReadSuper -- read super block from diskdefs file */ /*{{{*/
static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
@ -675,18 +693,11 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
char line[256];
FILE *fp;
int insideDef=0,found=0;
char *ddenv = getenv("DISKDEFS");
d->libdskGeometry[0] = '\0';
d->type=0;
if (
(fp=fopen("diskdefs","r"))==(FILE*)0 &&
(ddenv && ((fp=fopen(ddenv,"r"))==(FILE*)0)) &&
(fp=fopen(DISKDEFS,"r"))==(FILE*)0)
{
fprintf(stderr,"%s: Neither `diskdefs' nor `" DISKDEFS "' could be opened.\n",cmd);
exit(1);
}
fp = open_diskdefs();
while (fgets(line,sizeof(line),fp)!=(char*)0)
{
int argc;

2
Tools/unix/uz80as/pp.c

@ -631,7 +631,7 @@ static void pif(const char *p)
return;
p = skipws(p + sizeof(IFSTR) - 1);
if (!expr(p, &v, s_pc, 0, &ex_ec, &ep)) {
if (!expr(p, &v, s_pc, 1, &ex_ec, &ep)) {
s_skipon = 1;
exprint(ex_ec, s_line, ep);
newerr();

49
Tools/unix/uz80as/uz80as.c

@ -51,6 +51,7 @@ static const char *d_export(const char *);
static const char *d_end(const char *);
static const char *d_equ(const char *);
static const char *d_fill(const char *);
static const char *d_ds(const char *);
static const char *d_list(const char *);
static const char *d_lsfirst(const char *);
static const char *d_module(const char *);
@ -76,7 +77,7 @@ static struct direc {
{ "CHK", d_chk },
{ "CODES", d_codes },
{ "DB", d_byte },
{ "DS", d_fill },
{ "DS", d_ds },
{ "DW", d_word },
{ "ECHO", d_echo },
{ "EJECT", d_eject },
@ -466,6 +467,7 @@ found:
static const char *
d_null(const char *p)
{
p = sync(p);
while (*p != '\0' && *p != '\\') {
if (!isspace(*p)) {
wprint(_("invalid characters after directive\n"));
@ -514,6 +516,7 @@ static const char *d_codes(const char *p)
static const char *d_module(const char *p)
{
p = sync(p);
while (*p != '\0' && *p != '\\') {
if (!isspace(*p)) {
wprint(_("invalid characters after directive\n"));
@ -681,6 +684,50 @@ static const char *d_fill(const char *p)
return p;
}
static const char *d_ds(const char *p)
{
int n, v, er;
const char *q;
enum expr_ecode ecode;
const char *ep, *eps;
eps = p;
er = 0;
p = expr(p, &n, s_pc, 0, &ecode, &ep);
if (p == NULL) {
exprint(ecode, s_pline, ep);
newerr();
return NULL;
}
if (n < 0) {
eprint(_("number of positions to space over is negative (%d)\n"), n);
eprcol(s_pline, eps);
exit(EXIT_FAILURE);
}
v = 255;
p = skipws(p);
if (*p == ',') {
p = skipws(p + 1);
q = expr(p, &v, s_pc, s_pass == 0, &ecode, &ep);
if (q == NULL) {
er = 1;
exprint(ecode, s_pline, ep);
newerr();
} else {
p = q;
}
}
s_pc += n;
if (er)
return NULL;
else
return p;
}
static const char *d_lsfirst(const char *p)
{
s_msbword = 0;

Loading…
Cancel
Save