Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c757e1b
specasm: add documentation
markdryan Oct 1, 2024
405c127
Abstract out the register encoding to save space
markdryan Oct 1, 2024
e8d0df1
specasm: refactor and reword to safe space
markdryan Oct 1, 2024
9522f8e
specasm: fix issues with the docs
markdryan Nov 16, 2024
56449a5
SAMAC: add new binary for generating .x files
markdryan Jan 2, 2025
9ac9dfb
samake: add macro support
markdryan Jan 8, 2025
aa4d357
samake: add 'ace' support
markdryan Jan 12, 2025
fc4fe99
samake: add autoace support
markdryan Jan 15, 2025
1303720
.gitignore: exclude a few extra files
markdryan Jan 19, 2025
64ee805
specasm: add documentation for the Next
markdryan Jan 26, 2025
3ece48e
unittests: don't include docs in unittests
markdryan Feb 8, 2025
c5713a4
specasm: fix a bug in the help command
markdryan Jan 26, 2025
9890d32
specasm: Mark zxn specific instructions in the help
markdryan Jan 26, 2025
0bbc1a0
specasm: fix a small off by one bug in help
markdryan Jan 26, 2025
e1c944f
specasm: fix a few errors in the documentation
markdryan Jan 26, 2025
93896be
samac: don't link to error.c
markdryan Feb 8, 2025
1816cf5
samac: reduce org address of SAMAC
markdryan Feb 9, 2025
5a0d517
samake: add Next support for macros
markdryan Feb 13, 2025
8ec5024
specasm: increase key timeout in help
markdryan Feb 13, 2025
ac5bff6
specasm: fix a paste crash
markdryan Feb 14, 2025
2d1fd29
docs: Update specasm.md for release v11
markdryan Feb 14, 2025
3a03dce
release: combine 128 and 48 zip files
markdryan Feb 15, 2025
fea0d3d
update version number to v11
markdryan Feb 16, 2025
f7dda42
docs: update the install image for v11
markdryan Feb 22, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ SAIMPORT.X
SAEXPORT.X
SAMAKE
SAMAKE.X
SAMAC
build.sh
compile.sh
!build/48/specasm/
!bas/48/*.TAP
!bas/128/*.TAP
!bas/*.TAP
build/48/specasm/release/
build/128/specasm/release/
!build/next/specasm/
!build/128/specasm/
build/next/specasm/release/
Expand All @@ -40,3 +42,4 @@ build/next/unit/tests/
examples/hello/hello
examples/hello/hello.x
.DS_Store
.vscode
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Specasm

Specasm is a Z80 assembler designed to run on the 48k and 128k ZX Spectrum and the ZX Spectrum Next. It requires an SD card solution running ESXDOS 0.87 or greater to function on the 48Kb and 128Kb ZX Spectrum. For detailed information about how Specasm works, please see the [documentation](https://github.com/markdryan/specasm/blob/master/docs/specasm.md). To get started, carry on reading.
Specasm is a Z80 assembler designed to run on the 48k and 128k ZX Spectrums and the ZX Spectrum Next. It requires an SD card solution running ESXDOS 0.87 or greater to function on the 48Kb and 128Kb ZX Spectrum. For detailed information about how Specasm works, please see the [documentation](https://github.com/markdryan/specasm/blob/master/docs/specasm.md). To get started, carry on reading.

## Getting Started

[Download](https://github.com/markdryan/specasm/releases) the latest release of Specasm appropriate for your Spectrum and unzip the contents of the file into the root directory of your SD card.

> [!TIP]
> There are three different Zip files available, specasm48.zip for the 48kb, specasm128.zip for the 128kb Spectrum, and specasmnext.zip for the ZX Spectrum Next. You must download the appropriate version for your machine.
> There are two different Zip files available, specasm.zip for the 48kb and 128kb Spectrums, and specasmnext.zip for the ZX Spectrum Next. The specasm.zip file contains separate binaries and install scripts for both the 48kb and 128kb versions. You must download the appropriate version for your machine.

You should now have a folder in your root directory called SPECASM. It should look something like this if you downloaded specasm48.zip
You should now have a folder in your root directory called SPECASM. It should look something like this if you downloaded specasm.zip

![Installing](/docs/install.png)

Now navigate to the INSTALL.BAS file, which is a BASIC program, and press **ENTER** to execute it. On the 48kb or 128kb Spectrum this will use ESXDOS's **.launcher** command to set up some command line short cuts for the tap files in the SPECASM directory. It will also copy some executables to the /bin folder. On the ZX Spectrum Next it will copy the various executable programs that compose Specasm to the /dot folder.
To install Specasm you need to run a short BASIC program. Run INST48.BAS when installing on a 48kb Spectrum, INST128.BAS when installing on a 128kb Spectrum and INSTALL.BAS when running on the Next. Navigate to the appropriate install file and press **ENTER** to execute it. On the 48kb or 128kb Spectrum this will use ESXDOS's **.launcher** command to set up some command line short cuts for the tap files in the SPECASM directory. It will also copy some executables to the /bin folder. On the ZX Spectrum Next it will copy the various executable programs that compose Specasm to the /dot folder.

> [!TIP]
> Note on previous releases of Specasm, there were separate zip files just for the 48kb and the 128kb Spectrums and users ran a BASIC script called INSTALL.BAS to install Specasm on these machines. From release v11 onwards, the zip files for the 48kb and 128kb Spectrums have been combined and you must run INST48.BAS or INST128.BAS to install the correct version. If you run the wrong install program by mistake just run REMOVE.BAS to uninstall Specasm and then execute the correct installer.

## Reinstalling Specasm

Expand Down
7 changes: 6 additions & 1 deletion asm/sald128/sald128.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dw calib
dw bank0
dw bank4
dw bank6
dw bank3
dw bank1

.calib
Expand All @@ -32,8 +33,10 @@ dw bank1
align 4
.bank128
db 16,20,22,17
db 19
.bankPlus2a
db 16,17,19,20
db 22

.bank0
ld c, 0
Expand All @@ -44,10 +47,12 @@ db 16,17,19,20
.bank6
ld c, 2
jr switchBank
.bank3
ld c, 4
jr switchBank
.bank1
ld c, 3


.switchBank
ld a, (=cpuid)
cp 126
Expand Down
Binary file added bas/128/INST128.BAS
Binary file not shown.
Binary file modified bas/128/specld.tap
Binary file not shown.
File renamed without changes.
Binary file added bas/next/MAC.BAS
Binary file not shown.
3 changes: 3 additions & 0 deletions build/128/specasm/Make.include
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ editor_buffers.o: editor_buffers.c editor_buffers.h line.h \
error.h
scratch.o: scratch.c scratch.h line.h error.h
analysis_banked.o: analysis.c state.h state_base.h line_common.h line.h error.h strings.h
doc_banked.o: doc.c doc.h editor.h error.h line.h line_common.h peer.h peer_zx.h scratch.h util_print_zx.h
descra2l_banked.o: descra2l.c descra2l.h
descrm2z_banked.o: descrm2z.c descrm2z.h

%.o: %.c
zcc $(CFLAGS) -o $@ -c $<
26 changes: 21 additions & 5 deletions build/128/specasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ editor_extra_banked.o: editor_extra.c
analysis_banked.o: analysis.c
$(CC) $(CFLAGS) -DSPECASM_128_BANKED -o $@ --codesegBANK_6 --constsegBANK_6 --datasegBANK_6 -c $<

doc_banked.o: doc.c
$(CC) $(CFLAGS) -DSPECASM_128_BANKED -o $@ --codesegBANK_3 --constsegBANK_3 --datasegBANK_3 -c $<

descra2l_banked.o: descra2l.c
$(CC) $(CFLAGS) -DSPECASM_128_BANKED -o $@ --codesegBANK_3 --constsegBANK_3 --datasegBANK_3 -c $<

descrm2z_banked.o: descrm2z.c
$(CC) $(CFLAGS) -DSPECASM_128_BANKED -o $@ --codesegBANK_3 --constsegBANK_3 --datasegBANK_3 -c $<

clipboard.o: clipboard.c
$(CC) $(CFLAGS) -DSPECASM_128_BANKED -o $@ -c $<

Expand Down Expand Up @@ -67,7 +76,10 @@ SPECASM = \
ld_parse_banked.o \
editor_banked.o \
editor_extra_banked.o \
analysis_banked.o
analysis_banked.o \
doc_banked.o \
descra2l_banked.o \
descrm2z_banked.o

specasm_bare.tap: $(SPECASM)
$(CC) $(CFLAGS) -zorg=32768 -m -startup=31 -o $@ $^ -pragma-include:zpragma.inc $(CZFLAGS)
Expand All @@ -80,8 +92,9 @@ specasm.tap: specasm_bare.tap sald128/sald128
z88dk-appmake +zx -b specasm_bare_BANK_0.bin -o bank0.tap --org 49152 --noloader
z88dk-appmake +zx -b specasm_bare_BANK_4.bin -o bank4.tap --org 49152 --noloader
z88dk-appmake +zx -b specasm_bare_BANK_6.bin -o bank6.tap --org 49152 --noloader
z88dk-appmake +zx -b specasm_bare_BANK_3.bin -o bank3.tap --org 49152 --noloader
z88dk-appmake +zx -b sald128/sald128 -o sald128.tap --org 32768 --noloader
cat ../../../bas/128/specld.tap sald128.tap bank0.tap bank4.tap bank6.tap specasm_bare.tap > specasm.tap
cat ../../../bas/128/specld.tap sald128.tap bank0.tap bank4.tap bank6.tap bank3.tap specasm_bare.tap > sa128.tap

clean:
- rm -rf specasm *.zip -rf unitzx sald128
Expand All @@ -91,12 +104,15 @@ clean:
release:
- rm -rf release
mkdir -p release/specasm
cp specasm.tap release/specasm
cp sa128.tap release/specasm
cp ../../48/specasm/salink.tap release/specasm
cp ../../48/specasm/specasm.tap release/specasm
cp ../../48/specasm/SAMAC_CODE.bin release/specasm/SAMAC
cp ../../../COPYING release/specasm
sed 's/```//g' ../../../docs/specasm.md > release/specasm/specasm.txt
cp ../../48/specasm/SAMAKE ../../48/specasm/SAIMPORT ../../48/specasm/SAEXPORT ../../48/specasm/*.X release/specasm
cp ../../../bas/48/INSTALL.BAS release/specasm
cp ../../../bas/128/INST128.BAS release/specasm
cp ../../../bas/48/INST48.BAS release/specasm
cp ../../../bas/48/REMOVE.BAS release/specasm
../../../buildlib.sh `realpath release` 128 specasm
cd release && zip -r specasm128.zip specasm
cd release && zip -r specasm.zip specasm
1 change: 1 addition & 0 deletions build/48/specasm/Make.include
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ queued_files.o: queued_files.c peer.h error.h peer_zx.h \
editor_buffers.o: editor_buffers.c editor_buffers.h line.h \
error.h
scratch.o: scratch.c scratch.h line.h error.h
samac.o: samac.c error.h line.h scratch.h state.h state_base.h strings.h

%.o: %.c
zcc $(CFLAGS) -o $@ -c $<
41 changes: 25 additions & 16 deletions build/48/specasm/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
VPATH=../../../src

.PHONY: all
all: specasm.tap salink.tap SAEXPORT SAIMPORT SAMAKE
all: specasm.tap salink.tap SAEXPORT SAIMPORT SAMAKE SAMAC

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

util_print_acc_zx.o: util_print_acc_zx.asm
$(CC) $(CFLAGS) -o $@ -c $<

samac_cmds.o: samac_cmds.asm
$(CC) $(CFLAGS) -o $@ -c $<

include Make.include

SPECASM = \
Expand Down Expand Up @@ -75,9 +78,24 @@ SAMAKE =\
peer_file_zx.o \
peer_zx.o

SAMAC = \
samac.o \
samac_cmds.o \
ld_parse.o \
line_common.o \
line_dump.o \
line_dump_common.o \
line_parse.o \
line_parse_common.o \
scratch.o \
state_base.o \
state_dump.o \
state_parse.o \
peer_zx.o


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

salink.tap: $(SALINK)
Expand All @@ -93,19 +111,10 @@ SAIMPORT: $(SAIMPORT)
SAMAKE: $(SAMAKE)
$(CC) $(CFLAGS) -startup=30 -o $@ $(SAMAKE) -subtype=dotx -Cz"--clean" -create-app

SAMAC: $(SAMAC)
$(CC) $(CFLAGS) -m -zorg=30720 -pragma-output="CLIB_MALLOC_HEAP_SIZE=0" -pragma-output="REGISTER_SP=-1" -startup=31 -o $@ $^

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

.PHONY: release
release:
- rm -rf release
mkdir -p release/specasm
cp specasm.tap salink.tap release/specasm
cp ../../../COPYING release/specasm
sed 's/```//g' ../../../docs/specasm.md > release/specasm/specasm.txt
cp SAMAKE SAIMPORT SAEXPORT *.X release/specasm
cp ../../../bas/48/INSTALL.BAS release/specasm
cp ../../../bas/48/REMOVE.BAS release/specasm
../../../buildlib.sh `realpath release` 48 specasm
cd release && zip -r specasm48.zip specasm
- rm *.X *.o *.bin *.tap SAIMPORT SAEXPORT SAMAKE SAMAC

4 changes: 4 additions & 0 deletions build/next/specasm/Make.include
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ editor_buffers.o: editor_buffers.c editor_buffers.h line.h \
error.h
scratch.o: scratch.c scratch.h line.h error.h
analysis_banked.o: analysis.c state.h state_base.h line_common.h line.h error.h strings.h
doc_banked.o: doc.h editor.h error.h line.h line_common.h peer.h peer_zx.h scratch.h util_print_zx.h
descra2l_banked.o: descra2l.c descra2l.h
descrm2z_banked.o: descrm2z.c descrm2z.h
samac.o: samac.c error.h line.h scratch.h state.h state_base.h strings.h

%.o: %.c
zcc $(CFLAGS) -o $@ -c $<
44 changes: 41 additions & 3 deletions build/next/specasm/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
VPATH=../../../src

.PHONY: all
all: SPECASM SALINK SAEXPORT SAIMPORT SAMAKE
all: SPECASM SALINK SAEXPORT SAIMPORT SAMAKE SAMAC

CC=zcc
CFLAGS=+zxn -SO3 --opt-code-size --max-allocs-per-node200000 -Cs "--disable-warning 85" -clib=sdcc_iy -DSPECASM_TARGET_NEXT -DSPECASM_TARGET_NEXT_OPCODES
CZFLAGS=-Cz="--clean --fullsize --main-fence 0xDE00"
SACZFLAGS=-Cz="--clean --fullsize --main-fence 0xBFFE"

samac_cmds_next.o: samac_cmds_next.asm
$(CC) $(CFLAGS) -o $@ -c $<

util_print_acc_next.o: util_print_acc_next.asm
$(CC) $(CFLAGS) -o $@ -c $<

Expand Down Expand Up @@ -53,6 +56,15 @@ queued_files_banked.o: queued_files.c
link_obj_banked.o: link_obj.c
$(CC) $(CFLAGS) -DSPECASM_NEXT_BANKED -o $@ --codesegBANK_45_H --constsegBANK_45_H --datasegBANK_45_H -c $<

doc_banked.o: doc.c
$(CC) $(CFLAGS) -DSPECASM_NEXT_BANKED -o $@ --codesegBANK_47_L --constsegBANK_47_L --datasegBANK_47_L -c $<

descra2l_banked.o: descra2l.c
$(CC) $(CFLAGS) -DSPECASM_NEXT_BANKED -o $@ --codesegBANK_47_H --constsegBANK_47_H --datasegBANK_47_H -c $<

descrm2z_banked.o: descrm2z.c
$(CC) $(CFLAGS) -DSPECASM_NEXT_BANKED -o $@ --codesegBANK_48_H --constsegBANK_48_H --datasegBANK_48_H -c $<

clipboard.o: clipboard.c
$(CC) $(CFLAGS) -DSPECASM_NEXT_BANKED -o $@ -c $<

Expand Down Expand Up @@ -80,7 +92,10 @@ SPECASM = \
state_dump_banked.o \
editor_banked.o \
editor_extra_banked.o \
analysis_banked.o
analysis_banked.o \
doc_banked.o \
descra2l_banked.o \
descrm2z_banked.o

SALINK = \
salink.o \
Expand Down Expand Up @@ -127,6 +142,23 @@ SAMAKE =\
peer_file_next.o \
peer_next.o

SAMAC = \
samac.o \
samac_cmds_next.o \
ld_parse.o \
line_common.o \
line_dump.o \
line_dump_common.o \
line_parse.o \
line_parse_common.o \
error.o \
scratch.o \
state_base.o \
state_dump.o \
state_parse.o \
peer_next.o


SPECASM: $(SPECASM)
$(CC) $(CFLAGS) -m -startup=31 -o $@ $^ -pragma-include:zpragmasa.inc -subtype=dotn $(SACZFLAGS) -create-app

Expand All @@ -142,9 +174,13 @@ SAIMPORT: $(SAIMPORT)
SAMAKE: $(SAMAKE)
$(CC) $(CFLAGS) -startup=30 -o $@ $(SAMAKE) -subtype=dotn -Cz"--clean" -create-app

SAMAC: $(SAMAC)
$(CC) $(CFLAGS) -zorg=28736 -pragma-output="CLIB_MALLOC_HEAP_SIZE=0" -pragma-output="REGISTER_SP=-1" -startup=31 -o $@ $^


clean:
- rm -rf specasm *.zip
- rm *.X *.o *.bin SPECASM SALINK SAIMPORT SAEXPORT SAMAKE
- rm *.X *.o *.bin *.map SPECASM SALINK SAIMPORT SAEXPORT SAMAKE SAMAC SAMAC_CODE.bin

.PHONY: release
release:
Expand All @@ -153,7 +189,9 @@ release:
cp ../../../COPYING release/specasm
sed 's/```//g' ../../../docs/specasm.md > release/specasm/specasm.txt
cp SPECASM SALINK SAIMPORT SAEXPORT SAMAKE release/specasm
cp SAMAC_CODE.bin release/specasm/SAMAC
cp ../../../bas/next/INSTALL.BAS release/specasm
cp ../../../bas/next/REMOVE.BAS release/specasm
cp ../../../bas/next/MAC.BAS release/specasm
../../../buildlib.sh `realpath release` next
cd release && zip -r specasmnext.zip specasm
Binary file modified docs/install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading