Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ unittests
salink
saimport
saexport
specasm-bare
test_content_zx
SAIMPORT
SAEXPORT
SAIMPORT.X
SAEXPORT.X
build.sh
compile.sh
build/specasm
build/release
build/unitzx
.DS_Store
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ COMMON =\
SRCS =\
editor.c \
editor_tests.c \
editor_test_content.c \
peer_unit.c \
peer_posix_screen.c \
peer_text_screen.c \
test_content.c \
unittests.c

POSIX = \
peer_posix.c \
peer_file_posix.c \
peer_posix_screen.c
peer_posix_screen.c \
peer_text_screen.c

SAIMPORT =\
saimport.c
Expand All @@ -29,6 +33,10 @@ SAEXPORT =\
SALINK =\
salink.c

TEST_CONTENT_ZX =\
test_content.c \
test_content_zx.c

CFLAGS += -Wall -MMD -DUNITTESTS -Isrc

all: unittests saimport saexport salink
Expand All @@ -45,6 +53,9 @@ saexport: $(BASE:%.c=%.o) $(COMMON:%.c=%.o) $(POSIX:%.c=%.o) $(SAEXPORT:%.c=%.o)
salink: $(BASE:%.c=%.o) $(POSIX:%.c=%.o) $(SALINK:%.c=%.o)
$(CC) $(CFLAGS) -o $@ $^

test_content_zx: $(TEST_CONTENT_ZX:%.c=%.o)
$(CC) $(CFLAGS) -o $@ $^

clean:
- rm *.d *.o unittests saimport saexport salink

Expand All @@ -55,3 +66,4 @@ clean:
-include $(SAIMPORT:%.c=%.d)
-include $(SAEXPORT:%.c=%.d)
-include $(SALINK:%.c=%.d)
-include $(TEST_CONTENT_ZX:%.c=%.d)
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,44 @@ make -j

And then wait. All the tap and dotx files will be created in the build directory.

To create a zip file with all the files that need to be copied onto the spectrum, type

```
make release
```

from the same directory. The specasm.zip file can be found in the build/release folder.

The saexport, saimport and salink commands can be built and run on POSIX compatible systems. Simply type make from the main Specasm directory. The saimport is essentially the assembler without the editor, so can be used in conjunction with salink to assemble and build Spectrum programs directly on a modern machine, but where's the fun in that?

## Tests

To run the unit tests simply type

```
make
./unittests
```

from the project's top level folder.

To run the linker tests perform the following steps

```
make
cd tests
./tests.sh
```

A large proportion (but not all) of the unit tests can be run on the spectrum itself. To build these tests type

```
cd unitzx
make
make tests
```

This will create a folder called unitzx in the unitzx folder. Inside this folder are 3 files that need to be copied to the same directory on your spectrum. Run the unizx.tap file to run the tests.



Expand Down
Binary file modified bas/SPECLD.TAP
Binary file not shown.
15 changes: 10 additions & 5 deletions build/Make.include
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ state.o: ../src/state.c ../src/state.h ../src/state_base.h ../src/line.h ../src/
line.o: ../src/line.c ../src/peer.h ../src/error.h ../src/peer_zx.h ../src/line.h \
../src/state.h ../src/state_base.h ../src/strings.h
editor.o: ../src/editor.c ../src/editor.h ../src/peer.h ../src/error.h \
../src/peer_zx.h ../src/line.h ../src/state.h ../src/state_base.h ../src/strings.h
../src/peer_zx.h ../src/line.h ../src/state.h ../src/state_base.h ../src/strings.h \
../src/util_print_zx.h
saimport.o: ../src/saimport.c ../src/peer.h ../src/error.h ../src/peer_zx.h \
../src/line.h ../src/peer_file.h ../src/state.h ../src/state_base.h ../src/strings.h
../src/line.h ../src/peer_file.h ../src/state.h ../src/state_base.h ../src/strings.h \
../src/util_print_zx.h
saexport.o: ../src/saexport.c ../src/peer.h ../src/error.h ../src/peer_zx.h \
../src/line.h ../src/peer_file.h ../src/state.h ../src/state_base.h ../src/strings.h
../src/line.h ../src/peer_file.h ../src/state.h ../src/state_base.h ../src/strings.h \
../src/util_print_zx.h
salink.o: ../src/salink.c ../src/peer.h ../src/error.h ../src/peer_zx.h ../src/line.h \
../src/peer_file.h ../src/state_base.h ../src/strings.h
../src/peer_file.h ../src/state_base.h ../src/strings.h \
../src/util_print_zx.h
peer_zx.o: ../src/peer_zx.c ../src/peer.h ../src/state.h ../src/state_base.h ../src/line.h \
../src/strings.h ../src/error.h
../src/strings.h ../src/error.h ../src/util_print_zx.h
peer_file_zx.o: ../src/peer_file_zx.c ../src/error.h ../src/peer_file.h
util_print_zx.o: ../src/util_print_zx.h

%.o: %.c
zcc $(CFLAGS) -o $@ -c $<
51 changes: 28 additions & 23 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VPATH=../src
all: specasm.tap salink.tap SAEXPORT SAIMPORT

CC=zcc
CFLAGS=+zx -SO2 --opt-code-size --max-allocs-per-node200000 -Cs "--disable-warning 85" -clib=sdcc_iy
CFLAGS=+zx -SO3 --opt-code-size --max-allocs-per-node200000 -Cs "--disable-warning 85" -clib=sdcc_iy

include Make.include

Expand All @@ -15,35 +15,40 @@ SPECASM = \
state_base.o \
state.o \
editor.o \
util_print_zx.o \
peer_zx.o

SALINK = \
salink.o \
error.o \
state_base.o \
peer_file_zx.o \
peer_zx.o
salink.o \
error.o \
state_base.o \
peer_file_zx.o \
util_print_zx.o \
peer_zx.o

SAEXPORT = \
error.o \
state_base.o \
line.o \
state.o \
peer_file_zx.o \
peer_zx.o \
saexport.o
error.o \
state_base.o \
line.o \
state.o \
peer_file_zx.o \
util_print_zx.o \
peer_zx.o \
saexport.o

SAIMPORT = \
error.o \
state_base.o \
line.o \
state.o \
peer_file_zx.o \
peer_zx.o \
saimport.o
error.o \
state_base.o \
line.o \
state.o \
peer_file_zx.o \
util_print_zx.o \
peer_zx.o \
saimport.o

specasm.tap: $(SPECASM)
$(CC) $(CFLAGS) -zorg=24550 -startup=31 -o specasm $^ -create-app -Cz--merge=../bas/SPECLD.TAP
$(CC) $(CFLAGS) -zorg=24310 -startup=31 -o specasm-bare $^ -create-app
cat ../bas/SPECLD.TAP specasm-bare.tap > specasm.tap

salink.tap: $(SALINK)
$(CC) $(CFLAGS) -zorg=24000 -startup=31 -o salink $^ -create-app
Expand All @@ -55,14 +60,14 @@ SAIMPORT: $(SAIMPORT)
$(CC) $(CFLAGS) -startup=30 -o $@ $(SAIMPORT) -subtype=dotx -Cz"--clean" -create-app

clean:
- rm -rf specasm *.zip
- rm -rf specasm *.zip -rf unitzx
- rm *.X *.o *.bin *.tap SAIMPORT SAEXPORT

.PHONY: release
release:
- rm -rf release
mkdir -p release/specasm
cp *.tap release/specasm
cp specasm.tap salink.tap release/specasm
cp SAIMPORT SAEXPORT *.X release/specasm
cp ../bas/INSTALL release/specasm
cp ../bas/REMOVE release/specasm
Expand Down
Loading