Skip to content

Instantly share code, notes, and snippets.

@ao-kenji
Created August 4, 2024 12:49
Show Gist options
  • Save ao-kenji/d947986721778ea81cdf8f9e2d31d8e2 to your computer and use it in GitHub Desktop.
Save ao-kenji/d947986721778ea81cdf8f9e2d31d8e2 to your computer and use it in GitHub Desktop.
diff --git a/Applications/ar/ar.c b/Applications/ar/ar.c
index 0e01eecfc..0445c3bcf 100644
--- a/Applications/ar/ar.c
+++ b/Applications/ar/ar.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
extern int optind;
int c;
char *p;
- int (*fcall)(char **argv);
+ int (*fcall)(char **argv1);
if (argc < 3)
usage();
diff --git a/Kernel/platform/platform-sbcv2/Makefile b/Kernel/platform/platform-sbcv2/Makefile
index f5a7c7f8c..9dd246b72 100644
--- a/Kernel/platform/platform-sbcv2/Makefile
+++ b/Kernel/platform/platform-sbcv2/Makefile
@@ -60,6 +60,7 @@ clean:
#
image: bootblock
$(CROSS_LD) -b -C 0x0100 -S 0xF400 -f CLDBbXSs -o fuzix.bin \
+ -m fuzix.tmpmap \
crt0.o commonmem.o sbcv2.o ../../start.o \
../../version.o ../../cpu-z80u/lowlevel-z80u.o \
../../usermem.o tricks.o main.o discard.o \
@@ -76,7 +77,7 @@ image: bootblock
../../dev/net/net_native.o ../../dev/net/net_w5x00.o wiznet.o \
../../dev/ds1302_rbc.o ../../dev/ds1302.o ../../dev/ds1302_discard.o \
../../dev/tinyide_ppide_rbc.o ../../dev/devfd.o \
- /opt/fcc/lib/z80/libz80.a -m fuzix.tmpmap
+ /opt/fcc/lib/z80/libz80.a
perl -lpe '$$_=hex' fuzix.tmpmap | paste -d" " - fuzix.tmpmap | sort -n | cut -d" " -f 2- >../../fuzix.map
../../tools/pack85 <../../fuzix.map fuzix.bin ../../fuzix.bin
cp boot-romwbw.bin fuzix.romwbw
@@ -86,7 +87,7 @@ image: bootblock
#
bootblock:
asz80 boot-romwbw.S
- ldz80 -b boot-romwbw.o -o boot-romwbw.tmp
+ ldz80 -b -o boot-romwbw.tmp boot-romwbw.o
# Chop off the leading 61440 bytes we don't want
dd if=boot-romwbw.tmp of=boot-romwbw.bin bs=512 count=2 skip=120
diff --git a/Kernel/platform/platform-z80all/Makefile b/Kernel/platform/platform-z80all/Makefile
index 0188cf618..f0c2c4fb7 100644
--- a/Kernel/platform/platform-z80all/Makefile
+++ b/Kernel/platform/platform-z80all/Makefile
@@ -49,6 +49,7 @@ clean:
#
image: boot
$(CROSS_LD) -b -C 0x0100 -S 0xF400 -f CLDBbXSs -o fuzix.bin \
+ -m fuzix.tmpmap \
crt0.o commonmem.o z80all.o ../../start.o \
../../version.o ../../cpu-z80u/lowlevel-z80u.o \
../../usermem.o tricks.o main.o discard.o \
@@ -63,7 +64,7 @@ image: boot
devtty.o ../../dev/tinydisk.o ../../dev/tinydisk_discard.o \
../../dev/tinyide.o ../../dev/tinyide_discard.o \
../../dev/ps2kbd.o ../../devinput.o devinput.o \
- /opt/fcc/lib/z80/libz80.a -m fuzix.tmpmap
+ /opt/fcc/lib/z80/libz80.a
perl -lpe '$$_=hex' fuzix.tmpmap | paste -d" " - fuzix.tmpmap | sort -n | cut -d" " -f 2- >../../fuzix.map
../../tools/pack85 <../../fuzix.map fuzix.bin ../../fuzix.bin
@@ -71,8 +72,8 @@ image: boot
# Compile up the boot block
#
boot: boot.s
- asz80 boot.s -o boot.o
- ldz80 -b -C 0 boot.o -o boot.bin
+ asz80 -o boot.o boot.s
+ ldz80 -b -C 0 -o boot.bin boot.o
../../tools/doubleup <boot.bin >boot
IMAGES = $(FUZIX_ROOT)/Images/$(TARGET)
diff --git a/Kernel/platform/platform-z80pack/Makefile b/Kernel/platform/platform-z80pack/Makefile
index 5616e636a..f53c23bc5 100644
--- a/Kernel/platform/platform-z80pack/Makefile
+++ b/Kernel/platform/platform-z80pack/Makefile
@@ -30,6 +30,7 @@ clean:
image:
$(CROSS_LD) -b -C 0x0088 -S 0xF400 -X 0xE900 -f CLDBbXSs -o fuzix.bin \
+ -m fuzix.tmpmap \
crt0.o commonmem.o z80pack.o main.o \
../../start.o ../../version.o \
../../cpu-z80u/lowlevel-z80u.o ../../cpu-z80u/usermem_std-z80u.o \
@@ -41,11 +42,11 @@ image:
../../tty.o ../../mm.o ../../mm/memalloc_none.o ../../mm/bankfixed.o \
../../swap.o ../../devsys.o ../../dev/z80pack/devlpr.o \
../../dev/z80pack/devtty.o ../../dev/z80pack/devrtc.o \
- /opt/fcc/lib/z80/libz80.a -m fuzix.tmpmap
+ /opt/fcc/lib/z80/libz80.a
perl -lpe '$$_=hex' fuzix.tmpmap | paste -d" " - fuzix.tmpmap | sort -n | cut -d" " -f 2- >../../fuzix.map
../../tools/pack85 <../../fuzix.map fuzix.bin ../../fuzix.bin
- asz80 bootblock.S -o bootblock.o
- ldz80 -b bootblock.o -o bootblock.bin
+ asz80 -o bootblock.o bootblock.S
+ ldz80 -o bootblock.bin -b bootblock.o
IMAGES = $(FUZIX_ROOT)/Images/$(TARGET)
diff --git a/Library/libs/Makefile.z80 b/Library/libs/Makefile.z80
index aaa44a898..3b182b055 100644
--- a/Library/libs/Makefile.z80
+++ b/Library/libs/Makefile.z80
@@ -104,7 +104,7 @@ libc.l:%.l:$(OBJ_C) $(OBJ_ASM)
syscall.l: fuzix$(PLATFORM)/syslib.l
../tools/syscall_$(PLATFORM)
- (cd fuzix$(PLATFORM); make)
+ (cd fuzix$(PLATFORM); $(MAKE))
cat fuzix$(PLATFORM)/syslib.l | tr " " "\\n" | sed -e "s/^/fuzix$(PLATFORM)\//" >syscall.l
syslib$(PLATFORM).lib: syscall.l libc.l
@@ -118,16 +118,16 @@ crt0.o: crt0_$(PLATFORM).o
fuzix$(PLATFORM)/syslib.l: ../tools/syscall_$(PLATFORM)
$<
- make -C fuzix$(PLATFORM)
+ $(MAKE) -C fuzix$(PLATFORM)
../tools/syscall_$(PLATFORM): ../tools/syscall_$(PLATFORM).c
- make -C .. tools/syscall_$(PLATFORM)
+ $(MAKE) -C .. tools/syscall_$(PLATFORM)
liberror.txt: ../tools/liberror
$< > $@
../tools/liberror: ../tools/liberror.c
- make -C .. tools/liberror
+ $(MAKE) -C .. tools/liberror
curses$(PLATFORM).lib: $(OBJ_CURS)
$(AR) rc curses$(PLATFORM).lib `lorder$(PLATBIN) $(OBJ_CURS) | tsort`
@@ -173,7 +173,7 @@ $(OBJ_RL):%.o: %.c
clean:
rm -rf *.o *.lib *~ syscall.l libc.l syslib.l \
lib*.a liberror.txt
- -cd fuzix$(PLATFORM) && make clean
+ -cd fuzix$(PLATFORM) && $(MAKE) clean
rm -rf fuzix$(PLATFORM)/Makefile
rm -f $(KRN_HEADERS_COPY)
-cd curses && rm -rf *.o *~
diff --git a/Library/link/ldz80 b/Library/link/ldz80
index d28006bf9..339dcb2b7 100755
--- a/Library/link/ldz80
+++ b/Library/link/ldz80
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
TARGET=a.out
# TODO; stack option
diff --git a/Makefile b/Makefile
index 175314ee5..191f640e3 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,11 @@
# zxdiv: ZX Spectrum 128K with DivIDE/DivMMC interface
# zxuno: ZX Uno FPGA system
-TARGET=zrc
+#TARGET=zrc
+#TARGET=z80all
+#TARGET=z80pack
+TARGET=sbcv2
+#TARGET=lunaxp
include version.mk
@@ -109,7 +113,7 @@ PATH := /opt/fcc/bin:$(PATH)
PATH := $(FUZIX_ROOT)/Build/tools/:$(PATH)
# Use Berkeley yacc always (Bison output is too large)
-YACC = byacc
+YACC = yacc
# TARGET is what we are building
# CPU is the CPU type for the kernel
diff --git a/Standalone/Makefile b/Standalone/Makefile
index ff5f34078..e67df4923 100644
--- a/Standalone/Makefile
+++ b/Standalone/Makefile
@@ -1,4 +1,4 @@
-CC=gcc
+CC=cc
#Use this for playing with the experimental libdsk support
#CCOPTS=-O2 -DLIBDSK -ldsk -g -Wall -pedantic -Wno-char-subscripts -Wno-deprecated-declarations
CCOPTS=-O2 -g -Wall -pedantic -Wno-char-subscripts -Wno-deprecated-declarations
diff --git a/Standalone/mkftl.c b/Standalone/mkftl.c
index a1825eb14..83afe4a67 100644
--- a/Standalone/mkftl.c
+++ b/Standalone/mkftl.c
@@ -11,6 +11,10 @@
#include "../Kernel/lib/dhara/map.h"
#include "../Kernel/lib/dhara/nand.h"
+#if defined(__clang__)
+#define ffsl __builtin_ffsl
+#endif
+
static uint32_t pagesize = 512;
static uint32_t erasesize = 4096;
static uint32_t flashsize = 1024*1024; /* bytes */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment