mirror of
https://github.com/nineties/planckforth
synced 2025-01-27 08:00:04 +01:00
Update welcome message
This commit is contained in:
parent
bd281482de
commit
5942192ada
5 changed files with 16 additions and 16 deletions
|
@ -86,4 +86,4 @@ $ ./planck < bootstrap.fs --i386-linux example/fib.fs
|
||||||
| < | less | ( a b -- c ) | c = (a < b) |
|
| < | less | ( a b -- c ) | c = (a < b) |
|
||||||
| = | equal | ( a b -- c ) | c = (a == b) |
|
| = | equal | ( a b -- c ) | c = (a == b) |
|
||||||
| v | argv | ( -- a-addr u ) | argv and argc |
|
| v | argv | ( -- a-addr u ) | argv and argc |
|
||||||
| V | version | ( -- c-addr ) | Version string
|
| V | impl | ( -- c-addr ) | Implementation String |
|
||||||
|
|
|
@ -453,6 +453,7 @@ alias-builtin mod %
|
||||||
alias-builtin and &
|
alias-builtin and &
|
||||||
alias-builtin or |
|
alias-builtin or |
|
||||||
alias-builtin xor ^
|
alias-builtin xor ^
|
||||||
|
alias-builtin implementation V
|
||||||
|
|
||||||
\ Rename existing FORTH words
|
\ Rename existing FORTH words
|
||||||
: word W ;
|
: word W ;
|
||||||
|
@ -2422,7 +2423,7 @@ need-defined (read)
|
||||||
|
|
||||||
words id. name>string name>link
|
words id. name>string name>link
|
||||||
include included
|
include included
|
||||||
next-arg shift-args arg argv argc
|
next-arg shift-args arg argv argc implementation
|
||||||
|
|
||||||
[if] [unless] [else] [then] defined?
|
[if] [unless] [else] [then] defined?
|
||||||
open-file close-file write-file flush-file
|
open-file close-file write-file flush-file
|
||||||
|
@ -2477,6 +2478,7 @@ need-defined (read)
|
||||||
next-arg dup argv @ !
|
next-arg dup argv @ !
|
||||||
included
|
included
|
||||||
else
|
else
|
||||||
|
." PlanckForth (implementation: " implementation type ." )" cr
|
||||||
." Ready." cr
|
." Ready." cr
|
||||||
s" /dev/tty" included
|
s" /dev/tty" included
|
||||||
then
|
then
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define VERSION "C implementation"
|
#define IMPLEMENTATION "C"
|
||||||
|
|
||||||
typedef uintptr_t cell;
|
typedef uintptr_t cell;
|
||||||
typedef void (**cfa)();
|
typedef void (**cfa)();
|
||||||
|
@ -143,7 +143,7 @@ defcode("t", type) { putchar(pop()); next(); }
|
||||||
defcode("x", exec) { (*(ip = (cfa) pop()))(); }
|
defcode("x", exec) { (*(ip = (cfa) pop()))(); }
|
||||||
defcode("f", find_) { push((cell) find(pop())); next(); }
|
defcode("f", find_) { push((cell) find(pop())); next(); }
|
||||||
defcode("v", argv_) { push((cell) saved_argv); push(saved_argc); next(); }
|
defcode("v", argv_) { push((cell) saved_argv); push(saved_argc); next(); }
|
||||||
defcode("V", version) { push((cell) VERSION); next(); }
|
defcode("V", impl) { push((cell) IMPLEMENTATION); next(); }
|
||||||
#define defbinary(name, label, op, ty) \
|
#define defbinary(name, label, op, ty) \
|
||||||
defcode(name, label) { \
|
defcode(name, label) { \
|
||||||
ty b = (ty) pop(); \
|
ty b = (ty) pop(); \
|
||||||
|
|
|
@ -7,7 +7,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
VERSION = "Python 3.x implementation"
|
IMPLEMENTATION = "Python 3.x"
|
||||||
MEMORY_SIZE = 0x20000
|
MEMORY_SIZE = 0x20000
|
||||||
STACK_SIZE = 0x400
|
STACK_SIZE = 0x400
|
||||||
RSTACK_SIZE = 0x400
|
RSTACK_SIZE = 0x400
|
||||||
|
@ -158,8 +158,8 @@ for addr in argv_addrs:
|
||||||
comma(addr)
|
comma(addr)
|
||||||
|
|
||||||
# Version String
|
# Version String
|
||||||
VERSION_ADDR = read(HERE_CELL)
|
IMPLEMENTATION_ADDR = read(HERE_CELL)
|
||||||
comma_string(VERSION)
|
comma_string(IMPLEMENTATION)
|
||||||
align()
|
align()
|
||||||
|
|
||||||
def docol(ip, np):
|
def docol(ip, np):
|
||||||
|
@ -223,7 +223,7 @@ def argv():
|
||||||
push(ARGV_ADDR)
|
push(ARGV_ADDR)
|
||||||
push(len(sys.argv))
|
push(len(sys.argv))
|
||||||
add_simple_operator('v', argv)
|
add_simple_operator('v', argv)
|
||||||
add_simple_operator('V', lambda: push(VERSION_ADDR))
|
add_simple_operator('V', lambda: push(IMPLEMENTATION_ADDR))
|
||||||
|
|
||||||
SUCCESS = 0
|
SUCCESS = 0
|
||||||
ALLOCATE_ERROR = -59
|
ALLOCATE_ERROR = -59
|
||||||
|
|
14
planck.xxd
14
planck.xxd
|
@ -6,10 +6,10 @@
|
||||||
00000028: 3400 2000 0100 0000 e_ehsize,e_phentsize,e_phnum,e_shentsize
|
00000028: 3400 2000 0100 0000 e_ehsize,e_phentsize,e_phnum,e_shentsize
|
||||||
00000030: 0000 0000 0100 0000 e_shnum,e_shstrndx,<phdr>p_type=PT_LOAD
|
00000030: 0000 0000 0100 0000 e_shnum,e_shstrndx,<phdr>p_type=PT_LOAD
|
||||||
00000038: 0000 0000 0080 0408 p_offset,p_vaddr=0x08048000
|
00000038: 0000 0000 0080 0408 p_offset,p_vaddr=0x08048000
|
||||||
00000040: 0000 0000 d003 0000 p_paddr,p_filesz
|
00000040: 0000 0000 c003 0000 p_paddr,p_filesz
|
||||||
00000048: 0000 2000 0700 0000 p_memsz(128KB),p_flags=PF_X|PF_W|PF_R
|
00000048: 0000 2000 0700 0000 p_memsz(128KB),p_flags=PF_X|PF_W|PF_R
|
||||||
00000050: 0010 0000 d083 0408 p_align, <here>
|
00000050: 0010 0000 c083 0408 p_align, <here>
|
||||||
00000058: 9483 0408 0000 0000 <latest:init="V">, <sp0>
|
00000058: 9483 0408 0000 0000 <latest:init="I">, <sp0>
|
||||||
00000060: e480 0408 5c81 0408 <interpreter>key, find
|
00000060: e480 0408 5c81 0408 <interpreter>key, find
|
||||||
00000068: 8881 0408 3081 0408 execute, jump
|
00000068: 8881 0408 3081 0408 execute, jump
|
||||||
00000070: f0ff ffff be60 8004 -16, movl $interpreter, %esi
|
00000070: f0ff ffff be60 8004 -16, movl $interpreter, %esi
|
||||||
|
@ -157,11 +157,9 @@
|
||||||
00000384: 0408 89c3 83c3 0453 movl %eax,%ebx; addl $4,%ebx; pushl %ebx
|
00000384: 0408 89c3 83c3 0453 movl %eax,%ebx; addl $4,%ebx; pushl %ebx
|
||||||
0000038c: ff30 adff 2000 0000 pushl (%eax); next;
|
0000038c: ff30 adff 2000 0000 pushl (%eax); next;
|
||||||
|
|
||||||
00000394: 7483 0408 0156 0000 V: version
|
00000394: 7483 0408 0156 0000 V: implementation
|
||||||
0000039c: 8083 0408 68a8 8304 pushl $version
|
0000039c: a083 0408 68a8 8304 pushl $version
|
||||||
000003a4: 08ad ff20 6861 6e64 next; <version>hand
|
000003a4: 08ad ff20 6861 6e64 next; <version>hand
|
||||||
000003ac: 2d77 7269 7474 656e -written
|
000003ac: 2d77 7269 7474 656e -written
|
||||||
000003b4: 2069 3338 362d 6c69 i386-li
|
000003b4: 2069 3338 362d 6c69 i386-li
|
||||||
000003bc: 6e75 7820 696d 706c nux impl
|
000003bc: 6e75 7800 nux
|
||||||
000003c4: 656d 656e 7461 7469 ementati
|
|
||||||
000003cc: 6f6e 0000 on
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue