OpenBIOS
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1994 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1993 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1992 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1991 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1990 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1989 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1988 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1987 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1986 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1985 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1984 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1983 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1982 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1981 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1980 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1979 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1978 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1977 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1976 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1975 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1974 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1973 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1972 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1971 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1970 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1969 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1968 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1967 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1966 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1965 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1964 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1963 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1962 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1961 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1960 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1959 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1958 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1957 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1956 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1955 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1954 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1953 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1952 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1951 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1950 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1949 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1948 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1947 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1946 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1945 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1944 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1943 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1942 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1941 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1940 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1939 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1938 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1937 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1936 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1935 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1934 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1933 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1932 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1931 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1930 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1929 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1928 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1927 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1926 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1925 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1924 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1923 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1922 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1921 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1920 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1919 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1918 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1917 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1916 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1915 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1914 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1913 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1912 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1911 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1910 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1909 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1908 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1907 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1906 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1905 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1904 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
July 2007
- 3 participants
- 65 discussions
Author: wmb
Date: 2007-07-20 04:13:21 +0200 (Fri, 20 Jul 2007)
New Revision: 479
Modified:
cpu/i8051/build/Makefile
Log:
8051 Makefile - Fixed silly error in sim target.
Modified: cpu/i8051/build/Makefile
===================================================================
--- cpu/i8051/build/Makefile 2007-07-20 01:45:12 UTC (rev 478)
+++ cpu/i8051/build/Makefile 2007-07-20 02:13:21 UTC (rev 479)
@@ -17,7 +17,7 @@
@make -C ${HOSTDIR} forth
sim: kernel.hex
- s51 -s ${SIMTTY} -X 32M /c/Temp/kernel.hex
+ s51 -s ${SIMTTY} -X 32M kernel.hex
build: ${HOSTDIR}/forth
@ln -sf ${HOSTDIR}/forth $@
1
0
Author: wmb
Date: 2007-07-20 03:45:12 +0200 (Fri, 20 Jul 2007)
New Revision: 478
Modified:
cpu/i8051/build/Makefile
Log:
8051 Makefile: Fixed HOSTDIR
Modified: cpu/i8051/build/Makefile
===================================================================
--- cpu/i8051/build/Makefile 2007-07-20 01:00:03 UTC (rev 477)
+++ cpu/i8051/build/Makefile 2007-07-20 01:45:12 UTC (rev 478)
@@ -5,7 +5,7 @@
# XXX need a better way of determining this
HOST := x86
-XHOSTDIR := $(shell eval "(cd ../../${HOST}/${OS}; pwd)")
+HOSTDIR := $(shell eval "(cd ../../${HOST}/${OS}; pwd)")
all: kernel.hex
@@ -13,17 +13,17 @@
.PRECIOUS: kernel.img
-${XHOSTDIR}/forth:
- @make -C ${XHOSTDIR} forth
+${HOSTDIR}/forth:
+ @make -C ${HOSTDIR} forth
sim: kernel.hex
s51 -s ${SIMTTY} -X 32M /c/Temp/kernel.hex
-build: ${XHOSTDIR}/forth
- @ln -sf ${XHOSTDIR}/forth $@
+build: ${HOSTDIR}/forth
+ @ln -sf ${HOSTDIR}/forth $@
%.img: FORCE build
- ./build $@
+ HOSTDIR=${HOSTDIR} ./build $@
%.hex: %.img
objcopy -I binary -O ihex $< $@
1
0
Author: wmb
Date: 2007-07-20 03:00:03 +0200 (Fri, 20 Jul 2007)
New Revision: 477
Modified:
forth/wrapper/wrapper.c
Log:
wrapper: Improved the ifdef structure so it is slightly less hideous.
Modified: forth/wrapper/wrapper.c
===================================================================
--- forth/wrapper/wrapper.c 2007-07-20 00:34:15 UTC (rev 476)
+++ forth/wrapper/wrapper.c 2007-07-20 01:00:03 UTC (rev 477)
@@ -162,7 +162,6 @@
#else
# ifdef __i386__
# ifndef CKERNEL
- char *host_cpu = "x86";
# define LinuxX86
# define HOST_LITTLE_ENDIAN
# endif
@@ -172,12 +171,8 @@
#ifdef NT
char *host_os = "nt";
-#ifdef POWERPC
-char *host_cpu = "powerpc";
-#else
char *host_cpu = "x86";
#endif
-#endif
#ifdef OSF1
char *host_os = "osf1";
@@ -185,7 +180,7 @@
#endif
-#ifdef POWERPC
+#ifdef TARGET_POWERPC
char *target_cpu = "powerpc";
#ifndef LinuxPOWERPC
#define TOCCALL
@@ -284,7 +279,7 @@
#include <signal.h>
-#ifdef POWERPC
+#ifdef TARGET_POWERPC
#ifdef LinuxPOWERPC
#define NOGLUE
#else
@@ -308,10 +303,6 @@
#endif
#endif
-#ifdef SIM
-#define HELPER
-#endif
-
#ifdef WIN32
#define isatty _isatty
#define kbhit _kbhit
@@ -352,7 +343,7 @@
INTERNAL long f_ioctl();
INTERNAL long f_lseek();
INTERNAL long f_crstr();
-#ifdef SIM
+#ifdef PPCSIM
/* These are not INTERNAL because the PowerPC simulator uses then */
long c_key();
long s_bye();
@@ -397,9 +388,6 @@
INTERNAL long s_ioperm();
INTERNAL long f_mkdir();
INTERNAL long f_rmdir();
-#ifdef SIM
-INTERNAL long printnum();
-#endif
#ifdef DLOPEN
extern long dlopen(), dlsym(), dlerror(), dlclose();
#endif
@@ -988,7 +976,7 @@
dictsize = sizeof(header) + imagesize + extrasize ;
dictsize += 16; /* Allow for alignment */
-# ifdef SIM
+# ifdef PPCSIM
printf("PowerPC Instruction Set Simulator\n");
printf("Copyright 1994 FirmWorks All rights reserved\n");
# endif
@@ -1016,7 +1004,7 @@
f_close(f);
-# if defined(POWERPC) && defined(HOST_LITTLE_ENDIAN)
+# if defined(TARGET_POWERPC) && defined(HOST_LITTLE_ENDIAN)
lbflips((long *)(loadaddr + sizeof(header) + header.h_tlen),
header.h_dlen);
qlbflips((long *)(loadaddr + sizeof(header)),
@@ -1059,7 +1047,7 @@
argc, argv));
#endif
-#ifdef HELPER
+#ifdef PPCSIM
simulate(0L, loadaddr+sizeof(header)+START_OFFSET,
loadaddr, functions, ((long)loadaddr+dictsize - 16) & ~15,
argc, argv, 1 /* 0=POWER, 1=PowerPC */);
@@ -1081,7 +1069,7 @@
}
# elif !defined(TOCCALL)
-# ifdef POWERPC
+# ifdef TARGET_POWERPC
s_bye((*(long (*) ())(loadaddr+sizeof(header)+START_OFFSET))
(loadaddr, ((char *)functions)+1, ((long)loadaddr+dictsize - 16) & ~15,
argc, argv, 1));
@@ -2227,13 +2215,6 @@
return((long)mem);
}
-#ifdef SIM
-INTERNAL long printnum(n1,n2,n3)
-long n1,n2,n3;
-{
- printf("%x %x %x\n", n3,n2,n1);
-}
-#endif
/* ARGSUSED */
INTERNAL long
1
0
Author: wmb
Date: 2007-07-20 02:34:15 +0200 (Fri, 20 Jul 2007)
New Revision: 476
Added:
cpu/i8051/build/Makefile
Modified:
cpu/i8051/build/
cpu/i8051/kernel.bth
cpu/i8051/target.fth
Log:
i8051 kernel - Checkpoint
Property changes on: cpu/i8051/build
___________________________________________________________________
Name: svn:ignore
+ *.hex
build
Added: cpu/i8051/build/Makefile
===================================================================
--- cpu/i8051/build/Makefile (rev 0)
+++ cpu/i8051/build/Makefile 2007-07-20 00:34:15 UTC (rev 476)
@@ -0,0 +1,32 @@
+SIMTTY = /dev/pts/1
+
+OS := $(shell uname)
+
+# XXX need a better way of determining this
+HOST := x86
+
+XHOSTDIR := $(shell eval "(cd ../../${HOST}/${OS}; pwd)")
+
+all: kernel.hex
+
+.PHONY: FORCE all clean
+
+.PRECIOUS: kernel.img
+
+${XHOSTDIR}/forth:
+ @make -C ${XHOSTDIR} forth
+
+sim: kernel.hex
+ s51 -s ${SIMTTY} -X 32M /c/Temp/kernel.hex
+
+build: ${XHOSTDIR}/forth
+ @ln -sf ${XHOSTDIR}/forth $@
+
+%.img: FORCE build
+ ./build $@
+
+%.hex: %.img
+ objcopy -I binary -O ihex $< $@
+
+clean:
+ rm -f *.img *.hex *.log headers *~ build
Modified: cpu/i8051/kernel.bth
===================================================================
--- cpu/i8051/kernel.bth 2007-07-19 22:28:50 UTC (rev 475)
+++ cpu/i8051/kernel.bth 2007-07-20 00:34:15 UTC (rev 476)
@@ -18,7 +18,7 @@
fload ${BP}/forth/kernel/meta1.fth
only forth also meta also definitions
-\needs 8015-assembler caps @ caps on fload ${BP}/cpu/i8051/assem.fth caps !
+fload ${BP}/cpu/i8051/assem.fth
only forth also meta assembler also meta definitions
: assembler ( -- ) 8051-assembler ;
Modified: cpu/i8051/target.fth
===================================================================
--- cpu/i8051/target.fth 2007-07-19 22:28:50 UTC (rev 475)
+++ cpu/i8051/target.fth 2007-07-20 00:34:15 UTC (rev 476)
@@ -91,9 +91,8 @@
: link-t@ ( host-address -- target-address ) a-t@ ;
: link-t! ( target-address host-address -- ) a-t! ;
-\ Machine independent
: a-t, ( target-address -- ) here /a-t allot a-t! ;
-: token-t, ( target-address -- ) here /token-t allot token!-t ;
+: token-t, ( target-address -- ) here /token-t allot token-t! ;
\ Dictionary linked list; the list head is in the metacompiler environment
\ during metacompilation
1
0
Author: wmb
Date: 2007-07-20 00:28:50 +0200 (Fri, 20 Jul 2007)
New Revision: 475
Modified:
cpu/i8051/assem.fth
Log:
8051 assembler - fixed but in <resolve; it was not allot'ing the offset byte,
so the next instruction overwrote it.
Modified: cpu/i8051/assem.fth
===================================================================
--- cpu/i8051/assem.fth 2007-07-19 09:51:02 UTC (rev 474)
+++ cpu/i8051/assem.fth 2007-07-19 22:28:50 UTC (rev 475)
@@ -358,7 +358,7 @@
here swap rel!
;
: <mark ( -- to ) here ;
-: <resolve ( from -- ) here rel! ;
+: <resolve ( to -- ) rel, ;
: but ( mark1 mark1 -- mark2 mark1 ) swap ;
: yet ( mark -- mark mark ) dup ;
1
0
Author: wmb
Date: 2007-07-19 11:51:02 +0200 (Thu, 19 Jul 2007)
New Revision: 474
Modified:
cpu/i8051/assem.fth
Log:
8051 assembler - Turn off jmp and call length optimizations for now.
Modified: cpu/i8051/assem.fth
===================================================================
--- cpu/i8051/assem.fth 2007-07-19 04:18:00 UTC (rev 473)
+++ cpu/i8051/assem.fth 2007-07-19 09:51:02 UTC (rev 474)
@@ -88,7 +88,7 @@
;
: byte-offset? ( offset -- flag ) h# -80 h# 7f between ;
: rel! ( to from -- )
- tuck - ( from offset )
+ tuck 1+ - ( from offset )
dup byte-offset? 0= abort" Bad branch offset"
swap asm8!
;
@@ -317,11 +317,15 @@
: pop ( iram -- ) h# d0 asm8, iram, ;
: xjmp ( adr -- )
- dup here - byte-offset? if sjmp else ljmp then
+\ Turn off this optimizations for now for simplicity
+\ dup here - byte-offset? if sjmp else ljmp then
+ ljmp
;
: xcall ( adr -- )
- dup here 2+ xor h# f800 and ( adr page-different? )
- if lcall else acall then ( adr )
+\ Turn off this optimizations for now for simplicity
+\ dup here 2+ xor h# f800 and ( adr page-different? )
+\ if lcall else acall then ( adr )
+ lcall
;
: put-ljmp ( to from -- )
>r
1
0
Author: wmb
Date: 2007-07-19 06:18:00 +0200 (Thu, 19 Jul 2007)
New Revision: 473
Modified:
ofw/fs/jffs2/jffs2.fth
Log:
JFFS2 driver - Fixed OLPC trac #2292 (failure of "size" method) and
also improved the speed of directory operations by a factor of about 4.
Modified: ofw/fs/jffs2/jffs2.fth
===================================================================
--- ofw/fs/jffs2/jffs2.fth 2007-07-18 05:09:39 UTC (rev 472)
+++ ofw/fs/jffs2/jffs2.fth 2007-07-19 04:18:00 UTC (rev 473)
@@ -437,8 +437,12 @@
l@+ ( hash adr' )
w@+ ( hash w adr' )
swap ?dup if ( hash adr' w ) \ Short form
- swap -rot ( adr' hash w )
- /l* dirent-offset +! ( adr' hash )
+\ swap -rot ( adr' hash w )
+\ /l* dirent-offset +! ( adr' hash )
+
+ /l* dirent-offset +! ( hash adr' )
+ swap ( adr' hash )
+
dirent-offset @ ( adr' hash offset )
cur-pino @ rot ( adr' offset pino hash )
else ( hash adr' ) \ Long form
@@ -449,6 +453,110 @@
true
;
+
+\ Information that we need about the working file/directory
+\ The working file changes at each level of a path search
+
+0 instance value wd-inum \ Inumber of directory
+0 instance value wf-inum \ Inumber of file or directory
+0 instance value wf-type \ Type - 4 for directory, d# 10 for symlink, etc
+
+1 [if]
+code (next-pino-match) ( adr next-dirent pino cur-pino dirent-offset -- false | adr' offset hash true )
+ dx pop \ dx: dirent-offset
+ cx pop \ cx: cur-pino
+ bx pop \ bx: pino
+ 0 [sp] bp xchg \ bp: next-dirent
+ 4 [sp] si xchg \ si: adr
+
+ si bp cmp = if
+ 0 [sp] bp mov \ restore bp
+ 4 [sp] si mov \ restore si
+ 4 # sp add \ clean stack
+ ax ax xor 0 # 0 [sp] mov \ return false
+ next
+ then
+
+ \ If the first encoded dirent is short-form, the pino is the same as
+ \ before and thus matches.
+ ax ax xor op: 4 [si] ax mov \ ax: w
+ ax ax or 0<> if \ Short form
+ 2 # ax shl ax 0 [dx] add \ Update dirent-offset
+ 0 [si] cx mov \ cx: hash
+ 6 # si add \ skip long hash and word offset
+ 4 [sp] si xchg \ Put adr back on stack and restore si
+ 0 [dx] bp mov \ bp: offset
+ 0 [sp] bp xchg \ Put offset on stack and restore bp
+ cx push \ Put hash on stack
+ -1 # push \ Put true on stack
+ next
+ then
+
+ long-offsets on
+ begin
+ ax ax xor op: 4 [si] ax mov \ ax: w
+ ax ax or 0<> if \ Short form
+ 2 # ax shl ax 0 [dx] add \ Update dirent-offset
+ 6 # si add \ skip long hash and word offset
+ else
+ d# 10 [si] ax mov ax 0 [dx] mov \ Update dirent-offset
+ d# 6 [si] ax mov ax 0 [cx] mov \ Update cur-pino
+ d# 14 # si add \ skip record
+ ax bx cmp = if
+ d# -14 [si] cx mov \ cx: hash
+ 4 [sp] si xchg \ Put adr back on stack and restore si
+ 0 [dx] bp mov \ bp: offset
+ 0 [sp] bp xchg \ Put offset on stack and restore bp
+ cx push \ Put hash on stack
+ -1 # push \ Put true on stack
+ next
+ then
+ then
+ bp si cmp = until
+ long-offsets off
+
+ 0 [sp] bp mov \ restore bp
+ 4 [sp] si mov \ restore si
+ 4 # sp add \ clean stack
+ ax ax xor 0 # 0 [sp] mov \ return false
+c;
+: next-pino-match ( adr -- false | pino adr' offset hash true )
+ next-dirent wd-inum cur-pino dirent-offset (next-pino-match)
+;
+[then]
+
+[ifndef] next-pino-match
+: next-pino-match ( adr -- false | adr' offset hash true )
+ dup next-dirent >= if drop false exit then
+
+ \ If the first encoded dirent is short-form, the pino is the same as
+ \ before and thus matches.
+ dup la1+ w@ ?dup if ( adr w )
+ /l* dirent-offset +! ( adr )
+ dirent-offset @ ( adr offset )
+ swap l@+ wa1+ ( offset hash adr' )
+ -rot true ( offset hash adr' )
+ exit
+ then ( adr )
+
+ begin ( adr )
+ la1+ w@+ swap ?dup if ( adr' w )
+ /l* dirent-offset +! ( adr' )
+ else ( adr' )
+ l@+ swap cur-pino ! ( adr' )
+ l@+ swap dirent-offset ! ( adr' )
+ wd-inum cur-pino @ = if ( adr' )
+ dirent-offset @ ( adr' offset )
+ over -3 la+ -1 wa+ l@ ( adr' offset hash )
+ true ( adr' offset hash true )
+ exit
+ then ( adr )
+ then ( adr )
+ dup next-dirent >= until ( adr )
+ drop false ( false )
+;
+[then]
+
\ Copy summary dirent from FLASH to memory
\ Summary dirent: w.nodetype l.totlen l.offset l.pino l.version
\ l.ino c.nsize c.type name
@@ -758,13 +866,6 @@
;
-\ Information that we need about the working file/directory
-\ The working file changes at each level of a path search
-
-0 instance value wd-inum \ Inumber of directory
-0 instance value wf-inum \ Inumber of file or directory
-0 instance value wf-type \ Type - 4 for directory, d# 10 for symlink, etc
-
: set-root ( -- ) 1 to wd-inum 1 to wf-inum 4 to wf-type ;
\ latest-node is for symlinks and directories, which have only one data node.
@@ -886,6 +987,23 @@
r> drop
;
+\ This is related to play-log, but instead of going forward and
+\ reading the data, it goes backward and just looks for the last
+\ good node, from which it extracts the total size field.
+: find-size ( -- size )
+ -1 to the-eblock#
+ -1 to have-eblock#
+ next-minode begin dup minodes <> while ( 'minode )
+ 8 - dup na1+ @ get-node ( 'minode' inode )
+ dup inode-good? if ( 'minode inode )
+ nip riisize@ ( size )
+ exit ( -- size )
+ then ( 'minode inode )
+ drop ( 'minode )
+ repeat ( 'minode )
+ drop 0 ( size )
+;
+
: play-log ( -- )
get-inflater
@@ -896,7 +1014,16 @@
release-inflater
;
-: ?play-log ( -- ) file-size -1 = if play-log then ;
+: ?play-log ( -- )
+ file-size -1 = if
+ file-buf -1 = if
+ \ This is the value we will use for file-buf if we use read and seek
+ \ For load, the buffer address is given to us
+ next-minode to file-buf
+ then
+ play-log
+ then
+;
: +dirent ( adr -- adr' ) na1+ dup w@ 0= if 2 na+ then wa1+ ;
@@ -942,21 +1069,21 @@
wd-inum crctab 2over ($crc) >r ( name$ r: hash )
0 dirent-offset !
- dirents begin decode-dirent while ( name$ adr' offset pino' hash' )
- nip ( name$ adr offset hash' )
+ dirents begin next-pino-match while ( name$ adr' offset hash )
\ Check for a hash match
r@ = if ( name$ adr offset )
2over ?update-dirent ( name$ adr )
else ( name$ adr offset )
drop ( name$ adr )
then ( name$ adr )
- repeat ( name$ adr r: hash )
+ repeat ( name$ r: hash )
2drop r> drop ( )
my-vers 0< if true exit then ( )
wf-type 4 = if wf-inum to wd-inum then
false
;
+
\ The work file is a symlink. Resolve it to a new dirent
: dir-link ( -- error? )
delimiter >r [char] / to delimiter
@@ -1064,13 +1191,10 @@
: prep-dirents ( -- )
minodes 'next-minode ! \ Empty the list
- dirents begin decode-dirent while ( adr offset pino hash )
- drop wd-inum = if ( adr offset )
- insert-dirent ( adr )
- else ( adr offset )
- drop ( adr )
- then ( adr )
- repeat ( )
+ dirents ( adr )
+ begin next-pino-match while ( adr' offset hash )
+ drop insert-dirent ( adr )
+ repeat ( )
;
\ End of "tdirent" section
@@ -1181,6 +1305,27 @@
: ?release ( flag -- flag ) dup 0= if release-buffers then ;
+\ Starting at the current directory (wd-inum), process all the path components,
+\ resolving symlinks until either a directory or an ordinary file is found.
+\ If the resulting final component is a directory, leave wd-inum set to it.
+\ If the resulting final component is a file, collect its data nodes so that
+\ "seek", "read", and "load" will access its data.
+
+: $find-file ( name$ -- found? )
+ $resolve-path if false exit then ( )
+
+ begin
+ \ We now have the dirent for the file at the end of the string
+ wf-type case
+ 4 of wf-inum to wd-inum true exit endof \ Directory
+ 8 of collect-nodes exit endof \ Regular file
+ d# 10 of dir-link if false exit then endof \ Link
+ ( default ) \ Anything else (special file) is error
+ drop false exit
+ endcase
+ again
+;
+
: open ( -- flag )
\ This lets us open the node during compilation
standalone? 0= if true exit then
@@ -1193,30 +1338,19 @@
scan-occupied ( )
- \ This is the value we will use for file-buf if we use read and seek
- next-inode to file-buf
-
false to first-time?
my-args " <NoFile>" $= if true exit then
- my-args set-root $resolve-path if false ?release exit then ( )
-
- begin
- \ We now have the dirent for the file at the end of the string
- wf-type case
- 4 of wf-inum to wd-inum true exit endof \ Directory
- 8 of collect-nodes ?release exit endof \ Regular file
- d# 10 of dir-link if false ?release exit then endof \ Link
- ( default ) \ Anything else (special file) is error
- drop false ?release exit
- endcase
- again
+ set-root
+ my-args $find-file ( okay? )
+ ?release
;
: close ( -- ) release-buffers ;
-: size ( -- d.size ) ?play-log file-size 0 ;
+: size ( -- d.size ) find-size 0 ;
+
: read ( adr len -- actual )
?play-log ( adr len )
clip-size tuck ( len' len' adr len' )
1
0
Author: wmb
Date: 2007-07-18 07:09:39 +0200 (Wed, 18 Jul 2007)
New Revision: 472
Added:
cpu/i8051/assem.fth
Log:
Initial revision
Added: cpu/i8051/assem.fth
===================================================================
--- cpu/i8051/assem.fth (rev 0)
+++ cpu/i8051/assem.fth 2007-07-18 05:09:39 UTC (rev 472)
@@ -0,0 +1,471 @@
+
+vocabulary 8051-assembler
+: assembler 8051-assembler ;
+assembler also definitions
+
+defer asm8@ also forth ' c@ previous is asm8@
+defer asm8! also forth ' c! previous is asm8!
+defer here also forth ' here previous is here
+defer asm-allot also forth ' allot previous is asm-allot
+
+\ append values to the end of a code definition which is being built.
+\ always little-endian:
+: asm8, ( n -- ) here 1 asm-allot asm8! ;
+
+d# -1 constant #
+d# -2 constant @R0
+d# -3 constant @R1
+d# -4 constant R7
+d# -5 constant R6
+d# -6 constant R5
+d# -7 constant R4
+d# -8 constant R3
+d# -9 constant R2
+d# -10 constant R1
+d# -11 constant R0
+d# -12 constant A
+
+\ Port bits
+: bitnum: create , does> @ + ;
+8 0 do i bitnum: loop .0 .1 .2 .3 .4 .5 .6 .7
+
+\ SFRs
+h# 80 constant p0
+h# 81 constant sp
+h# 82 constant dpl
+h# 83 constant dph
+h# 87 constant pcon
+h# 88 constant tcon
+h# 89 constant tmod
+h# 8a constant tl0
+h# 8b constant tl1
+h# 8c constant th0
+h# 8d constant th1
+h# 90 constant p1
+h# 98 constant scon
+h# 99 constant sbuf \ not bit-addressable
+h# a0 constant p2
+h# a8 constant ie
+h# b0 constant p3
+h# b8 constant ip
+h# d0 constant psw
+h# e0 constant acc
+h# f0 constant b
+
+\ KB3700 extensions/changes
+h# 80 constant p0ie \ Bits enable corresponding interrupt
+h# 86 constant pcon2 \ Various, see KB3700 manual (page 35)
+h# 90 constant p1ie \ Bits enable corresponding interrupt
+h# 9a constant scon2 \ Extended baud rate divisor, low byte
+h# 9b constant scon3 \ Extended baud rate divisor, high byte
+h# b0 constant p3ie \ Bits enable corresponding interrupt
+h# d8 constant p0if \ Bits report corresponding interrupt status
+h# e8 constant p1if \ Bits report corresponding interrupt status
+h# f8 constant p3if \ Bits report corresponding interrupt status
+
+
+: acall ( adr -- ) \ ppp1.0001 llll.llll
+ \ XXX check that adr matches high 5 bits of PC
+ h# 7ff and wbsplit ( low high )
+ 5 lshift h# 11 or asm8, ( low )
+ asm8,
+;
+: ajmp ( adr -- ) \ ppp1.0001 llll.llll
+ \ XXX check that adr matches high 5 bits of PC
+ h# 7ff and wbsplit ( low high )
+ 5 lshift h# 01 or asm8, ( low )
+ asm8,
+;
+
+: iram, ( n -- )
+ dup h# ff > abort" IRAM address too large"
+ asm8,
+;
+
+: immed, ( n -- )
+ dup h# ff > abort" Immediate value too large"
+ asm8,
+;
+: byte-offset? ( offset -- flag ) h# -80 h# 7f between ;
+: rel! ( to from -- )
+ tuck - ( from offset )
+ dup byte-offset? 0= abort" Bad branch offset"
+ swap asm8!
+;
+: rel, ( n -- ) here rel! 1 asm-allot ;
+
+: add ( n [ # or @ ] -- )
+ dup # = if drop h# 24 asm8, immed, exit then
+
+ dup @R0 = if drop h# 26 asm8, exit then
+ dup @R1 = if drop h# 27 asm8, exit then
+ dup R0 R7 between if R0 - h# 28 + asm8, exit then
+
+ h# 25 asm8, iram,
+;
+
+: addc ( n [ # or @ ] -- )
+ dup # = if drop h# 34 asm8, immed, exit then
+
+ dup @R0 = if drop h# 36 asm8, exit then
+ dup @R1 = if drop h# 37 asm8, exit then
+ dup R0 R7 between if R0 - h# 38 + asm8, exit then
+
+ h# 35 asm8, iram,
+;
+
+: subb ( n # | n | @Rn | Rn ] -- )
+ dup # = if drop h# 94 asm8, immed, exit then
+
+ dup @R0 = if drop h# 96 asm8, exit then
+ dup @R1 = if drop h# 97 asm8, exit then
+ dup R0 R7 between if R0 - h# 98 + asm8, exit then
+
+ h# 95 asm8, iram,
+;
+
+: anl ( n # | n | @Rn | Rn ] -- )
+ dup # = if drop h# 54 asm8, immed, exit then
+
+ dup @R0 = if drop h# 56 asm8, exit then
+ dup @R1 = if drop h# 57 asm8, exit then
+ dup R0 R7 between if R0 - h# 58 + asm8, exit then
+ h# 55 asm8, iram,
+;
+
+: anlr ( iram -- ) h# 52 asm8, asm8, ;
+: anli ( data iram -- ) h# 53 asm8, asm8, asm8, ; \ ANL iramadr,#data
+: anlc ( bit-addr -- ) h# 82 asm8, asm8, asm8, ;
+: anlc/ ( bit-addr -- ) h# b0 asm8, asm8, asm8, ;
+
+: orl ( n # | n | @Rn | Rn ] -- )
+ dup # = if drop h# 44 asm8, immed, exit then
+
+ dup @R0 = if drop h# 46 asm8, exit then
+ dup @R1 = if drop h# 47 asm8, exit then
+ dup R0 R7 between if R0 - h# 48 + asm8, exit then
+
+ h# 45 asm8, iram,
+;
+
+: orlr ( iram -- ) h# 42 asm8, asm8, ;
+: orli ( data iram -- ) h# 43 asm8, asm8, asm8, ; \ ANL iramadr,#data
+: orlc ( bit-addr -- ) h# 72 asm8, asm8, asm8, ;
+: orlc/ ( bit-addr -- ) h# a0 asm8, asm8, asm8, ;
+
+: xrli ( data iram -- ) h# 63 asm8, asm8, asm8, ; \ XRL iramadr,#data
+: xrl ( n # | n | @Rn | Rn ] -- )
+ dup # = if drop h# 64 asm8, immed, exit then
+
+ dup @R0 = if drop h# 66 asm8, exit then
+ dup @R1 = if drop h# 67 asm8, exit then
+
+ dup R0 R7 between if R0 - h# 68 + asm8, exit then
+
+ h# 65 asm8, iram,
+;
+
+: mov ( ? -- ) \ a,src
+ dup # = if drop h# 74 asm8, immed, exit then
+
+ dup @R0 = if drop h# e6 asm8, exit then
+ dup @R1 = if drop h# e7 asm8, exit then
+
+ dup R0 R7 between if R0 - h# e8 + asm8, exit then
+
+ h# e5 asm8, iram,
+;
+
+: movr ( ? -- ) \ dst,a
+ dup @R0 = if drop h# f6 asm8, exit then
+ dup @R1 = if drop h# f7 asm8, exit then
+
+ dup R0 R7 between if R0 - h# f8 + asm8, exit then
+
+ h# f5 asm8, iram,
+;
+
+: movc ( bit -- ) h# a2 asm8, asm8, ;
+
+: movi ( data ea -- ) \ ea,#data
+ dup @R0 = if drop h# 76 asm8, immed, exit then
+ dup @R1 = if drop h# 77 asm8, immed, exit then
+
+ dup R0 R7 between if R0 - h# 78 + asm8, immed, exit then
+ h# 75 asm8, iram, immed,
+;
+
+: mov_to_iram ( ea iram -- ) \ iram,ea
+ swap
+ dup @R0 = if drop h# 86 asm8, iram, exit then
+ dup @R1 = if drop h# 87 asm8, iram, exit then
+
+ dup R0 R7 between if R0 - h# 88 + asm8, iram, exit then
+ h# 85 asm8, iram, iram,
+;
+
+: mov_from_iram ( iram ea -- ) \ ea,iram
+ dup @R0 = if drop h# a6 asm8, iram, exit then
+ dup @R1 = if drop h# a7 asm8, iram, exit then
+
+ dup R0 R7 between if R0 - h# a8 + asm8, iram, exit then
+ drop true abort" illegal addressing mode"
+;
+
+: xchg ( n | @Rn | Rn ] -- )
+ dup @R0 = if drop h# c6 asm8, exit then
+ dup @R1 = if drop h# c7 asm8, exit then
+
+ dup R0 R7 between if R0 - h# c8 + asm8, exit then
+
+ h# c5 asm8, iram,
+;
+
+: dec ( n | A | @Rn | Rn ] -- )
+ dup A = if drop h# 14 asm8, exit then
+
+ dup @R0 = if drop h# 16 asm8, exit then
+ dup @R1 = if drop h# 17 asm8, exit then
+ dup R0 R7 between if R0 - h# 18 + asm8, exit then
+
+ h# 15 asm8, iram,
+;
+
+: djnz ( adr n | @Rn | Rn ] -- )
+ dup R0 R7 between if R0 - h# d8 + asm8, rel, exit then
+
+ h# d5 asm8, iram, rel,
+;
+
+: inc ( n | A | @Rn | Rn ] -- )
+ dup A = if drop h# 04 asm8, exit then
+
+ dup @R0 = if drop h# 06 asm8, exit then
+ dup @R1 = if drop h# 07 asm8, exit then
+ dup R0 R7 between if R0 - h# 08 + asm8, exit then
+
+ h# 05 asm8, iram,
+;
+
+: orlr ( iram -- ) h# 62 asm8, asm8, ;
+: orli ( data iram -- ) h# 63 asm8, asm8, asm8, ; \ ANL iramadr,#data
+
+: cjne ( adr n # | n | @Rn | Rn ] -- )
+ dup # = if drop h# b4 asm8, immed, rel, exit then
+
+ dup @R0 = if drop h# b6 asm8, rel, exit then
+ dup @R1 = if drop h# b7 asm8, rel, exit then
+
+ dup R0 R7 between if R0 - h# b8 + asm8, rel, exit then
+
+ h# b5 asm8, iram, rel,
+;
+
+: cpl ( bit -- ) h# b2 asm8, asm8, ;
+: clr ( bit -- ) h# c2 asm8, asm8, ;
+: setb ( bit -- ) h# d2 asm8, asm8, ;
+: jc ( reladdr -- ) h# 40 asm8, rel, ;
+: jnc ( reladdr -- ) h# 50 asm8, rel, ;
+: jz ( reladdr -- ) h# 60 asm8, rel, ;
+: jnz ( reladdr -- ) h# 70 asm8, rel, ;
+: sjmp ( reladdr -- ) h# 80 asm8, rel, ;
+: jb ( reladdr bit -- ) h# 20 asm8, asm8, rel, ;
+: jbc ( reladdr bit -- ) h# 10 asm8, asm8, rel, ;
+: jnb ( reladdr bit -- ) h# 30 asm8, asm8, rel, ;
+
+: 1mi create c, does> c@ asm8, ;
+
+h# d6 1mi xchd_a,@R0
+h# d7 1mi xchd_a,@R1
+
+h# 00 1mi nop
+
+h# 22 1mi ret
+h# 32 1mi reti
+
+h# 03 1mi rr
+h# 13 1mi rrc
+h# 23 1mi rl
+h# 33 1mi rlc
+h# 73 1mi jmp@a+dptr
+h# a3 1mi incdptr
+h# b3 1mi cplc
+h# c3 1mi clrc
+h# d3 1mi setbc
+
+h# 84 1mi div
+h# a4 1mi mulab
+h# c4 1mi swapa
+h# d4 1mi da
+h# e4 1mi clra
+h# f4 1mi cpla
+
+h# e0 1mi movx_a,@dptr
+h# e2 1mi movx_a,@r0
+h# e3 1mi movx_a,@r1
+h# f0 1mi movx_@dptr,a
+h# f2 1mi movx_@r0,a
+h# f3 1mi movx_@r1,a
+h# 83 1mi movc_a,@a+pc
+h# 93 1mi movc_a,@a+dptr
+
+: ladr, ( adr -- ) wbsplit asm8, asm8, ;
+: ljmp ( adr -- ) h# 02 asm8, ladr, ;
+: lcall ( adr -- ) h# 12 asm8, ladr, ;
+
+: push ( iram -- ) h# c0 asm8, iram, ;
+: pop ( iram -- ) h# d0 asm8, iram, ;
+
+: xjmp ( adr -- )
+ dup here - byte-offset? if sjmp else ljmp then
+;
+: xcall ( adr -- )
+ dup here 2+ xor h# f800 and ( adr page-different? )
+ if lcall else acall then ( adr )
+;
+: put-ljmp ( to from -- )
+ >r
+ h# 12 r@ asm8! ( to r: from )
+ wbsplit ( to.lo to.hi r: from )
+ r@ 1+ asm8! ( to.lo r: from )
+ r> 2+ asm8! ( )
+;
+
+hex
+
+h# 10 constant bit-set?&clr \ JBC
+h# 20 constant bit-clr? \ JB
+h# 30 constant bit-set? \ JNB
+h# 40 constant no-carry? \ JC
+h# 50 constant carry? \ JNC
+h# 60 constant 0<> \ JZ
+h# 70 constant 0= \ JNZ
+
+: put-cond ( [ bit# ] cond -- )
+ dup asm8, \ Conditional branch
+ h# 40 < if asm8, then \ Include bit# if necessary
+;
+
+\ >mark must return the address of the opcode, not the address
+\ of the offset, in order for loclabel.fth to work.
+: >mark ( -- from ) here ;
+: >resolve ( from -- )
+ dup asm8@ h# 40 < if 2+ else 1+ then \ Skip opcode [ and bit# ]
+ here swap rel!
+;
+: <mark ( -- to ) here ;
+: <resolve ( from -- ) here rel! ;
+
+: but ( mark1 mark1 -- mark2 mark1 ) swap ;
+: yet ( mark -- mark mark ) dup ;
+
+\ Assemble DJNZ in either Rn or direct form
+: ,loop ( to [ iram | reg ] -- )
+ dup R0 R7 between if ( to reg )
+ R0 - h# d8 + asm8, ( to ) \ 2-byte Rn form
+ else ( to iram )
+ h# d5 asm8, asm8, ( to iram ) \ 3-byte direct form
+ then ( to )
+ <resolve
+;
+
+\ After we start redefining control structure words, we have to be
+\ careful not to use them with the expectation of their Forth meanings.
+: if ( [ bit# ] cond -- from ) >mark >r put-cond 0 asm8, r> ;
+: until ( to [ bit# ] cond -- ) h# 10 xor put-cond here rel! ;
+
+: then ( from -- ) >resolve ;
+: begin ( -- to ) <mark ;
+: ahead ( -- from ) h# 80 if ; \ SJMP
+: else ( from -- from' ) ahead but then ;
+: again ( to -- ) h# 80 asm8, <resolve ; \ SJMP
+: while ( to -- from to ) if but ;
+: repeat ( from to -- ) again then ;
+
+only forth also definitions
+
+\ If xxxx.1rrr bit is set, it is a regular form where the EA is R0..7
+\ If xxxx.0100 the EA is often #immed
+\ If xxxx.0101 the EA is often iram
+\ If xxxx.0110 the EA is always @R0
+\ If xxxx.0111 the EA is always @R1
+
+\ nop 0000.0000
+
+\ jbc bit reladr 0001.0000 bit reladr
+\ jb bit reladr 0010.0000 bit reladr
+\ jnb bit reladr 0011.0000 bit reladr
+
+\ jc reladr 0100.0000 reladr
+\ jnc reladr 0101.0000 reladr
+\ jz reladr 0110.0000 reladr
+\ jnz reladr 0111.0000 reladr
+\ sjmp reladr 1000.0000 reladr
+
+\ movx_a,@dptr 1110.0000
+\ movx_@dptr,a 1111.0000
+
+\ acall ppp1.0001 llll.llll
+\ ajmp ppp0.0001 llll.llll
+
+\ orl c,/bit 1010.0000 n n
+\ anl c,/bit 1011.0000 n n
+\ push 1100.0000 iram
+\ pop 1101.0000 iram
+
+\ orl c,bit 0111.0010 n n
+\ anl c,bit 1000.0010 n n
+\ clr bit 1100.0010 bit
+\ setb bit 1101.0010 bit
+
+
+\ ljmp adr 0000.0010 adr adr
+\ lcall adr 0001.0010 adr adr
+\ ret 0010.0010
+\ reti 0011.0010
+
+\ movx_a,@r0 1110.0010
+\ movx_@r0,a 1111.0010
+
+\ rr 0000.0011
+\ rrc 0001.0011
+\ rl 0010.0011
+\ rlc 0011.0011
+
+\ jmp@a+dptr 0111.0011
+\ movc_a,@a+pc 1000.0011
+\ movc_a,@a+dptr 1001.0011
+
+\ clrc 1100.0011
+\ setbc 1101.0011
+\ movx_a,@r1 1110.0011
+\ movx_@r1,a 1111.0011
+
+\ div 1000.0100 (shoehorned into mov iram,ea)
+\ mulab 1010.0100 (shoehorned into mov ea,iram)
+\ swap 1100.0100 (shoehorned into xchg)
+\ da 1101.0100 (shoehorned into djnz)
+\ clra 1110.0100 (shoehorned into mov a,ea)
+
+\ xchd a,@r0 1101.0110 (shoehorned into djnz)
+\ xchd a,@r1 1101.0111 (shoehorned into djnz)
+
+\ inc 0000.mmmm
+\ dec 0001.mmmm
+\ add 0010.mmmm
+\ addc 0011.mmmm
+\ orl 0100.mmmm
+\ anl 0101.mmmm
+\ xrl 0110.mmmm
+\ mov ea,# 0111.mmmm data
+\ mov iram,ea 1000.mmmm iram
+\ subb 1001.mmmm
+\ mov ea,iram 1010.mmmm iram
+\ cjne 1011.mmmm idata reladdr (cplc shoehorned at 3, cplbit at 2)
+\ xchg 1100.mmmm reladdr
+\ djnz 1101.mmmm reladdr (da shoehorned at 4, xchd at 6,7)
+\ mov a,ea 1110.mmmm (clr shoehorned at 4)
+\ mov ea,a 1111.mmmm (cpla shoehorned at 4)
+\ cpl a 1111.0100
+
+\ undef 1010.0101 \ shoehorned into mov ea,iram (redundant with 85)
1
0
Author: wmb
Date: 2007-07-18 07:08:52 +0200 (Wed, 18 Jul 2007)
New Revision: 471
Modified:
cpu/i8051/kernel.bth
cpu/i8051/metainit.fth
cpu/i8051/target.fth
cpu/ppc/Linux/Makefile
Log:
Checkpoint of 8051 scaffolding.
Modified: cpu/i8051/kernel.bth
===================================================================
--- cpu/i8051/kernel.bth 2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/kernel.bth 2007-07-18 05:08:52 UTC (rev 471)
@@ -42,7 +42,7 @@
warning-t off \ Turn OFF target warning messages
\ Uncomment the following line(s) for more debug output
-\ show? on 1 granularity ! 1 threshold !
+\ show? on 1 granularity ! 540 threshold !
\ warning-t on
fload ${BP}/cpu/i8051/kerncode.fth \ CPU-dependent Forth kernel
Modified: cpu/i8051/metainit.fth
===================================================================
--- cpu/i8051/metainit.fth 2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/metainit.fth 2007-07-18 05:08:52 UTC (rev 471)
@@ -26,17 +26,12 @@
\ This number is a target token rather than an absolute address.
hex
-0.0000 org 0.0000 voc-link-t token-t!
+0 voc-link-t token-t!
-ps-size-t equ ps-size
+\ ps-size-t equ ps-size
assembler
-\ This is at the first location in the Forth image.
-
-hex
-mlabel cld
-
\ LICENSE_BEGIN
\ Copyright (c) 2007 FirmWorks
\
Modified: cpu/i8051/target.fth
===================================================================
--- cpu/i8051/target.fth 2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/i8051/target.fth 2007-07-18 05:08:52 UTC (rev 471)
@@ -7,17 +7,21 @@
only forth also meta definitions
+: note-string-t ( adr len -- adr len ) ;
+
: lobyte h# 0ff and ;
: hibyte 8 rshift lobyte ;
2 constant /w-t
-/l-t constant /n-t
+: /l-t true abort" /l-t called" ;
+: l,-t true abort" l,-t called" ;
+/w-t constant /n-t
/w-t constant /a-t
/a-t constant /thread-t
-/w-t constant /token-t
+3 constant /token-t \ ljmp <adr>
/w-t constant /link-t
/token-t constant /defer-t
-\ /n-t h# 600 * constant user-size-t
+h# 80 constant user-size-t
\ /n-t h# 100 * constant ps-size-t
\ /n-t h# 100 * constant rs-size-t
/w-t constant /user#-t
@@ -27,14 +31,20 @@
\ 32 bit host Forth compiling 16-bit target Forth
: n->n-t ; immediate
+: n->l-t ; immediate
+: s->l-t ; immediate
: c!-t ( n add -- ) >hostaddr c! ;
: c@-t ( target-address -- n ) >hostaddr c@ ;
-\ Intel processors are little-endian
+\ Store data in little endian
: w!-t ( n add -- ) over lobyte over c!-t ca1+ swap hibyte swap c!-t ;
: w@-t ( target-address -- n ) dup c@-t swap 1+ c@-t 8 << or ;
+\ ljmp addresses are big endian
+: be-w!-t ( n target-address -- ) over lobyte over ca1+ c!-t swap hibyte swap c!-t ;
+: be-w@-t ( target-address -- n ) dup + c@-t swap c@-t 8 << or ;
+
alias le-w!-t w!-t
alias le-w@-t w@-t
@@ -57,15 +67,13 @@
: a@-t ( target-address -- target-address ) w@-t origin-t + ;
: a!-t ( token target-address -- ) swap origin-t - swap w!-t ;
-: token@-t ( target-address -- target-acf ) a@-t ;
-: token!-t ( acf target-address -- ) a!-t ;
+: token@-t ( target-address -- target-acf ) 1+ a@-t ;
+: token!-t ( acf target-address -- ) h# 12 over c!-t 1+ be-w!-t ; \ lcall instruction
: rlink@-t ( occurrence -- next-occurrence ) w@-t origin-t + ;
: rlink!-t ( next-occurrence occurrence -- ) swap origin-t - swap w!-t ;
-\ Machine independent
: a,-t ( adr -- ) here-t /a-t allot-t a!-t ;
-: token,-t ( token -- ) here-t /token-t allot-t token!-t ;
\ These versions of linkx-t are for absolute links
: link@-t ( target-address -- target-address' ) a@-t ;
@@ -85,7 +93,7 @@
\ Machine independent
: a-t, ( target-address -- ) here /a-t allot a-t! ;
-: token-t, ( target-address -- ) here /token-t allot token-t! ;
+: token-t, ( target-address -- ) here /token-t allot token!-t ;
\ Dictionary linked list; the list head is in the metacompiler environment
\ during metacompilation
@@ -112,6 +120,8 @@
userarea-t >hostaddr user-size-t erase
;
+: >body-t ( cfa-t -- pfa-t ) 3 + w@-t ;
+
: (>user-t) ( cfa-t -- user-address-t ) >body-t w@-t userarea-t + ;
: >user-t ( cfa-t -- user-address-h ) (>user-t) >hostaddr ;
@@ -158,7 +168,7 @@
/link +loop
;
: initmeta ( -- )
- init-relocation-t
+\ init-relocation-t
threads-t clear-threads-t threads-t current-t !
;
@@ -170,9 +180,6 @@
: branch! ( from-t target-addr-t -- ) over - swap ( offset from-t ) w!-t ;
: branch, ( target-t -- ) here-t - w,-t ;
-\ XXX FIXME for subroutine threaded
-: >body-t ( cfa-t -- pfa-t ) /n-t + ; \ This version is for indirect threaded
-
\ Store actions for some data types.
: isuser ( n acf -- ) >user-t n-t! ;
@@ -187,6 +194,7 @@
['] here-t is here
['] allot-t is asm-allot
['] c!-t is asm8!
+ ['] c@-t is asm8@
[ previous meta ]
;
: install-host-assembler ( -- ) [ assembler ] resident [ meta ] ;
Modified: cpu/ppc/Linux/Makefile
===================================================================
--- cpu/ppc/Linux/Makefile 2007-07-16 07:15:59 UTC (rev 470)
+++ cpu/ppc/Linux/Makefile 2007-07-18 05:08:52 UTC (rev 471)
@@ -2,8 +2,11 @@
WRAPPER = pforth
OPT = -O
# OPT =
-CFLAGS = -DUNIX -DSYS5 -DSIM -DPOWERPC -DARGREGS -DSIMNEXT
+BP=../../..
+
+CFLAGS = -DUNIX -DPPCSIM -DTARGET_POWERPC
+
CC = gcc
WRDIR = ${BP}/forth/wrapper
@@ -12,8 +15,8 @@
ZIPOBJS = zipmem.o deflate.o trees.o bits.o util.o inflate.o
-OBJS = wrapper.o ppcsim.o logger.o ${ZIPOBJS}
-TRACEOBJS = wrapper.o ppcsim.trace.o logger.o ${ZIPOBJS}
+OBJS = wrapsim.o ppcsim.o logger.o ${ZIPOBJS}
+TRACEOBJS = wrapsim.o ppcsim.trace.o logger.o ${ZIPOBJS}
SIMROMOBJS = simrom.o ppcsim.simrom.o
all: ppcforth ppcforth.trace
@@ -27,6 +30,9 @@
simrom: $(SIMROMOBJS)
$(CC) $(LFLAGS) $(SIMROMOBJS) -o $@
+wrapsim.o: ${WRDIR}/wrapper.c
+ ${CC} -c ${CFLAGS} $< -o $@
+
%.o: ${WRDIR}/%.c
${CC} -c ${CFLAGS} $< -o $@
@@ -34,16 +40,16 @@
${CC} -c ${CFLAGS} -I${ZIPDIR} $< -o $@
ppcsim.o: $(SIMDIR)/ppcsim.c
- $(CC) $(OPT) $(CFLAGS) -c $< -o $@
+ $(CC) $(OPT) $(CFLAGS) -DARGREGS -DSIMNEXT -c $< -o $@
ppcsim.trace.o: $(SIMDIR)/ppcsim.c
- $(CC) $(OPT) $(CFLAGS) -DTRACE -c $< -o $@
+ $(CC) $(OPT) $(CFLAGS) -DARGREGS -DSIMNEXT -DTRACE -c $< -o $@
ppcsim.simrom.o: $(SIMDIR)/ppcsim.c
- $(CC) $(CFLAGS) -DTRACE -DSIMROM -c $< -o $@
+ $(CC) $(CFLAGS) -DARGREGS -DSIMNEXT -DTRACE -DSIMROM -c $< -o $@
simrom.o: $(SIMDIR)/simrom.c
- $(CC) $(CFLAGS) -DTRACE -DSIMROM -c $< -o $@
+ $(CC) $(CFLAGS) -DARGREGS -DSIMNEXT -DTRACE -DSIMROM -c $< -o $@
clean:
@rm -f *.o ppcforth ppcforth.trace
1
0
Author: wmb
Date: 2007-07-16 09:15:59 +0200 (Mon, 16 Jul 2007)
New Revision: 470
Added:
cpu/i8051/build/
Log:
Added i8051 build directory.
1
0