mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 06:40:56 +11:00
Compare commits
No commits in common. "7a38c3e2287ebb4c35a07b1f18941850303c29d6" and "d777a74be30cefc1f097ef2f3b6bba7bde63e44a" have entirely different histories.
7a38c3e228
...
d777a74be3
8
blk/046
8
blk/046
@ -2,15 +2,15 @@ Parameter Stack
|
|||||||
|
|
||||||
DROP a --
|
DROP a --
|
||||||
DUP a -- a a
|
DUP a -- a a
|
||||||
?DUP DUP if a is nonzero
|
|
||||||
NIP a b -- b
|
|
||||||
OVER a b -- a b a
|
OVER a b -- a b a
|
||||||
ROT a b c -- b c a
|
ROT a b c -- b c a
|
||||||
SWAP a b -- b a
|
SWAP a b -- b a
|
||||||
TUCK a b -- b a b
|
|
||||||
2DROP a a --
|
2DROP a a --
|
||||||
2DUP a b -- a b a b
|
2DUP a b -- a b a b
|
||||||
2OVER a b c d -- a b c d a b
|
2OVER a b c d -- a b c d a b
|
||||||
2SWAP a b c d -- c d a b
|
2SWAP a b c d -- c d a b
|
||||||
'S Returns current stack pointer, not counting the
|
'S Returns current stack pointer, not counting the
|
||||||
push it's making right now. (cont.)
|
push it's making right now.
|
||||||
|
S0 Returns address of PSP TOS. When PSP is empty,
|
||||||
|
'S == S0
|
||||||
|
(cont.)
|
||||||
|
3
blk/047
3
blk/047
@ -1,5 +1,4 @@
|
|||||||
S0 Returns address of PSP TOS. When PSP is empty,
|
(cont.)
|
||||||
'S == S0
|
|
||||||
PICK Pick nth item from stack. "0 PICK" = DUP,
|
PICK Pick nth item from stack. "0 PICK" = DUP,
|
||||||
"1 PICK" = OVER.
|
"1 PICK" = OVER.
|
||||||
ROLL Rotate PSP over n items. "1 ROLL" = SWAP,
|
ROLL Rotate PSP over n items. "1 ROLL" = SWAP,
|
||||||
|
2
blk/107
2
blk/107
@ -3,7 +3,7 @@
|
|||||||
BEGIN
|
BEGIN
|
||||||
C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 )
|
C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 )
|
||||||
= NOT IF DROP FBUF THEN
|
= NOT IF DROP FBUF THEN
|
||||||
TUCK C@ 0xd = ( a1 a2 f1 )
|
SWAP OVER C@ 0xd = ( a1 a2 f1 )
|
||||||
OVER BLK) = OR ( a1 a2 f1|f2 )
|
OVER BLK) = OR ( a1 a2 f1|f2 )
|
||||||
UNTIL
|
UNTIL
|
||||||
DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! THEN
|
DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! THEN
|
||||||
|
4
blk/108
4
blk/108
@ -4,10 +4,10 @@
|
|||||||
EDPOS @ 64 MOD 63 -^ ;
|
EDPOS @ 64 MOD 63 -^ ;
|
||||||
: _I
|
: _I
|
||||||
IBUF _type _rbufsz IBUF _blen 2DUP > IF
|
IBUF _type _rbufsz IBUF _blen 2DUP > IF
|
||||||
TUCK - ( ilen chars-to-move )
|
SWAP OVER - ( ilen chars-to-move )
|
||||||
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
|
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
|
||||||
3 PICK MOVE- ( ctm ilen )
|
3 PICK MOVE- ( ctm ilen )
|
||||||
NIP ( ilen )
|
SWAP DROP ( ilen )
|
||||||
ELSE DROP ( ilen becomes rbuffsize )
|
ELSE DROP ( ilen becomes rbuffsize )
|
||||||
THEN
|
THEN
|
||||||
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
|
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
|
||||||
|
4
blk/125
4
blk/125
@ -7,9 +7,9 @@
|
|||||||
THEN
|
THEN
|
||||||
ROT ( o a n ol )
|
ROT ( o a n ol )
|
||||||
< IF ( under limit, do nothing )
|
< IF ( under limit, do nothing )
|
||||||
NIP ( a )
|
SWAP DROP ( a )
|
||||||
ELSE ( o a )
|
ELSE ( o a )
|
||||||
TUCK @ ( a o n )
|
SWAP OVER @ ( a o n )
|
||||||
-^ ( a n-o )
|
-^ ( a n-o )
|
||||||
OVER ! ( a )
|
OVER ! ( a )
|
||||||
THEN
|
THEN
|
||||||
|
2
blk/144
2
blk/144
@ -3,7 +3,7 @@
|
|||||||
: AMOVE
|
: AMOVE
|
||||||
( u ) 0 DO
|
( u ) 0 DO
|
||||||
SWAP DUP I + A@ ( dst src x )
|
SWAP DUP I + A@ ( dst src x )
|
||||||
ROT TUCK I + ( src dst x dst )
|
ROT SWAP OVER I + ( src dst x dst )
|
||||||
A! ( src dst )
|
A! ( src dst )
|
||||||
LOOP
|
LOOP
|
||||||
2DROP
|
2DROP
|
||||||
|
2
blk/154
2
blk/154
@ -3,7 +3,7 @@
|
|||||||
hit 0. )
|
hit 0. )
|
||||||
: ENDCASE
|
: ENDCASE
|
||||||
BEGIN
|
BEGIN
|
||||||
?DUP NOT IF EXIT THEN
|
DUP NOT IF DROP EXIT THEN
|
||||||
[COMPILE] THEN
|
[COMPILE] THEN
|
||||||
AGAIN
|
AGAIN
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
12
blk/307
12
blk/307
@ -1,13 +1,9 @@
|
|||||||
( a -- a a )
|
( a -- a a )
|
||||||
CODE DUP
|
CODE DUP
|
||||||
HL POPqq, chkPS,
|
HL POPqq, ( A )
|
||||||
HL PUSHqq, HL PUSHqq,
|
chkPS,
|
||||||
;CODE
|
HL PUSHqq, ( A )
|
||||||
|
HL PUSHqq, ( A )
|
||||||
CODE ?DUP
|
|
||||||
HL POPqq, chkPS,
|
|
||||||
HL PUSHqq,
|
|
||||||
HLZ, IFNZ, HL PUSHqq, THEN,
|
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
( a -- )
|
( a -- )
|
||||||
|
5
blk/354
5
blk/354
@ -6,8 +6,7 @@
|
|||||||
: =><= 2 PICK >= ( n l f ) ROT ROT >= AND ;
|
: =><= 2 PICK >= ( n l f ) ROT ROT >= AND ;
|
||||||
: MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ;
|
: MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ;
|
||||||
: MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ;
|
: MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ;
|
||||||
: NIP SWAP DROP ; : TUCK SWAP OVER ;
|
|
||||||
: C@+ ( a -- a+1 c ) DUP C@ SWAP 1+ SWAP ;
|
: C@+ ( a -- a+1 c ) DUP C@ SWAP 1+ SWAP ;
|
||||||
: C!+ ( c a -- a+1 ) TUCK C! 1+ ;
|
: C!+ ( c a -- a+1 ) SWAP OVER C! 1+ ;
|
||||||
: C@- ( a -- a-1 c ) DUP C@ SWAP 1- SWAP ;
|
: C@- ( a -- a-1 c ) DUP C@ SWAP 1- SWAP ;
|
||||||
: C!- ( c a -- a-1 ) TUCK C! 1- ;
|
: C!- ( c a -- a-1 ) SWAP OVER C! 1- ;
|
||||||
|
8
blk/357
8
blk/357
@ -5,12 +5,12 @@
|
|||||||
- SWAP EXIT ( 0-n f )
|
- SWAP EXIT ( 0-n f )
|
||||||
THEN
|
THEN
|
||||||
0 SWAP _pdacc ( a r f )
|
0 SWAP _pdacc ( a r f )
|
||||||
?DUP IF 2DROP 0 EXIT THEN
|
DUP IF 2DROP 0 EXIT THEN
|
||||||
BEGIN ( a r )
|
BEGIN ( a r 0 )
|
||||||
SWAP 1+ ( r a+1 )
|
DROP SWAP 1+ ( r a+1 )
|
||||||
DUP C@ ( r a c )
|
DUP C@ ( r a c )
|
||||||
ROT SWAP ( a r c )
|
ROT SWAP ( a r c )
|
||||||
_pdacc ( a r f )
|
_pdacc ( a r f )
|
||||||
?DUP UNTIL
|
DUP UNTIL
|
||||||
1 = ( a r f )
|
1 = ( a r f )
|
||||||
ROT DROP ( r f ) ;
|
ROT DROP ( r f ) ;
|
||||||
|
2
blk/360
2
blk/360
@ -6,7 +6,7 @@
|
|||||||
0 ( a r )
|
0 ( a r )
|
||||||
BEGIN
|
BEGIN
|
||||||
SWAP C@+ ( r a+1 c )
|
SWAP C@+ ( r a+1 c )
|
||||||
?DUP NOT IF DROP 1 EXIT THEN ( r, 1 )
|
DUP NOT IF 2DROP 1 EXIT THEN ( r, 1 )
|
||||||
_ ( r a n )
|
_ ( r a n )
|
||||||
DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
|
DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
|
||||||
ROT 16 * + ( a r*16+n )
|
ROT 16 * + ( a r*16+n )
|
||||||
|
2
blk/362
2
blk/362
@ -6,7 +6,7 @@
|
|||||||
0 ( a r )
|
0 ( a r )
|
||||||
BEGIN
|
BEGIN
|
||||||
SWAP C@+ ( r a+1 c )
|
SWAP C@+ ( r a+1 c )
|
||||||
?DUP NOT IF DROP 1 EXIT THEN ( r 1 )
|
DUP NOT IF 2DROP 1 EXIT THEN ( r 1 )
|
||||||
_ ( r a n )
|
_ ( r a n )
|
||||||
DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
|
DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
|
||||||
ROT 2 * + ( a r*2+n )
|
ROT 2 * + ( a r*2+n )
|
||||||
|
2
blk/364
2
blk/364
@ -1,7 +1,7 @@
|
|||||||
: C<? 0x06 RAM+ @ ;
|
: C<? 0x06 RAM+ @ ;
|
||||||
: C<
|
: C<
|
||||||
0x08 RAM+ @ ( 08 == C<* override )
|
0x08 RAM+ @ ( 08 == C<* override )
|
||||||
?DUP NOT IF 0x0c RAM+ @ THEN ( 0c == C<* )
|
DUP NOT IF DROP 0x0c RAM+ @ THEN ( 0c == C<* )
|
||||||
EXECUTE
|
EXECUTE
|
||||||
;
|
;
|
||||||
: , H@ ! H@ 2+ HERE ! ;
|
: , H@ ! H@ 2+ HERE ! ;
|
||||||
|
2
blk/366
2
blk/366
@ -9,5 +9,5 @@
|
|||||||
OVER ! 1+ C< ( a c )
|
OVER ! 1+ C< ( a c )
|
||||||
OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
|
OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
|
||||||
UNTIL ( a c )
|
UNTIL ( a c )
|
||||||
NIP 0x0e RAM+ ( ws a )
|
SWAP DROP 0x0e RAM+ ( ws a )
|
||||||
SWAP EOT? IF 4 OVER ! THEN ;
|
SWAP EOT? IF 4 OVER ! THEN ;
|
||||||
|
2
blk/367
2
blk/367
@ -1,6 +1,6 @@
|
|||||||
: SCPY
|
: SCPY
|
||||||
BEGIN ( a )
|
BEGIN ( a )
|
||||||
C@+ ( a+1 c )
|
C@+ ( a+1 c )
|
||||||
?DUP NOT IF DROP EXIT THEN
|
DUP NOT IF 2DROP EXIT THEN
|
||||||
C, ( a c )
|
C, ( a c )
|
||||||
AGAIN ;
|
AGAIN ;
|
||||||
|
4
blk/369
4
blk/369
@ -5,9 +5,9 @@
|
|||||||
CURRENT @ 1-
|
CURRENT @ 1-
|
||||||
DUP C@ 128 OR SWAP C! ;
|
DUP C@ 128 OR SWAP C! ;
|
||||||
: IMMED? 1- C@ 0x80 AND ;
|
: IMMED? 1- C@ 0x80 AND ;
|
||||||
: +! TUCK @ + SWAP ! ;
|
: +! SWAP OVER @ + SWAP ! ;
|
||||||
: -^ SWAP - ;
|
: -^ SWAP - ;
|
||||||
: / /MOD NIP ;
|
: / /MOD SWAP DROP ;
|
||||||
: MOD /MOD DROP ;
|
: MOD /MOD DROP ;
|
||||||
: ALLOT HERE +! ;
|
: ALLOT HERE +! ;
|
||||||
: CREATE (entry) 11 ( 11 == cellWord ) C, ;
|
: CREATE (entry) 11 ( 11 == cellWord ) C, ;
|
||||||
|
5
blk/370
5
blk/370
@ -4,9 +4,10 @@
|
|||||||
LIT< (wnf) FIND DROP EXECUTE
|
LIT< (wnf) FIND DROP EXECUTE
|
||||||
;
|
;
|
||||||
: ROLL
|
: ROLL
|
||||||
?DUP NOT IF EXIT THEN
|
DUP NOT IF EXIT THEN
|
||||||
1+ DUP PICK ( n val )
|
1+ DUP PICK ( n val )
|
||||||
SWAP 2 * (roll) ( val )
|
SWAP 2 * (roll) ( val )
|
||||||
NIP ;
|
SWAP DROP
|
||||||
|
;
|
||||||
: 2OVER 3 PICK 3 PICK ;
|
: 2OVER 3 PICK 3 PICK ;
|
||||||
: 2SWAP 3 ROLL 3 ROLL ;
|
: 2SWAP 3 ROLL 3 ROLL ;
|
||||||
|
2
blk/371
2
blk/371
@ -4,7 +4,7 @@
|
|||||||
ROT C!+ ( a1+1 a2+1 )
|
ROT C!+ ( a1+1 a2+1 )
|
||||||
LOOP 2DROP ;
|
LOOP 2DROP ;
|
||||||
: MOVE- ( a1 a2 u -- )
|
: MOVE- ( a1 a2 u -- )
|
||||||
TUCK + 1- ( a1 u a2+u-1 )
|
SWAP OVER + 1- ( a1 u a2+u-1 )
|
||||||
ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 )
|
ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 )
|
||||||
ROT ( u ) 0 DO ( a2 a1 )
|
ROT ( u ) 0 DO ( a2 a1 )
|
||||||
C@- ( a2 a1-1 x )
|
C@- ( a2 a1-1 x )
|
||||||
|
4
blk/381
4
blk/381
@ -1,6 +1,6 @@
|
|||||||
: EMIT
|
: EMIT
|
||||||
( 0x53==(emit) override )
|
( 0x53==(emit) override )
|
||||||
0x53 RAM+ @ ?DUP IF EXECUTE ELSE (emit) THEN ;
|
0x53 RAM+ @ DUP IF EXECUTE ELSE DROP (emit) THEN ;
|
||||||
: (print)
|
: (print)
|
||||||
BEGIN
|
BEGIN
|
||||||
C@+ ( a+1 c )
|
C@+ ( a+1 c )
|
||||||
@ -10,6 +10,6 @@
|
|||||||
AGAIN ;
|
AGAIN ;
|
||||||
: BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ;
|
: BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ;
|
||||||
: CRLF CR LF ; : SPC 32 EMIT ;
|
: CRLF CR LF ; : SPC 32 EMIT ;
|
||||||
: NL 0x0a RAM+ @ ( NLPTR ) ?DUP IF EXECUTE ELSE CRLF THEN ;
|
: NL 0x0a RAM+ @ ( NLPTR ) DUP IF EXECUTE ELSE DROP CRLF THEN ;
|
||||||
: (uflw) LIT" stack underflow" ERR ;
|
: (uflw) LIT" stack underflow" ERR ;
|
||||||
: (wnf) (print) SPC LIT" word not found" ERR ;
|
: (wnf) (print) SPC LIT" word not found" ERR ;
|
||||||
|
2
blk/387
2
blk/387
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
: KEY
|
: KEY
|
||||||
85 RAM+ @ ( (key) override )
|
85 RAM+ @ ( (key) override )
|
||||||
?DUP IF EXECUTE ELSE (key) THEN ;
|
DUP IF EXECUTE ELSE DROP (key) THEN ;
|
||||||
|
|
||||||
|
|
||||||
( cont.: read one char into input buffer and returns whether we
|
( cont.: read one char into input buffer and returns whether we
|
||||||
|
2
blk/414
2
blk/414
@ -11,5 +11,5 @@
|
|||||||
DUP _shift? IF DROP 1 PS2_SHIFT C! (key) EXIT THEN
|
DUP _shift? IF DROP 1 PS2_SHIFT C! (key) EXIT THEN
|
||||||
( ah, finally, we have a gentle run-of-the-mill KC )
|
( ah, finally, we have a gentle run-of-the-mill KC )
|
||||||
PS2_CODES PS2_SHIFT C@ IF 0x80 + THEN + C@
|
PS2_CODES PS2_SHIFT C@ IF 0x80 + THEN + C@
|
||||||
?DUP NOT IF (key) THEN ;
|
DUP NOT IF DROP (key) THEN ;
|
||||||
|
|
||||||
|
2
blk/569
2
blk/569
@ -8,5 +8,5 @@
|
|||||||
( gid dmask )
|
( gid dmask )
|
||||||
0xff XOR ( dpos ) 0 ( dindex )
|
0xff XOR ( dpos ) 0 ( dindex )
|
||||||
BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1-
|
BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1-
|
||||||
( gid dpos dindex ) NIP
|
( gid dpos dindex ) SWAP DROP
|
||||||
( gid dindex ) SWAP 8 * + ;
|
( gid dindex ) SWAP 8 * + ;
|
||||||
|
2
blk/604
2
blk/604
@ -8,7 +8,7 @@
|
|||||||
0 ( cnt )
|
0 ( cnt )
|
||||||
BEGIN
|
BEGIN
|
||||||
_idle
|
_idle
|
||||||
DUP 0xff = IF DROP ELSE NIP EXIT THEN
|
DUP 0xff = IF DROP ELSE SWAP DROP EXIT THEN
|
||||||
1+
|
1+
|
||||||
DUP 20 = UNTIL
|
DUP 20 = UNTIL
|
||||||
DROP 0xff
|
DROP 0xff
|
||||||
|
2
blk/634
2
blk/634
@ -4,5 +4,5 @@
|
|||||||
CREATE _ '0' C, ':' C, 'A' C, '[' C, 'a' C, 0xff C,
|
CREATE _ '0' C, ':' C, 'A' C, '[' C, 'a' C, 0xff C,
|
||||||
: _nxtcls
|
: _nxtcls
|
||||||
_sel @ _ BEGIN ( c a ) C@+ 2 PICK > UNTIL ( c a )
|
_sel @ _ BEGIN ( c a ) C@+ 2 PICK > UNTIL ( c a )
|
||||||
1- C@ NIP _sel !
|
1- C@ SWAP DROP _sel !
|
||||||
;
|
;
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
@ -45,15 +45,16 @@ device I use in this recipe.
|
|||||||
* [GNU screen][screen]
|
* [GNU screen][screen]
|
||||||
* A FTDI-to-TTL cable to connect to the Serial I/O module
|
* A FTDI-to-TTL cable to connect to the Serial I/O module
|
||||||
|
|
||||||
|
### Configure your build
|
||||||
|
|
||||||
|
Modules used in this build are configured through the `conf.fs` file in this
|
||||||
|
folder. There isn't much to configure, but it's there.
|
||||||
|
|
||||||
### Build the binary
|
### Build the binary
|
||||||
|
|
||||||
Building the binary is as simple as running `make`. This will yield `os.bin`
|
Building the binary is as simple as running `make`. This will yield `os.bin`
|
||||||
which can then be written to EEPROM.
|
which can then be written to EEPROM.
|
||||||
|
|
||||||
This build is controlled by the `xcomp.fs` unit, which loads `blk/618`. That's
|
|
||||||
what you need to modify if you want to customize your build (if you do, you'll
|
|
||||||
need to rebuild `/emul/stage` because the blkfs is embedded in it).
|
|
||||||
|
|
||||||
### Emulate
|
### Emulate
|
||||||
|
|
||||||
The Collapse OS project includes a RC2014 emulator suitable for this image.
|
The Collapse OS project includes a RC2014 emulator suitable for this image.
|
||||||
|
Loading…
Reference in New Issue
Block a user