Skip to content

Instantly share code, notes, and snippets.

@ao-kenji
Created June 30, 2024 11:44
Show Gist options
  • Save ao-kenji/620817be541e56eb4d49ae4f8c67741d to your computer and use it in GitHub Desktop.
Save ao-kenji/620817be541e56eb4d49ae4f8c67741d to your computer and use it in GitHub Desktop.
Experimental diff for building Fuzix 0.5 on z80pack onOpenBSD/amd64
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/Kernel/platform/platform-z80pack/crt0.s b/Kernel/platform/platform-z80pack/crt0.s
index 161ec580c..fac14ba47 100644
--- a/Kernel/platform/platform-z80pack/crt0.s
+++ b/Kernel/platform/platform-z80pack/crt0.s
@@ -1,7 +1,6 @@
-# 0 "crt0.S"
-# 0 "<built-in>"
-# 0 "<command-line>"
# 1 "crt0.S"
+# 1 "<built-in>" 1
+# 1 "crt0.S" 2
; startup code
.code
diff --git a/Library/libs/Makefile.z80 b/Library/libs/Makefile.z80
index 706fe44a2..75448f187 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 32e0afa82..44ddf0140 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,8 @@
# zxdiv: ZX Spectrum 128K with DivIDE/DivMMC interface
# zxuno: ZX Uno FPGA system
-TARGET=zrc
+#TARGET=zrc
+TARGET=z80pack
include version.mk
@@ -109,7 +110,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