code: 9ferno

Download patch

ref: 91c1b89f14d987811dc33894b34577e5837a8382
parent: 3559ce237b055bff14861549b29ca4cdf8707221
author: 9ferno <gophone2015@gmail.com>
date: Tue Feb 15 23:42:09 EST 2022

added more device binds at startup

--- a/init.f
+++ b/init.f
@@ -1,19 +1,32 @@
 include /forth/helpers.f
 
-1 2 + 3 + 4 + 5 + .
-: first 1 2 + 3 + . ;
-
-first
-
 include /forth/ns.f
 " ns before" type cr
 ns
 
-"	#l0" " /net" MAFTER sbind
-"	#I0" " /net" MAFTER sbind
+" #b"	" /dev"	MAFTER	sbind	\ kbd
+" #c"	" /dev"	MAFTER	sbind	\ console device
+\ " #d"	" /fd"	MREPL	sbind 	\ dup(3)	crashes 9ferno
+\ " #e"	" /env"	MREPL MCREATE or sbind	\ environment
+\ " #i"	" /dev"	MREPL	sbind	\ draw device
+" #l0"	" /net"	MAFTER	sbind	\ Ethernet device
+\ " #m"	" /dev"	MAFTER	sbind	\ pointer/mouse
+" #p"	" /proc"	MREPL	sbind	\ proc device
+\ " #r"	" /dev"	MAFTER	sbind	\ rtc
+\ " #s"	" /chan"	MREPL	sbind	\ server registry	crashes 9ferno
+" #t"	" /dev"	MAFTER	sbind	\ serial line
+\ " #v"	" /dev"	MAFTER	sbind	\ VGA
+" #I0"	" /net"	MAFTER	sbind	\ IP
+" #P"	" /dev"	MAFTER	sbind	\ arch
+" #S"	" /dev"	MAFTER	sbind	\ Disks
+" #f"	" /dev"	MREPL	sbind	\ forth device
 
 " ns after" type cr
 ns
 
+1 2 + 3 + 4 + 5 + .
+: first 1 2 + 3 + . ;
+
+first
 
 " end of init.f" type cr
--- a/os/pc64/forth.s
+++ b/os/pc64/forth.s
@@ -146,6 +146,9 @@
 	MOVQ (CX), IP	/* IP = address of c_boot */
 	ADDQ $24, IP	/* to get to the parameter field address of boot word */
 
+	/* clear TOP */
+	XORQ TOP, TOP
+
 /* lodsl could make this simpler. But, this is more comprehensible
 	why not JMP* (W)?
 
--- a/os/pc64/pc64
+++ b/os/pc64/pc64
@@ -195,6 +195,7 @@
 	/osinit.dis
 	/init.f
 	/forth/helpers.f
+	/forth/ns.f
 # for custom initialization and shutdown
 	/dis/init
 	/dis/shutdown
--- a/os/port/chan.c
+++ b/os/port/chan.c
@@ -1384,6 +1384,7 @@
 	e.nelems = 0;
 	e.nerror = 0;
 	if(waserror()){
+		print("namec: waserror() before cclose pid %d %r\n", up->pid);
 		cclose(c);
 		free(e.name);
 		free(e.elems);
--- a/os/port/devbin.c
+++ b/os/port/devbin.c
@@ -598,4 +598,3 @@
 	/* ) = 0x29 = 41 */
 	return until(readp, writep, startp, maxn, nextreadp, 0x29);
 }
-