Merge pull request #89 from ivan-tat/master

Update `firmware/bootloader.asm`, Makefiles in `software/`, `Makefile`
This commit is contained in:
Ivan Tatarinov 2021-05-17 19:16:58 +03:00 committed by GitHub
commit 3736316ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 316 additions and 82 deletions

108
Makefile
View File

@ -1,17 +1,27 @@
# Updates content of SD directory.
#
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make
# Build the project:
# make [all]
# Compile only:
# make build | build-<TARGET>
# Install:
# make install | install-<TARGET>
# Uninstall:
# make uninstall | uninstall-<TARGET>
# Clean:
# make clean
# make clean | clean-<TARGET>
# make distclean | distclean-<TARGET>
#
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# where:
# <TARGET> is one of the values for `TARGETS' variable.
include sdk/common.mk
@ -20,65 +30,75 @@ prefix ?= SD
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)
RM = rm -f
TARGETS=\
utils\
software
SOFTWARE_TARGETS=\
ESPRST\
IWCONFIG
SOFTWARE_SUBDIRS=\
esprst\
iwconfig
.PHONY: all
all:\
install-utils\
install-software
all: $(foreach t,$(TARGETS),install-$(t))
@echo 'Done.'
# utils
.PHONY: build-utils
build-utils: | utils
$(MAKE) -w -C $| bindir=$(shell realpath --relative-to=$| $(bindir))
.PHONY: install-utils
install-utils: | utils
$(MAKE) -w -C $| bindir=$(shell realpath --relative-to=$| $(bindir)) install
.PHONY: uninstall-utils
uninstall-utils: | utils
$(MAKE) -w -C $| bindir=$(shell realpath --relative-to=$| $(bindir)) uninstall
.PHONY: clean-utils
clean-utils: | utils
$(MAKE) -w -C $| clean
.PHONY: uninstall-utils
uninstall-utils: clean-utils | utils
$(MAKE) -w -C $| bindir=$(shell realpath --relative-to=$| $(bindir)) uninstall
.PHONY: distclean-utils
distclean-utils: | utils
$(MAKE) -w -C $| distclean
# software
.PHONY: build-software
build-software: | software
$(MAKE) -w -C $| bindir=$(shell realpath --relative-to=$| $(bindir))
.PHONY: install-software
install-software: $(foreach t,$(SOFTWARE_TARGETS),$(DESTDIR)$(bindir)/$(t))
$(DESTDIR)$(bindir)/ESPRST: software/esprst/esprst
$(INSTALL) $< $@
$(DESTDIR)$(bindir)/IWCONFIG: software/iwconfig/IWCONFIG
$(INSTALL) $< $@
software/esprst/esprst: | software/esprst
$(MAKE) -w -C $|
software/iwconfig/IWCONFIG: | software/iwconfig
$(MAKE) -w -C $|
.PHONY: clean-software
clean-software: |\
software/esprst\
software/iwconfig
$(MAKE) -w -C software/esprst clean
$(MAKE) -w -C software/iwconfig clean
install-software: | software
for d in $(SOFTWARE_SUBDIRS); do d=$|/$$d; $(MAKE) -w -C $$d bindir=$$(realpath --relative-to=$$d $(bindir)) install; done
.PHONY: uninstall-software
uninstall-software: clean-software
$(RM) $(foreach t,$(SOFTWARE_TARGETS),$(DESTDIR)$(bindir)/$(t))
uninstall-software: | software
for d in $(SOFTWARE_SUBDIRS); do d=$|/$$d; $(MAKE) -w -C $$d bindir=$$(realpath --relative-to=$$d $(bindir)) uninstall; done
# clean
.PHONY: clean-software
clean-software: | software
for d in $(SOFTWARE_SUBDIRS); do d=$|/$$d; $(MAKE) -w -C $$d bindir=$$(realpath --relative-to=$$d $(bindir)) clean; done
.PHONY: distclean-software
distclean-software: | software
for d in $(SOFTWARE_SUBDIRS); do d=$|/$$d; $(MAKE) -w -C $$d bindir=$$(realpath --relative-to=$$d $(bindir)) distclean; done
# all
.PHONY: build
build: $(foreach t,$(TARGETS),build-$(t))
.PHONY: install
install: $(foreach t,$(TARGETS),install-$(t))
.PHONY: uninstall
uninstall: $(foreach t,$(TARGETS),uninstall-$(t))
.PHONY: clean
clean:\
uninstall-utils\
uninstall-software
clean: $(foreach t,$(TARGETS),clean-$(t))
.PHONY: distclean
distclean: $(foreach t,$(TARGETS),distclean-$(t))

View File

@ -1,17 +1,42 @@
; firmware.asm
;
; Copyright (C) 2016-2021 Antonio Villena
; Contributors:
; 2015 Einar Saukas (ZX7 Backwards)
; 2021 Ivan Tatarinov <ivan-tat@ya.ru>
;
; 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, version 3.
;
; 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
; along with this program. If not, see <https://www.gnu.org/licenses/>.
;
; SPDX-FileCopyrightText: Copyright (C) 2016-2021 Antonio Villena
;
; SPDX-FileContributor: 2015 Einar Saukas (ZX7 Backwards)
; SPDX-FileContributor: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
; SJAsmPlus by aprisobal, <https://github.com/z00m128/sjasmplus/>
output bootloader.rom
include zxuno.def
macro wreg dir, dato
rst $28
defb dir, dato
endm
output bootloader.rom
define zxuno_port $fc3b
define master_conf 0
define master_mapper 1
define flash_spi 2
define flash_cs 3
define joyconf 6
define scandbl_ctrl 11
di
ld sp, $bfff-ini+6
wreg flash_cs, 1 ; desactivamos spi, enviando un 0
@ -51,7 +76,7 @@ nmi66 jp $c003
retn
cont wreg flash_cs, 1 ; desactivamos spi, enviando un 1
wreg joyconf, %00010000
wreg joy_conf, %00010000
wreg master_mapper, 8 ; paginamos la ROM en $c000
lee in a, ($1f)
djnz lee
@ -85,10 +110,10 @@ recov ld hl, firmware-1
block $0100 - $
include scroll/define.asm
ld sp, 0
ld de, $5e6d+filesize-1
ld de, filestart+filesize-1
ld hl, scroll-1
call dzx7b
jp $7be4
jp start
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena

View File

@ -2,4 +2,4 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
esprst
build

View File

@ -1,15 +1,82 @@
# SPDX-FileCopyrightText: Copyright (C) 2019 Alexander Sharikhin
#
# SPDX-FileContributor: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [<TARGET> ...]
# Install / Uninstall:
# make [prefix=<PREFIX>] install | uninstall
# Clean:
# make clean | distclean
#
# where:
# <TARGET> is one of values for `BINS' variable prefixed with "build/"
# (see target `all' below).
# <PREFIX> is a prefix directory to install files into.
include ../../sdk/common.mk
.PHONY: all
all: esprst
# Use uppercase for FAT filesystem
srcdir = .
prefix ?= .
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
esprst: main.asm uart.asm ring.asm
sjasmplus $<
# Disable execution mode for FAT filesystem
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL) -m 644
RM = rm -f
AS = sjasmplus
ifeq ($(USE_SJASMPLUS_VERSION),sjasmplus)
AFLAGS = --nobanner
else ifeq ($(USE_SJASMPLUS_VERSION),z00m128)
AFLAGS = --nologo
else
AFLAGS =
endif
BINS=\
ESPRST
.PHONY: all
all: $(foreach t,$(BINS),build/$(t))
build\
$(DESTDIR)$(bindir):
mkdir -p $@
build/ESPRST: $(srcdir)/main.asm\
$(srcdir)/uart.asm\
$(srcdir)/ring.asm\
| build
$(AS) $(AFLAGS) --raw=$@ $<
# $1 = target
define install_bin_rule =
$$(DESTDIR)$$(bindir)/$1: build/$1 | $$(DESTDIR)$$(bindir)
$$(INSTALL_PROGRAM) $$< $$@
endef
$(foreach t,$(BINS),$(eval $(call install_bin_rule,$(t))))
.PHONY: install
install: $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: uninstall
uninstall:
$(RM) $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: clean
clean:
rm -f esprst
rm -f $(foreach t,$(BINS),build/$(t))
.PHONY: distclean
distclean:
rm -rf build/*

View File

@ -90,4 +90,4 @@ cmd_info defb "AT+GMR", 13, 10, 0
response_ok defb "OK", 13, 10, 0
response_er defb "ready", 0
SAVEBIN "esprst", Start, $ - Start
; SAVEBIN "esprst", Start, $ - Start

View File

@ -2,6 +2,4 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
*.bin
*.def
IWCONFIG
build

View File

@ -1,15 +1,74 @@
# SPDX-FileCopyrightText: Copyright (C) 2019 Alexander Sharikhin
#
# SPDX-FileContributor: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [<TARGET> ...]
# Install / Uninstall:
# make [prefix=<PREFIX>] install | uninstall
# Clean:
# make clean | distclean
#
# where:
# <TARGET> is one of values for `BINS' variable prefixed with "build/"
# (see target `all' below).
# <PREFIX> is a prefix directory to install files into.
include ../../sdk/common.mk
.PHONY: all
all: IWCONFIG
# Use uppercase for FAT filesystem
srcdir = .
prefix ?= .
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
IWCONFIG: iwconfig.c
zcc +zx -vn -startup=30 -clib=new $< -SO3 -o $@ -subtype=dot -create-app
# Disable execution mode for FAT filesystem
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL) -m 644
RM = rm -f
BINS=\
IWCONFIG
# `zcc' compiler's behavior:
# * produces binary file in source's directory only
# * creates temporary files
TMPS=\
$(foreach t,$(BINS),$(t)_CODE.bin $(t)_UNASSIGNED.bin)
.PHONY: all
all: $(foreach t,$(BINS),build/$(t))
build\
$(DESTDIR)$(bindir):
mkdir -p $@
build/IWCONFIG: $(srcdir)/iwconfig.c | build
zcc +zx -vn -startup=30 -clib=new $< -SO3 -o $(@F) -subtype=dot -create-app
# Workaround for zcc:
rm -f $(TMPS)
mv $(@F) $@
$(DESTDIR)$(bindir)/%: build/% | $(DESTDIR)$(bindir)
cp $< $@
.PHONY: install
install: $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: uninstall
uninstall:
$(RM) $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: clean
clean:
rm -f *.bin *.def IWCONFIG
rm -f $(BINS) $(TMPS) $(foreach t,$(BINS),build/$(t))
.PHONY: distclean
distclean:
rm -rf build/*

View File

@ -2,7 +2,4 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
*.tap
player.bin
ugoph.bin
.vscode
build

View File

@ -1,15 +1,83 @@
# SPDX-FileCopyrightText: Copyright (C) 2019 Alexander Sharikhin
#
# SPDX-FileContributor: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [<TARGET> ...]
# Install / Uninstall:
# make [prefix=<PREFIX>] install | uninstall
# Clean:
# make clean | distclean
#
# where:
# <TARGET> is one of values for `BINS' variable prefixed with "build/"
# (see target `all' below).
# <PREFIX> is a prefix directory to install files into.
include ../../sdk/common.mk
.PHONY: all
all: ugoph.bin
# Use uppercase for FAT filesystem
srcdir = .
prefix ?= .
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
ugoph.bin ugoph.tap: main.asm tscreen.asm keyboard.asm utils.asm wifi.asm gopher.asm render.asm textrender.asm uart.asm ring.asm esxdos.asm vtpl.asm
sjasmplus $<
# Disable execution mode for FAT filesystem
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL) -m 644
RM = rm -f
AS = sjasmplus
ifeq ($(USE_SJASMPLUS_VERSION),sjasmplus)
AFLAGS = --nobanner
else ifeq ($(USE_SJASMPLUS_VERSION),z00m128)
AFLAGS = --nologo
else
AFLAGS =
endif
BINS=\
UGOPH
.PHONY: all
all: $(foreach t,$(BINS),build/$(t))
build\
$(DESTDIR)$(bindir):
mkdir -p $@
build/UGOPH: $(srcdir)/main.asm\
$(srcdir)/tscreen.asm\
$(srcdir)/keyboard.asm\
$(srcdir)/utils.asm\
$(srcdir)/wifi.asm\
$(srcdir)/gopher.asm\
$(srcdir)/render.asm\
$(srcdir)/textrender.asm\
$(srcdir)/uart.asm\
$(srcdir)/ring.asm\
$(srcdir)/esxdos.asm\
$(srcdir)/vtpl.asm\
| build
$(AS) $(AFLAGS) --raw=$@ $<
.PHONY: install
install: $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: uninstall
uninstall:
$(RM) $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: clean
clean:
rm -f ugoph.bin ugoph.tap
rm -f $(foreach t,$(BINS),build/$(t))
.PHONY: distclean
distclean:
rm -rf build/*

View File

@ -92,5 +92,5 @@ player
DISPLAY "Player ends: ", $
ENT
eop equ $
SAVEBIN "ugoph.bin", Start, $ - Start
SAVETAP "ugoph.tap", Start
; SAVEBIN "ugoph.bin", Start, $ - Start
; SAVETAP "ugoph.tap", Start