refactor & reorganize
This commit is contained in:
parent
e268cac0a4
commit
67bb06dd8f
16
jumpforth.S
16
jumpforth.S
|
|
@ -1270,7 +1270,7 @@ defword ISBOOTSTRAP,"BOOTSTRAP?"
|
|||
|
||||
/* ( -- widn ... wid1 n ) Return the current search order */
|
||||
/* Redefining this word with DEFER! will change the bootstrap search order */
|
||||
defword GET_ORDER,"BOOTSTRAP-GET-ORDER"
|
||||
defword BOOTSTRAP_GET_ORDER,"BOOTSTRAP-GET-ORDER"
|
||||
.int BOOTSTRAP_WORDLIST,FORTH_WORDLIST,LIT,2,EXIT
|
||||
|
||||
/* ( c-addr u wid -- 0 | xt 1 | xt -1 ) */
|
||||
|
|
@ -1288,7 +1288,7 @@ defword SEARCH_WORDLIST,"SEARCH-WORDLIST"
|
|||
|
||||
/* ( c-addr u -- c-addr u 0 | xt 1 | xt -1 ) */
|
||||
defword FIND
|
||||
.int TWOTOR,GET_ORDER
|
||||
.int TWOTOR,BOOTSTRAP_GET_ORDER
|
||||
0: .int DUP,ZBRANCH,(1f - .)
|
||||
.int SUB1,SWAP,TWORFETCH,ROT,SEARCH_WORDLIST,QDUP,ZBRANCH,(0b - .)
|
||||
.int TWORDROP,TWOTOR,NDROP,TWOFROMR,EXIT
|
||||
|
|
@ -1336,6 +1336,7 @@ defword ESCAPED_CHAR
|
|||
0: litstring "Unknown escape sequence: \\"
|
||||
.int TYPE,EMIT,EOL,BAILOUT,EXIT
|
||||
|
||||
/* ( "ccc<quote>" -- c-addr u ) */
|
||||
defword READSTRING
|
||||
.int HERE
|
||||
0: .int PEEK_CHAR,LIT,34,NEQU,ZBRANCH,(1f - .)
|
||||
|
|
@ -1343,17 +1344,17 @@ defword READSTRING
|
|||
1: .int LIT,1,IN,INCREMENT,HERE,OVER,SUB,ALIGN,EXIT
|
||||
|
||||
defword PARSENUMBER
|
||||
.int DUP,LIT,0,GT,ZBRANCH,(6f - .)
|
||||
.int DUP,LIT,0,GT,ZBRANCH,(7f - .)
|
||||
.int OVER,FETCHBYTE,LIT,'-',EQU,DUP,TOR,LIT,0,TOR,ZBRANCH,(0f - .)
|
||||
.int DUP,LIT,1,GT,ZBRANCH,(6f - .),BRANCH,(1f - .)
|
||||
0: .int OVER,FETCHBYTE,LIT,'0',SUB
|
||||
.int DUP,LIT,0,GE,ZBRANCH,(5f - .)
|
||||
.int DUP,LIT,9,LE,ZBRANCH,(5f - .)
|
||||
.int DUP,LIT,9,ULE,ZBRANCH,(5f - .)
|
||||
.int FROMR,LIT,10,MUL,ADD,TOR
|
||||
1: .int SUB1,QDUP,ZBRANCH,(8f - .)
|
||||
.int SWAP,ADD1,SWAP,BRANCH,(0b - .)
|
||||
5: .int DROP
|
||||
6: .int TWODROP,RDROP,RDROP,FALSE,EXIT
|
||||
6: .int RDROP,RDROP
|
||||
7: .int TWODROP,FALSE,EXIT
|
||||
8: .int DROP,FROMR,FROMR,ZBRANCH,(9f - .)
|
||||
.int NEGATE
|
||||
9: .int TRUE,EXIT
|
||||
|
|
@ -1370,8 +1371,7 @@ defword INTERPRET
|
|||
.int TYPE,BAILOUT
|
||||
/* ELSE */
|
||||
1: .int WORD,TWODUP,PARSENUMBER,ZBRANCH,(3f - .)
|
||||
.int NROT,TWODROP
|
||||
.int STATE,FETCH,ZBRANCH,(2f - .)
|
||||
.int STATE,FETCH,TWONIP,ZBRANCH,(2f - .)
|
||||
.int LIT,LIT,COMMA,COMMA
|
||||
2: .int EXIT
|
||||
/* ELSE */
|
||||
|
|
|
|||
1453
startup.4th
1453
startup.4th
File diff suppressed because it is too large
Load Diff
|
|
@ -1,14 +1,18 @@
|
|||
ALSO UTILITY
|
||||
: STATUS ( obj-addr c-addr u -- obj-addr )
|
||||
TYPE ":\n Value: " TYPE DUP @ .
|
||||
"\n Object size: " TYPE DUP OBJECT-SIZE U. EOL EOL ;
|
||||
PREVIOUS
|
||||
|
||||
SYSTEM-WORDLIST PUSH-ORDER
|
||||
256 KB SIZEOF MEMBLOCK% - CONSTANT 256-KB-BLOCK
|
||||
PREVIOUS
|
||||
|
||||
: TEST
|
||||
24 ALLOCATE 1234 OVER ! "Allocated 24 bytes" STATUS
|
||||
33 RESIZE "Resized to 33 bytes" STATUS
|
||||
24 RESIZE "Resized to 24 bytes" STATUS
|
||||
256 KB MEMBLOCK-DATA-OFFSET - RESIZE "Resized to 256 KiB - header" STATUS
|
||||
256-KB-BLOCK RESIZE "Resized to 256 KiB - header" STATUS
|
||||
32 RESIZE "Resized to 32 bytes" STATUS
|
||||
24 RESIZE "Resized to 24 bytes" STATUS
|
||||
4 RESIZE "Resized to 4 bytes" STATUS
|
||||
|
|
|
|||
Loading…
Reference in New Issue